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


Java LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS属性代码示例

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


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

示例1: addObservations

/**
 * Adds a series of observations to the regression model. The lengths of
 * x and y must be the same and x must be rectangular.
 *
 * @param x a series of observations on the independent variables
 * @param y a series of observations on the dependent variable
 * The length of x and y must be the same
 * @throws ModelSpecificationException if {@code x} is not rectangular, does not match
 * the length of {@code y} or does not contain sufficient data to estimate the model
 */
public void addObservations(final double[][] x,final double[] y) throws ModelSpecificationException {
    if ((x == null) || (y == null) || (x.length != y.length)) {
        throw new ModelSpecificationException(
              LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
              (x == null) ? 0 : x.length,
              (y == null) ? 0 : y.length);
    }
    boolean obsOk=true;
    for( int i = 0 ; i < x.length; i++){
        if( x[i] == null || x[i].length == 0 ){
            obsOk = false;
        }
    }
    if( !obsOk ){
        throw new ModelSpecificationException(
              LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
              0, 1);
    }
    for( int i = 0 ; i < x.length ; i++){
        addData( x[i][0], y[i] );
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:32,代码来源:SimpleRegression.java

示例2: addObservations

/**
 * Adds multiple observations to the model.
 * @param x observations on the regressors
 * @param y observations on the regressand
 * @throws ModelSpecificationException if {@code x} is not rectangular, does not match
 * the length of {@code y} or does not contain sufficient data to estimate the model
 */
public void addObservations(double[][] x, double[] y) throws ModelSpecificationException {
    if ((x == null) || (y == null) || (x.length != y.length)) {
        throw new ModelSpecificationException(
              LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
              (x == null) ? 0 : x.length,
              (y == null) ? 0 : y.length);
    }
    if (x.length == 0) {  // Must be no y data either
        throw new ModelSpecificationException(
                LocalizedFormats.NO_DATA);
    }
    if (x[0].length + 1 > x.length) {
        throw new ModelSpecificationException(
              LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
              x.length, x[0].length);
    }
    for (int i = 0; i < x.length; i++) {
        addObservation(x[i], y[i]);
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:27,代码来源:MillerUpdatingRegression.java

示例3: validateSampleData

/**
 * Validates sample data.  Checks that
 * <ul><li>Neither x nor y is null or empty;</li>
 * <li>The length (i.e. number of rows) of x equals the length of y</li>
 * <li>x has at least one more row than it has columns (i.e. there is
 * sufficient data to estimate regression coefficients for each of the
 * columns in x plus an intercept.</li>
 * </ul>
 *
 * @param x the [n,k] array representing the x data
 * @param y the [n,1] array representing the y data
 * @throws NullArgumentException if {@code x} or {@code y} is null
 * @throws DimensionMismatchException if {@code x} and {@code y} do not
 * have the same length
 * @throws NoDataException if {@code x} or {@code y} are zero-length
 * @throws MathIllegalArgumentException if the number of rows of {@code x}
 * is not larger than the number of columns + 1
 */
protected void validateSampleData(double[][] x, double[] y) throws MathIllegalArgumentException {
    if ((x == null) || (y == null)) {
        throw new NullArgumentException();
    }
    if (x.length != y.length) {
        throw new DimensionMismatchException(y.length, x.length);
    }
    if (x.length == 0) {  // Must be no y data either
        throw new NoDataException();
    }
    if (x[0].length + 1 > x.length) {
        throw new MathIllegalArgumentException(
                LocalizedFormats.NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS,
                x.length, x[0].length);
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:34,代码来源:AbstractMultipleLinearRegression.java


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