当前位置: 首页>>代码示例>>Java>>正文


Java LocalizedFormats.NO_REGRESSORS属性代码示例

本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.NO_REGRESSORS属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.NO_REGRESSORS属性的具体用法?Java LocalizedFormats.NO_REGRESSORS怎么用?Java LocalizedFormats.NO_REGRESSORS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.exception.util.LocalizedFormats的用法示例。


在下文中一共展示了LocalizedFormats.NO_REGRESSORS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MillerUpdatingRegression

/**
 * This is the augmented constructor for the MillerUpdatingRegression class.
 *
 * @param numberOfVariables number of regressors to expect, not including constant
 * @param includeConstant include a constant automatically
 * @param errorTolerance  zero tolerance, how machine zero is determined
 * @throws ModelSpecificationException if {@code numberOfVariables is less than 1}
 */
public MillerUpdatingRegression(int numberOfVariables, boolean includeConstant, double errorTolerance)
throws ModelSpecificationException {
    if (numberOfVariables < 1) {
        throw new ModelSpecificationException(LocalizedFormats.NO_REGRESSORS);
    }
    if (includeConstant) {
        this.nvars = numberOfVariables + 1;
    } else {
        this.nvars = numberOfVariables;
    }
    this.hasIntercept = includeConstant;
    this.nobs = 0;
    this.d = new double[this.nvars];
    this.rhs = new double[this.nvars];
    this.r = new double[this.nvars * (this.nvars - 1) / 2];
    this.tol = new double[this.nvars];
    this.rss = new double[this.nvars];
    this.vorder = new int[this.nvars];
    this.x_sing = new double[this.nvars];
    this.work_sing = new double[this.nvars];
    this.work_tolset = new double[this.nvars];
    this.lindep = new boolean[this.nvars];
    for (int i = 0; i < this.nvars; i++) {
        vorder[i] = i;
    }
    if (errorTolerance > 0) {
        this.epsilon = errorTolerance;
    } else {
        this.epsilon = -errorTolerance;
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:39,代码来源:MillerUpdatingRegression.java

示例2: regcf

/**
 * The regcf method conducts the linear regression and extracts the
 * parameter vector. Notice that the algorithm can do subset regression
 * with no alteration.
 *
 * @param nreq how many of the regressors to include (either in canonical
 * order, or in the current reordered state)
 * @return an array with the estimated slope coefficients
 * @throws ModelSpecificationException if {@code nreq} is less than 1
 * or greater than the number of independent variables
 */
private double[] regcf(int nreq) throws ModelSpecificationException {
    int nextr;
    if (nreq < 1) {
        throw new ModelSpecificationException(LocalizedFormats.NO_REGRESSORS);
    }
    if (nreq > this.nvars) {
        throw new ModelSpecificationException(
                LocalizedFormats.TOO_MANY_REGRESSORS, nreq, this.nvars);
    }
    if (!this.tol_set) {
        tolset();
    }
    final double[] ret = new double[nreq];
    boolean rankProblem = false;
    for (int i = nreq - 1; i > -1; i--) {
        if (FastMath.sqrt(d[i]) < tol[i]) {
            ret[i] = 0.0;
            d[i] = 0.0;
            rankProblem = true;
        } else {
            ret[i] = rhs[i];
            nextr = i * (nvars + nvars - i - 1) / 2;
            for (int j = i + 1; j < nreq; j++) {
                ret[i] = smartAdd(ret[i], -r[nextr] * ret[j]);
                ++nextr;
            }
        }
    }
    if (rankProblem) {
        for (int i = 0; i < nreq; i++) {
            if (this.lindep[i]) {
                ret[i] = Double.NaN;
            }
        }
    }
    return ret;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:48,代码来源:MillerUpdatingRegression.java


注:本文中的org.apache.commons.math3.exception.util.LocalizedFormats.NO_REGRESSORS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。