44 using namespace shark;
51 void draw(RealVector& point)
const 55 double alpha = 0.4 * M_PI * cluster;
62 int main(
int argc,
char** argv)
65 unsigned int ell = 100;
80 trainer.
train(ke, data);
85 for (std::size_t y=0; y<35; y++)
87 input(1) = 5.0 * (y - 17.0) / 17.0;
88 for (std::size_t x=0; x<70; x++)
90 input(0) = 5.0 * (x - 34.5) / 34.5;
91 double val = ke(input)(0);
92 output[y][x] = (val < 0.0) ?
' ' :
':';
102 int x = (int)std::floor(34.5 * v(0) / 5.0 + 34.5 + 0.5);
103 int y = (int)std::floor(17.0 * v(1) / 5.0 + 17.0 + 0.5);
104 if (x >= 0 && y >= 0 && x < 70 && y < 35) output[y][x] =
'*';
109 <<
"One-Class SVM example program." << endl
110 <<
"100 samples are drawn from a mixture of five Gaussians. Data samples" << endl
111 <<
"are marked with an asterisk '*'. The :::-shaded regions are the SVM's" << endl
112 <<
"estimate of the high-probability region of the distribution." << endl
114 for (std::size_t y=0; y<35; y++) cout << output[y] << endl;