List of usage examples for org.apache.commons.math3.exception.util LocalizedFormats INVALID_REGRESSION_OBSERVATION
LocalizedFormats INVALID_REGRESSION_OBSERVATION
To view the source code for org.apache.commons.math3.exception.util LocalizedFormats INVALID_REGRESSION_OBSERVATION.
Click Source Link
From source file:experiment.SimpleRegression_bug.java
/** * Adds the observations represented by the elements in * <code>data</code>./*from w ww . j av a 2s. co m*/ * <p> * <code>(data[0][0],data[0][1])</code> will be the first observation, then * <code>(data[1][0],data[1][1])</code>, etc.</p> * <p> * This method does not replace data that has already been added. The * observations represented by <code>data</code> are added to the existing * dataset.</p> * <p> * To replace all data, use <code>clear()</code> before adding the new * data.</p> * * @param data array of observations to be added * @throws ModelSpecificationException if the length of {@code data[i]} is not * greater than or equal to 2 */ public void addData(final double[][] data) throws ModelSpecificationException { for (int i = 0; i < data.length; i++) { if (data[i].length < 2) { throw new ModelSpecificationException(LocalizedFormats.INVALID_REGRESSION_OBSERVATION, data[i].length, 2); } addData(data[i][0], data[i][1]); } }
From source file:experiment.SimpleRegression_bug.java
/** * Adds one observation to the regression model. * * @param x the independent variables which form the design matrix * @param y the dependent or response variable * @throws ModelSpecificationException if the length of {@code x} does not equal * the number of independent variables in the model *//* w w w. jav a 2s. c o m*/ public void addObservation(final double[] x, final double y) throws ModelSpecificationException { if (x == null || x.length == 0) { throw new ModelSpecificationException(LocalizedFormats.INVALID_REGRESSION_OBSERVATION, x != null ? x.length : 0, 1); } addData(x[0], y); }