org.apache.commons.math3.stat.regression.RegressionResults Java Examples

The following examples show how to use org.apache.commons.math3.stat.regression.RegressionResults. 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: SurfactantAnalysis.java    From act with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Perform linear regression over a list of X/Y coordinates
 * @param coords A set of coordinates over which to perform linear regression.
 * @return The slope and intercept of the regression line.
 */
public Pair<Double, Double> performRegressionOverXYPairs(List<Pair<Double, Double>> coords) {
  SimpleRegression regression = new SimpleRegression(true);
  for (Pair<Double, Double> c : coords) {
    regression.addData(c.getLeft(), c.getRight());
  }
  // Note: the regress() call can raise an exception for small molecules.  We should probably handle that gracefully.
  RegressionResults result = regression.regress();
  return Pair.of(regression.getSlope(), regression.getIntercept());
}
 
Example #2
Source File: GamaRegression.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public GamaRegression(final double[] param, final int nbFeatures, final RegressionResults regressionResults) {
	super();
	this.regressionResults = regressionResults;
	this.nbFeatures = nbFeatures;
	this.param = param;
}