(int dataSetSize, Random rand, double... radi )
| 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 | } |
no test coverage detected