MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / getSimpleRegression1

Method getSimpleRegression1

JSAT/test/jsat/FixedProblems.java:165–174  ·  view source on GitHub ↗

Creates a new Regression problem of the for x 2 +c sin(x 2 ) = y. It is meant to be an easy test case for non-linear regression algorithms. @param dataSetSize the number of data points to generate @param rand the source of randomness @return a new regression data set

(int dataSetSize, Random rand)

Source from the content-addressed store, hash-verified

163 * @return a new regression data set
164 */
165 public static RegressionDataSet getSimpleRegression1(int dataSetSize, Random rand)
166 {
167 RegressionDataSet rds = new RegressionDataSet(2, new CategoricalData[0]);
168 for(int i = 0; i < dataSetSize; i++)
169 {
170 Vec s = new DenseVector(new double[]{rand.nextDouble()*4, rand.nextDouble()*4});
171 rds.addDataPoint(s, new int[0], s.get(0)+4*Math.cos(s.get(1)));
172 }
173 return rds;
174 }
175
176 /**
177 * Returns a classification problem with small uniform noise where there is

Calls 3

addDataPointMethod · 0.95
getMethod · 0.95
nextDoubleMethod · 0.45

Tested by

no test coverage detected