PLearn 0.1
|
#include <KolmogorovSmirnovCommand.h>
Public Member Functions | |
KolmogorovSmirnovCommand () | |
virtual void | run (const vector< string > &args) |
The actual implementation of the 'KolmogorovSmirnovCommand' command. | |
Static Protected Attributes | |
static PLearnCommandRegistry | reg_ |
This allows to register the 'KolmogorovSmirnovCommand' command in the command registry. |
Definition at line 49 of file KolmogorovSmirnovCommand.h.
PLearn::KolmogorovSmirnovCommand::KolmogorovSmirnovCommand | ( | ) | [inline] |
Definition at line 52 of file KolmogorovSmirnovCommand.h.
: PLearnCommand("ks-stat", "Computes the Kolmogorov-Smirnov statistic between 2 matrix columns", "ks-stat <matA> <colA> <matB> <colB> [conv] \n" "Will compute the ks-statistic between column colA of matrix matA \n" "and column colB of matrix matB, with presion conv (defaults to 10). \n" "You can use any matrix files recognized by PLearn \n" ) {}
void PLearn::KolmogorovSmirnovCommand::run | ( | const vector< string > & | args | ) | [virtual] |
The actual implementation of the 'KolmogorovSmirnovCommand' command.
Implements PLearn::PLearnCommand.
Definition at line 51 of file KolmogorovSmirnovCommand.cc.
References PLearn::endl(), PLearn::VMat::getColumn(), PLearn::getDataSet(), PLearn::KS_test(), PLERROR, and PLearn::toint().
{ if(args.size()!=4 && args.size()!=5) PLERROR("ks-stat expects 4 or 5 arguments, check the help"); VMat m1 = getDataSet(args[0]); int c1 = toint(args[1]); VMat m2 = getDataSet(args[2]); int c2 = toint(args[3]); int conv = 10; if(args.size()==5) conv = toint(args[4]); Vec v1 = m1.getColumn(c1); Vec v2 = m2.getColumn(c2); real D, ks_stat; KS_test(v1, v2, conv, D, ks_stat); cout << "Maximum absolute difference between the 2 cdfs is: " << D << endl; cout << "Result of Kolmogorov-Smirnov test is: " << ks_stat << endl; }
PLearnCommandRegistry PLearn::KolmogorovSmirnovCommand::reg_ [static, protected] |
This allows to register the 'KolmogorovSmirnovCommand' command in the command registry.
Definition at line 65 of file KolmogorovSmirnovCommand.h.