Creates a 2D linearly separable problem @param dataSetSize0 size of the first class @param dataSetSize1 size of the second class @param sep the separation between the two classes. The true decision boundary stays in the same location regardless of this value @param rand source of randomness @return
(int dataSetSize0, int dataSetSize1, double sep, Random rand)
| 55 | * @return a 2d testing set |
| 56 | */ |
| 57 | public static ClassificationDataSet get2ClassLinear2D(int dataSetSize0, int dataSetSize1, double sep, Random rand) |
| 58 | { |
| 59 | ClassificationDataSet train = new ClassificationDataSet(2, new CategoricalData[0], new CategoricalData(2)); |
| 60 | |
| 61 | NormalM a = new NormalM(DenseVector.toDenseVec(sep, sep), Matrix.eye(2)); |
| 62 | NormalM b = new NormalM(DenseVector.toDenseVec(-sep, -sep), Matrix.eye(2)); |
| 63 | |
| 64 | for(Vec s : a.sample(dataSetSize0, rand)) |
| 65 | train.addDataPoint(s, new int[0], 0); |
| 66 | for(Vec s : b.sample(dataSetSize1, rand)) |
| 67 | train.addDataPoint(s, new int[0], 1); |
| 68 | |
| 69 | return train; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Generates a linearly separable binary classification problem |
no test coverage detected