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

Method getHalfCircles

JSAT/test/jsat/FixedProblems.java:222–238  ·  view source on GitHub ↗
(int dataSetSize, Random rand, double... radi )

Source from the content-addressed store, hash-verified

220 }
221
222 public static ClassificationDataSet getHalfCircles(int dataSetSize, Random rand, double... radi )
223 {
224 ClassificationDataSet train = new ClassificationDataSet(2, new CategoricalData[0], new CategoricalData(radi.length));
225
226 int n = dataSetSize/2 ;
227
228 for(int r_i = 0; r_i < radi.length; r_i++)
229 for (int i = 0; i < n; i++)
230 {
231 double t = 2 * Math.PI * (i/2) / n;
232 double x = radi[r_i] * Math.cos(t) + (rand.nextDouble() - 0.5) / 5;
233 double y = radi[r_i] * Math.sin(t) + (rand.nextDouble() - 0.5) / 5;
234 train.addDataPoint(DenseVector.toDenseVec(x, y), new int[0], r_i);
235 }
236
237 return train;
238 }
239}

Callers 5

testTrainWarmCFastSMOMethod · 0.95
testTrainWarmCMethod · 0.95
testTrainWarmCMethod · 0.95

Calls 3

addDataPointMethod · 0.95
toDenseVecMethod · 0.95
nextDoubleMethod · 0.45

Tested by

no test coverage detected