#include <OneHotVMatrix.h>
Inheritance diagram for PLearn::OneHotVMatrix:
Public Member Functions | |
OneHotVMatrix () | |
default constructor (for automatic deserialization) | |
OneHotVMatrix (VMat the_underlying_distr, int the_nclasses, real the_cold_value=0.0, real the_host_value=1.0) | |
(see special case when nclasses==1 desribed above) Warning: VMFields are NOT YET handled by this constructor | |
PLEARN_DECLARE_OBJECT (OneHotVMatrix) | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
virtual void | reset_dimensions () |
in case the dimensions of an underlying vmat has changed, recompute it | |
virtual real | dot (int i1, int i2, int inputsize) const |
virtual real | dot (int i, const Vec &v) const |
returns the result of the dot product between row i and the given vec (only v.length() first elements of row i are considered). | |
Protected Member Functions | |
virtual void | getNewRow (int i, const Vec &samplevec) const |
This is the only method requiring implementation in subclasses. | |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) | |
Protected Attributes | |
VMat | underlying_distr |
int | nclasses |
real | cold_value |
real | hot_value |
Private Types | |
typedef RowBufferedVMatrix | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Definition at line 64 of file OneHotVMatrix.h.
|
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 66 of file OneHotVMatrix.h. Referenced by OneHotVMatrix(). |
|
default constructor (for automatic deserialization)
Definition at line 51 of file OneHotVMatrix.cc. |
|
(see special case when nclasses==1 desribed above) Warning: VMFields are NOT YET handled by this constructor
Definition at line 56 of file OneHotVMatrix.cc. References inherited. |
|
Should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object. Reimplemented from PLearn::VMatrix. Definition at line 65 of file OneHotVMatrix.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::VMatrix. Definition at line 72 of file OneHotVMatrix.cc. Referenced by build(). |
|
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); } Reimplemented from PLearn::VMatrix. Definition at line 77 of file OneHotVMatrix.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
returns the result of the dot product between row i and the given vec (only v.length() first elements of row i are considered).
Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 106 of file OneHotVMatrix.cc. References underlying_distr. |
|
returns the dot product between row i1 and row i2 (considering only the inputsize first elements). The default version in VMatrix is somewhat inefficient, as it repeatedly calls get(i,j) The default version in RowBufferedVMatrix is a little better as it buffers the 2 Vecs between calls in case one of them is needed again. But the real strength of this method is for specialised and efficient versions in subbclasses. This method is typically used by SmartKernels so that they can compute kernel values between input samples efficiently. Reimplemented from PLearn::RowBufferedVMatrix. Definition at line 101 of file OneHotVMatrix.cc. References underlying_distr. |
|
This is the only method requiring implementation in subclasses.
Implements PLearn::RowBufferedVMatrix. Definition at line 86 of file OneHotVMatrix.cc. References cold_value, PLearn::fill_one_hot(), PLearn::VMat::getSubRow(), hot_value, PLearn::TVec< T >::length(), PLearn::VMatrix::length(), nclasses, PLERROR, PLearn::TVec< T >::subVec(), underlying_distr, PLearn::Vec, PLearn::VMat::width(), and PLearn::VMatrix::width(). |
|
|
|
in case the dimensions of an underlying vmat has changed, recompute it
Reimplemented from PLearn::VMatrix. Definition at line 95 of file OneHotVMatrix.h. References PLearn::VMat::length(), underlying_distr, and PLearn::VMat::width(). |
|
Definition at line 71 of file OneHotVMatrix.h. Referenced by getNewRow(). |
|
Definition at line 72 of file OneHotVMatrix.h. Referenced by getNewRow(). |
|
Definition at line 70 of file OneHotVMatrix.h. Referenced by getNewRow(). |
|
Definition at line 69 of file OneHotVMatrix.h. Referenced by dot(), getNewRow(), and reset_dimensions(). |