37 using namespace shark;
40 #include <boost/property_tree/json_parser.hpp> 42 int main(
int argc,
char ** argv ) {
45 ofstream results(
"results.txt" );
47 ofstream plot(
"plot.txt" );
48 plot <<
"set key outside bottom center" << endl;
49 plot <<
"set size square" << endl;
50 plot <<
"set zeroaxis" << endl;
51 plot <<
"set border 0" << endl;
52 plot <<
"set xrange [-4:4]" << endl;
53 plot <<
"set yrange [-4:4]" << endl;
55 results.setf( ios_base::scientific );
56 results.precision( 10 );
57 plot.setf( ios_base::scientific );
72 << cma.
mean()( 0 ) <<
"," 73 << cma.
mean()( 1 ) <<
" size " 76 << ::atan( cma.
eigenVectors()( 1, 0 ) / cma.
eigenVectors()( 0, 0 ) ) / M_PI * 180 <<
" front fillstyle empty border 2" << endl;
86 ostream_iterator< double >( results,
" " )
91 ostream_iterator< double >( results,
" " )
102 plot <<
"set object " 104 <<
" ellipse center " 105 << cma.
mean()( 0 ) <<
"," 106 << cma.
mean()( 1 ) <<
" size " 109 << ::atan( cma.
eigenVectors()( 1, 0 ) / cma.
eigenVectors()( 0, 0 ) ) / M_PI * 180 <<
" front fillstyle empty border 2" << endl;
114 << cma.
sigma() <<
" " 119 ostream_iterator< double >( results,
" " )
124 ostream_iterator< double >( results,
" " )
129 plot <<
"plot 'results.txt' using 7:8 with lp title 'Population mean'" << endl;
131 return( EXIT_SUCCESS );