1 #ifndef CREATE_TWO_SPIRALS_DATA_SET_H_
2 #define CREATE_TWO_SPIRALS_DATA_SET_H_
23 Eigen::MatrixXd& Xtr, Eigen::MatrixXd& Ytr,
24 Eigen::MatrixXd& Xte, Eigen::MatrixXd& Yte)
27 const int points = 96 * density;
29 Xtr.resize(points + 1, 2);
30 Ytr.resize(points + 1, 1);
31 Xte.resize(points + 1, 2);
32 Yte.resize(points + 1, 1);
36 for(
int i = 0; i <= points; i++)
39 const double angle = i * M_PI / (16.0 * density);
41 const double radius = maxDiameter * (104 * density - i) / (104 * density);
43 const double x = radius * cos(angle);
44 const double y = radius * sin(angle);
48 Xtr.row(trIdx) << x,
y;
49 Ytr.row(trIdx) << 1.0;
50 Xte.row(trIdx) << -x, -
y;
51 Yte.row(teIdx) << -1.0;
56 Xtr.row(trIdx) << x,
y;
57 Ytr.row(trIdx) << 1.0;
58 Xtr.row(trIdx + 1) << -x, -
y;
59 Ytr.row(trIdx + 1) << -1.0;
65 Xte.row(teIdx) << x,
y;
66 Yte.row(teIdx) << 1.0;
67 Xte.row(teIdx + 1) << -x, -
y;
68 Yte.row(teIdx + 1) << -1.0;
77 #endif // CREATE_TWO_SPIRALS_DATA_SET_H_