#include <SumOverBagsVariable.h>
Inheritance diagram for PLearn::SumOverBagsVariable:
Public Member Functions | |
SumOverBagsVariable () | |
protected default constructor for persistence | |
SumOverBagsVariable (VMat the_vmat, Func the_f, int maxbagsize, int nsamples, bool average, bool transpose=false) | |
Sum_{bags vmat} f(inputs and targets in bag) By convention a bag is a sequence of rows of the vmat in which the last column of the target indicates whether the row is the first one (and/or) the last one, with its two least significant bits: last_column_of_target == 1 ==> first row last_column_of_target == 2 ==> last row last_column_of_target == 0 ==> intermediate row last_column_of_target == 1+2==3 ==> single-row bag (both first and last) the last column of the target is not given in the call to f, but a bag_size input is provided instead. | |
PLEARN_DECLARE_OBJECT (SumOverBagsVariable) | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
virtual void | recomputeSize (int &l, int &w) const |
Recomputes the length l and width w that this variable should have, according to its parent variables. | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
virtual void | fprop () |
compute output given input | |
virtual void | bprop () |
virtual void | fbprop () |
do both fprop and bprop | |
virtual void | fpropOneBag (bool do_bprop=false) |
void | printInfo (bool print_gradient) |
Static Public 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) | |
Public Attributes | |
VMat | vmat |
Func | f |
bool | average |
int | max_bag_size |
int | n_samples |
bool | transpose |
int | curpos |
current pos in VMat | |
Vec | output_value |
Mat | input_values |
Vec | bag_size_vec |
Vec | bag_target_and_bag_signal |
Vec | bag_target |
Vec | bag_signal |
Vec | bag_weight |
Array< Vec > | f_inputs |
Array< Vec > | unused_gradients |
Array< Vec > | output_av |
Array< Vec > | gradient_av |
int | bag_size |
Static Public Attributes | |
const int | TARGET_COLUMN_FIRST = 1 |
Tags to use in the vmat given to this variable. | |
const int | TARGET_COLUMN_LAST = 2 |
const int | TARGET_COLUMN_SINGLE = 3 |
const int | TARGET_COLUMN_INTERMEDIATE = 0 |
Protected Member Functions | |
void | build_ () |
Private Types | |
typedef NaryVariable | inherited |
|
Reimplemented from PLearn::NaryVariable. Definition at line 54 of file SumOverBagsVariable.h. Referenced by SumOverBagsVariable(). |
|
protected default constructor for persistence
Definition at line 77 of file SumOverBagsVariable.cc. References PLearn::transpose(). |
|
Sum_{bags vmat} f(inputs and targets in bag) By convention a bag is a sequence of rows of the vmat in which the last column of the target indicates whether the row is the first one (and/or) the last one, with its two least significant bits: last_column_of_target == 1 ==> first row last_column_of_target == 2 ==> last row last_column_of_target == 0 ==> intermediate row last_column_of_target == 1+2==3 ==> single-row bag (both first and last) the last column of the target is not given in the call to f, but a bag_size input is provided instead. The inputs to f are: (matrix of bag inputs, the bag size, the bag target, the bag weight). Definition at line 85 of file SumOverBagsVariable.cc. References build(), inherited, PLearn::nonInputParentsOfPath(), and PLearn::transpose(). |
|
Implements PLearn::Variable. Definition at line 346 of file SumOverBagsVariable.cc. References fbprop(). |
|
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::Variable. Definition at line 101 of file SumOverBagsVariable.cc. References build_(). Referenced by SumOverBagsVariable(). |
|
This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build() method, and possibly the public virtual read method (which calls its parent's read). build_() can assume that it's parent's build_ has already been called. Reimplemented from PLearn::Variable. Definition at line 110 of file SumOverBagsVariable.cc. References bag_signal, bag_size_vec, bag_target, bag_target_and_bag_signal, bag_weight, PLearn::TVec< Vec >::copy(), f, f_inputs, gradient_av, input_values, max_bag_size, output_av, output_value, PLERROR, PLearn::TVec< Vec >::resize(), PLearn::TVec< T >::resize(), PLearn::TMat< T >::resize(), PLearn::TVec< Vec >::size(), PLearn::TVec< T >::subVec(), PLearn::TMat< T >::toVec(), transpose, unused_gradients, vmat, and PLearn::ws(). 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::NaryVariable. Definition at line 152 of file SumOverBagsVariable.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
do both fprop and bprop
Reimplemented from PLearn::Variable. Definition at line 312 of file SumOverBagsVariable.cc. References average, PLearn::TVec< T >::clear(), curpos, f, fpropOneBag(), n_samples, and PLERROR. Referenced by bprop(). |
|
compute output given input
Implements PLearn::Variable. Definition at line 280 of file SumOverBagsVariable.cc. References average, PLearn::TVec< T >::clear(), curpos, f, fpropOneBag(), and n_samples. |
|
|
Reimplemented from PLearn::NaryVariable. Definition at line 198 of file SumOverBagsVariable.cc. References bag_signal, bag_size_vec, bag_target, bag_target_and_bag_signal, bag_weight, PLearn::deepCopyField(), f, f_inputs, gradient_av, input_values, output_av, output_value, unused_gradients, and vmat. |
|
|
|
Reimplemented from PLearn::NaryVariable. Definition at line 354 of file SumOverBagsVariable.cc. References PLearn::endl(), f, PLearn::Variable::getName(), PLearn::Object::info(), max_bag_size, and n_samples. |
|
Recomputes the length l and width w that this variable should have, according to its parent variables. This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate. Reimplemented from PLearn::Variable. Definition at line 185 of file SumOverBagsVariable.cc. References f. |
|
Definition at line 60 of file SumOverBagsVariable.h. |
|
Definition at line 72 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 78 of file SumOverBagsVariable.h. Referenced by fpropOneBag(). |
|
Definition at line 69 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 71 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 70 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 73 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
current pos in VMat
Definition at line 65 of file SumOverBagsVariable.h. Referenced by fbprop(), fprop(), and fpropOneBag(). |
|
Definition at line 59 of file SumOverBagsVariable.h. Referenced by build_(), fbprop(), fprop(), fpropOneBag(), makeDeepCopyFromShallowCopy(), printInfo(), and recomputeSize(). |
|
Definition at line 74 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 77 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 68 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 61 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and printInfo(). |
|
Definition at line 62 of file SumOverBagsVariable.h. Referenced by fbprop(), fprop(), and printInfo(). |
|
Definition at line 76 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 67 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Tags to use in the vmat given to this variable.
Definition at line 95 of file SumOverBagsVariable.h. |
|
Definition at line 98 of file SumOverBagsVariable.h. |
|
Definition at line 96 of file SumOverBagsVariable.h. |
|
Definition at line 97 of file SumOverBagsVariable.h. |
|
Definition at line 63 of file SumOverBagsVariable.h. Referenced by build_(), and fpropOneBag(). |
|
Definition at line 75 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 58 of file SumOverBagsVariable.h. Referenced by build_(), fpropOneBag(), and makeDeepCopyFromShallowCopy(). |