#include <NeuralNet.h>
Inheritance diagram for PLearn::NeuralNet:
Public Types | |
typedef Learner | inherited |
Public Member Functions | |
NeuralNet () | |
virtual | ~NeuralNet () |
PLEARN_DECLARE_OBJECT (NeuralNet) | |
virtual void | build () |
**** SUBCLASS WRITING: **** This method should be redefined in subclasses, to just call inherited::build() and then build_() | |
virtual void | forget () |
void | initializeParams () |
virtual void | train (VMat training_set) |
virtual void | use (const Vec &inputvec, Vec &prediction) |
virtual int | costsize () const |
**** SUBCLASS WRITING: should be re-defined if user re-defines computeCost default version returns | |
virtual Array< string > | costNames () const |
virtual Array< string > | testResultsNames () |
virtual void | useAndCost (const Vec &inputvec, const Vec &targetvec, Vec outputvec, Vec costvec) |
By default this function calls use(input, output) and then computeCost(input, target, output, cost) So you can overload computeCost to change cost computation. | |
void | computeCost (const Vec &inputvec, const Vec &targetvec, const Vec &outputvec, const Vec &costvec) |
computes the cost vec, given input, target and output The default version applies the declared CostFunc's on the (output,target) pair, putting the cost computed for each CostFunc in an element of the cost vector. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Public Attributes | |
Func | f |
Func | costf |
Func | output_and_target_to_cost |
int | nhidden |
int | nhidden2 |
real | weight_decay |
real | bias_decay |
real | layer1_weight_decay |
real | layer1_bias_decay |
real | layer2_weight_decay |
real | layer2_bias_decay |
real | output_layer_weight_decay |
real | output_layer_bias_decay |
real | direct_in_to_out_weight_decay |
bool | global_weight_decay |
bool | direct_in_to_out |
string | output_transfer_func |
int | iseed |
Array< string > | cost_funcs |
a list of cost functions to use in the form "[ cf1; cf2; cf3; ... ]" | |
real | semisupervised_flatten_factor |
Vec | semisupervised_prior |
PP< Optimizer > | optimizer |
int | batch_size |
int | nepochs |
string | saveparams |
Array< Vec > | normalization |
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 | |
Var | input |
Var | target |
Var | costweights |
Var | target_and_weights |
Var | w1 |
Var | w2 |
Var | wout |
Var | wdirect |
Var | output |
VarArray | costs |
Var | cost |
VarArray | params |
Vec | paramsvalues |
Vec | initial_paramsvalues |
Private Member Functions | |
void | build_ () |
|
Reimplemented from PLearn::Learner. Definition at line 81 of file NeuralNet.h. |
|
Definition at line 84 of file NeuralNet.cc. |
|
Definition at line 105 of file NeuralNet.cc. |
|
**** SUBCLASS WRITING: **** This method should be redefined in subclasses, to just call inherited::build() and then build_()
Reimplemented from PLearn::Learner. Definition at line 200 of file NeuralNet.cc. References build_(). |
|
|
computes the cost vec, given input, target and output The default version applies the declared CostFunc's on the (output,target) pair, putting the cost computed for each CostFunc in an element of the cost vector. If you overload this method in subclasses (e.g. to compute a cost that depends on the internal elements of the model), you must also redefine costsize() and costNames() accordingly. Reimplemented from PLearn::Learner. Definition at line 494 of file NeuralNet.cc. References output_and_target_to_cost. |
|
returns an Array of strings for the names of the components of the cost. Default version returns the info() strings of the cost functions in test_costfuncs Reimplemented from PLearn::Learner. Definition at line 410 of file NeuralNet.cc. References cost_funcs. Referenced by testResultsNames(). |
|
**** SUBCLASS WRITING: should be re-defined if user re-defines computeCost default version returns
Reimplemented from PLearn::Learner. Definition at line 415 of file NeuralNet.cc. References cost. |
|
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::Learner. Definition at line 109 of file NeuralNet.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
*** SUBCLASS WRITING: *** This method should be called AFTER or inside the build method, e.g. in order to re-initialize parameters. It should put the Learner in a 'fresh' state, not being influenced by any past call to train (everything learned is forgotten!). Reimplemented from PLearn::Learner. Definition at line 499 of file NeuralNet.cc. References initial_paramsvalues, initializeParams(), and params. |
|
Definition at line 441 of file NeuralNet.cc. References direct_in_to_out, PLearn::fill_random_normal(), PLearn::Learner::inputsize(), iseed, PLearn::manual_seed(), nhidden, nhidden2, PLearn::seed(), w1, w2, wdirect, and wout. |
|
Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be. Typical implementation: void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies) { SUPERCLASS_OF_THIS::makeDeepCopyFromShallowCopy(copies); member_ptr = member_ptr->deepCopy(copies); member_smartptr = member_smartptr->deepCopy(copies); member_mat.makeDeepCopyFromShallowCopy(copies); member_vec.makeDeepCopyFromShallowCopy(copies); ... } Reimplemented from PLearn::Learner. Definition at line 508 of file NeuralNet.cc. References PLearn::CopiesMap, PLearn::deepCopyField(), and optimizer. |
|
|
|
Definition at line 144 of file NeuralNet.h. References costNames(). |
|
*** SUBCLASS WRITING: *** Does the actual training. Subclasses must implement this method. The method should upon entry, call setTrainingSet(training_set); Make sure that a if(measure(step, objective_value)) is done after each training step, and that training is stopped if it returned true Implements PLearn::Learner. Definition at line 418 of file NeuralNet.cc. References batch_size, cost, costf, input, PLearn::VMat::length(), PLearn::meanOf(), nepochs, optimizer, output_and_target_to_cost, params, paramsvalues, PLearn::save(), saveparams, and target_and_weights. |
|
*** SUBCLASS WRITING: *** Uses a trained decider on input, filling output. If the cost should also be computed, then the user should call useAndCost instead of this method. Implements PLearn::Learner. Definition at line 484 of file NeuralNet.cc. References f. |
|
By default this function calls use(input, output) and then computeCost(input, target, output, cost) So you can overload computeCost to change cost computation.
Reimplemented from PLearn::Learner. Definition at line 489 of file NeuralNet.cc. References costf. |
|
Definition at line 116 of file NeuralNet.h. Referenced by train(). |
|
Definition at line 91 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 67 of file NeuralNet.h. Referenced by build_(), costsize(), and train(). |
|
a list of cost functions to use in the form "[ cf1; cf2; cf3; ... ]"
Definition at line 109 of file NeuralNet.h. Referenced by build_(), and costNames(). |
|
Definition at line 76 of file NeuralNet.h. Referenced by build_(), train(), and useAndCost(). |
|
Definition at line 66 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 58 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 101 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 98 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 75 of file NeuralNet.h. |
|
Definition at line 100 of file NeuralNet.h. |
|
Definition at line 72 of file NeuralNet.h. |
|
Definition at line 56 of file NeuralNet.h. |
|
Definition at line 103 of file NeuralNet.h. Referenced by initializeParams(). |
|
Definition at line 93 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 92 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 95 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 94 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 119 of file NeuralNet.h. Referenced by train(). |
|
Definition at line 87 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 88 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 123 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 114 of file NeuralNet.h. Referenced by makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 65 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 77 of file NeuralNet.h. Referenced by build_(), computeCost(), and train(). |
|
Definition at line 97 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 96 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 102 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 69 of file NeuralNet.h. |
|
Definition at line 71 of file NeuralNet.h. |
|
Definition at line 121 of file NeuralNet.h. Referenced by train(). |
|
Definition at line 110 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 111 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 57 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 59 of file NeuralNet.h. |
|
Definition at line 60 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 61 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 63 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 90 of file NeuralNet.h. Referenced by build_(). |
|
Definition at line 62 of file NeuralNet.h. Referenced by build_(), and initializeParams(). |