PLearn 0.1
|
#include <OneVsAllVMatrix.h>
Public Member Functions | |
OneVsAllVMatrix () | |
Default constructor. | |
OneVsAllVMatrix (VMat the_source, int the_target_class, bool inverse_target=false) | |
virtual void | build () |
Simply calls inherited::build() then build_(). | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual OneVsAllVMatrix * | deepCopy (CopiesMap &copies) const |
Static Public Member Functions | |
static string | _classname_ () |
Declares name and deepCopy methods. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Public Attributes | |
int | target_class |
bool | inverse_target |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &v) const |
Fill the vector 'v' with the content of the i-th row. | |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Types | |
typedef SourceVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Definition at line 51 of file OneVsAllVMatrix.h.
typedef SourceVMatrix PLearn::OneVsAllVMatrix::inherited [private] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 56 of file OneVsAllVMatrix.h.
PLearn::OneVsAllVMatrix::OneVsAllVMatrix | ( | ) |
Default constructor.
Definition at line 52 of file OneVsAllVMatrix.cc.
: inherited(), target_class(0) { }
PLearn::OneVsAllVMatrix::OneVsAllVMatrix | ( | VMat | the_source, |
int | the_target_class, | ||
bool | inverse_target = false |
||
) |
Definition at line 59 of file OneVsAllVMatrix.cc.
References build().
: inherited(the_source), target_class(the_target_class), inverse_target(inverse_target) { build(); }
string PLearn::OneVsAllVMatrix::_classname_ | ( | ) | [static] |
Declares name and deepCopy methods.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
OptionList & PLearn::OneVsAllVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
RemoteMethodMap & PLearn::OneVsAllVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
Object * PLearn::OneVsAllVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
StaticInitializer OneVsAllVMatrix::_static_initializer_ & PLearn::OneVsAllVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
void PLearn::OneVsAllVMatrix::build | ( | ) | [virtual] |
Simply calls inherited::build() then build_().
Reimplemented from PLearn::SourceVMatrix.
Definition at line 86 of file OneVsAllVMatrix.cc.
References PLearn::SourceVMatrix::build(), and build_().
Referenced by OneVsAllVMatrix().
{ inherited::build(); build_(); }
void PLearn::OneVsAllVMatrix::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 95 of file OneVsAllVMatrix.cc.
References PLearn::VMatrix::extrasize_, PLearn::VMatrix::inputsize_, PLCHECK, PLERROR, PLearn::TVec< T >::resize(), PLearn::SourceVMatrix::setMetaInfoFromSource(), PLearn::SourceVMatrix::source, PLearn::SourceVMatrix::sourcerow, PLearn::VMatrix::targetsize_, PLearn::VMatrix::updateMtime(), PLearn::VMatrix::weightsize_, PLearn::VMat::width(), and PLearn::VMatrix::width_.
Referenced by build().
{ if(source) { if(source->targetsize() != 1) PLERROR("OneVsAllVMatrix::build_(): targetsize_ should be 1"); updateMtime(source); setMetaInfoFromSource(); PLCHECK(width_ == inputsize_+targetsize_+weightsize_+extrasize_); sourcerow.resize(source->width()); } }
string PLearn::OneVsAllVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
void PLearn::OneVsAllVMatrix::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares this class' options.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 77 of file OneVsAllVMatrix.cc.
References PLearn::SourceVMatrix::declareOptions().
{ // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::OneVsAllVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 111 of file OneVsAllVMatrix.h.
OneVsAllVMatrix * PLearn::OneVsAllVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
Fill the vector 'v' with the content of the i-th row.
v is assumed to be the right size.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 113 of file OneVsAllVMatrix.cc.
References PLearn::VMatrix::inputsize_, inverse_target, PLearn::SourceVMatrix::source, and target_class.
{ source->getRow(i,v); bool t = int(v[inputsize_]) == target_class; v[inputsize_] = inverse_target? !t : t; }
OptionList & PLearn::OneVsAllVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
OptionMap & PLearn::OneVsAllVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
RemoteMethodMap & PLearn::OneVsAllVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::SourceVMatrix.
Definition at line 72 of file OneVsAllVMatrix.cc.
void PLearn::OneVsAllVMatrix::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::SourceVMatrix.
Definition at line 123 of file OneVsAllVMatrix.cc.
References PLearn::SourceVMatrix::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); //PLERROR("OneVsAllVMatrix::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
Reimplemented from PLearn::SourceVMatrix.
Definition at line 111 of file OneVsAllVMatrix.h.
Definition at line 71 of file OneVsAllVMatrix.h.
Referenced by getNewRow().
Definition at line 70 of file OneVsAllVMatrix.h.
Referenced by getNewRow().