Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#NO_DATA

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#NO_DATA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MillerUpdatingRegression.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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) {
    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++) {
        this.addObservation(x[i], y[i]);
    }
    return;
}
 
Example 2
Source File: MillerUpdatingRegression.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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) {
    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++) {
        this.addObservation(x[i], y[i]);
    }
    return;
}
 
Example 3
Source File: NoDataException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Construct the exception.
 */
public NoDataException() {
    this(LocalizedFormats.NO_DATA);
}
 
Example 4
Source File: NoDataException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Construct the exception.
 */
public NoDataException() {
    this(LocalizedFormats.NO_DATA);
}
 
Example 5
Source File: NoDataException.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Construct the exception.
 */
public NoDataException() {
    this(LocalizedFormats.NO_DATA);
}
 
Example 6
Source File: NoDataException.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct the exception with a specific context.
 *
 * @param specific Contextual information on what caused the exception.
 */
public NoDataException(Localizable specific) {
    super(specific, LocalizedFormats.NO_DATA, (Object[]) null);
}