PLearn 0.1
Public Member Functions | Static Protected Attributes
PLearn::KolmogorovSmirnovCommand Class Reference

#include <KolmogorovSmirnovCommand.h>

Inheritance diagram for PLearn::KolmogorovSmirnovCommand:
Inheritance graph
[legend]
Collaboration diagram for PLearn::KolmogorovSmirnovCommand:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

Definition at line 49 of file KolmogorovSmirnovCommand.h.


Constructor & Destructor Documentation

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"
            ) 
    {}

Member Function Documentation

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;
}

Here is the call graph for this function:


Member Data Documentation

This allows to register the 'KolmogorovSmirnovCommand' command in the command registry.

Definition at line 65 of file KolmogorovSmirnovCommand.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines