#include <NeighborhoodSmoothnessNNet.h>
Inheritance diagram for PLearn::NeighborhoodSmoothnessNNet:
Public Types | |
typedef PLearner | inherited |
Public Member Functions | |
NeighborhoodSmoothnessNNet () | |
virtual | ~NeighborhoodSmoothnessNNet () |
PLEARN_DECLARE_OBJECT (NeighborhoodSmoothnessNNet) | |
virtual void | build () |
**** SUBCLASS WRITING: **** This method should be redefined in subclasses, to just call inherited::build() and then build_() | |
virtual void | forget () |
(Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) And sets 'stage' back to 0 (this is the stage of a fresh learner!) | |
virtual int | outputsize () const |
SUBCLASS WRITING: overload this so that it returns the size of this learner's output, as a function of its inputsize(), targetsize() and set options. | |
virtual TVec< string > | getTrainCostNames () const |
*** SUBCLASS WRITING: *** This should return the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats | |
virtual TVec< string > | getTestCostNames () const |
*** SUBCLASS WRITING: *** This should return the names of the costs computed by computeCostsFromOutpus | |
virtual void | train () |
The role of the train method is to bring the learner up to stage==nstages, updating the stats with training costs measured on-line in the process. | |
virtual void | setTrainingSet (VMat training_set, bool call_forget=true) |
Declares the train_set Then calls build() and forget() if necessary Note: You shouldn't have to overload this in subclasses, except in maybe to forward the call to an underlying learner. | |
virtual void | computeOutput (const Vec &input, Vec &output) const |
*** SUBCLASS WRITING: *** This should be defined in subclasses to compute the output from the input | |
virtual void | computeOutputAndCosts (const Vec &input, const Vec &target, Vec &output, Vec &costs) const |
Default calls computeOutput and computeCostsFromOutputs You may overload this if you have a more efficient way to compute both output and weighted costs at the same time. | |
virtual void | computeCostsFromOutputs (const Vec &input, const Vec &output, const Vec &target, Vec &costs) const |
*** SUBCLASS WRITING: *** This should be defined in subclasses to compute the weighted costs from already computed output. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Public Attributes | |
Func | f |
Func | f_input_to_hidden |
Func | test_costf |
Func | output_and_target_to_cost |
int | max_n_instances |
int | nhidden |
int | nhidden2 |
int | noutputs |
real | sigma_hidden |
real | sne_weight |
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 |
real | classification_regularizer |
bool | L1_penalty |
bool | direct_in_to_out |
string | output_transfer_func |
real | interval_minval |
real | interval_maxval |
Array< string > | cost_funcs |
a list of cost functions to use in the form "[ cf1; cf2; cf3; ... ]" | |
PP< Optimizer > | optimizer |
int | batch_size |
Protected Member Functions | |
void | initializeParams () |
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 | sampleweight |
Var | w1 |
Var | w2 |
Var | wout |
Var | wdirect |
Var | last_hidden |
Var | output |
Var | bag_size |
Var | bag_inputs |
Var | bag_output |
Var | bag_hidden |
int | test_bag_size |
Func | invars_to_training_cost |
VarArray | costs |
VarArray | penalties |
Var | training_cost |
Var | test_costs |
VarArray | invars |
VarArray | params |
Vec | paramsvalues |
Var | p_ij |
Private Member Functions | |
void | build_ () |
|
Reimplemented from PLearn::PLearner. Definition at line 93 of file NeighborhoodSmoothnessNNet.h. |
|
Definition at line 97 of file NeighborhoodSmoothnessNNet.cc. |
|
Definition at line 122 of file NeighborhoodSmoothnessNNet.cc. |
|
**** SUBCLASS WRITING: **** This method should be redefined in subclasses, to just call inherited::build() and then build_()
Reimplemented from PLearn::PLearner. Definition at line 227 of file NeighborhoodSmoothnessNNet.cc. References build_(). Referenced by setTrainingSet(), and train(). |
|
|
*** SUBCLASS WRITING: *** This should be defined in subclasses to compute the weighted costs from already computed output. The costs should correspond to the cost names returned by getTestCostNames() NOTE: In exotic cases, the cost may also depend on some info in the input, that's why the method also gets so see it. Implements PLearn::PLearner. Definition at line 691 of file NeighborhoodSmoothnessNNet.cc. References output_and_target_to_cost. |
|
*** SUBCLASS WRITING: *** This should be defined in subclasses to compute the output from the input
Implements PLearn::PLearner. Definition at line 673 of file NeighborhoodSmoothnessNNet.cc. References f. |
|
Default calls computeOutput and computeCostsFromOutputs You may overload this if you have a more efficient way to compute both output and weighted costs at the same time.
Reimplemented from PLearn::PLearner. Definition at line 682 of file NeighborhoodSmoothnessNNet.cc. References test_costf. |
|
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::PLearner. Definition at line 126 of file NeighborhoodSmoothnessNNet.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
(Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) And sets 'stage' back to 0 (this is the stage of a fresh learner!) *** SUBCLASS WRITING: *** A typical forget() method should do the following:
Implements PLearn::PLearner. Definition at line 751 of file NeighborhoodSmoothnessNNet.cc. References initializeParams(). Referenced by setTrainingSet(). |
|
*** SUBCLASS WRITING: *** This should return the names of the costs computed by computeCostsFromOutpus
Implements PLearn::PLearner. Definition at line 544 of file NeighborhoodSmoothnessNNet.cc. References cost_funcs. |
|
*** SUBCLASS WRITING: *** This should return the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats
Implements PLearn::PLearner. Definition at line 536 of file NeighborhoodSmoothnessNNet.cc. References cost_funcs. |
|
Definition at line 700 of file NeighborhoodSmoothnessNNet.cc. References direct_in_to_out, PLearn::fill_random_normal(), PLearn::PLearner::inputsize(), PLearn::manual_seed(), nhidden, nhidden2, optimizer, 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::PLearner. Definition at line 760 of file NeighborhoodSmoothnessNNet.cc. References bag_hidden, bag_inputs, bag_output, bag_size, PLearn::CopiesMap, cost_funcs, costs, PLearn::deepCopyField(), f, f_input_to_hidden, input, invars, invars_to_training_cost, last_hidden, optimizer, output, output_and_target_to_cost, p_ij, params, paramsvalues, penalties, sampleweight, target, test_costf, test_costs, training_cost, w1, w2, wdirect, and wout. |
|
SUBCLASS WRITING: overload this so that it returns the size of this learner's output, as a function of its inputsize(), targetsize() and set options.
Implements PLearn::PLearner. Definition at line 530 of file NeighborhoodSmoothnessNNet.cc. References noutputs. Referenced by build_(). |
|
|
|
Declares the train_set Then calls build() and forget() if necessary Note: You shouldn't have to overload this in subclasses, except in maybe to forward the call to an underlying learner.
Reimplemented from PLearn::PLearner. Definition at line 549 of file NeighborhoodSmoothnessNNet.cc. References build(), forget(), PLearn::VMat::length(), PLERROR, and PLearn::VMat::width(). |
|
The role of the train method is to bring the learner up to stage==nstages, updating the stats with training costs measured on-line in the process. *** SUBCLASS WRITING: *** TYPICAL CODE: static Vec input; // static so we don't reallocate/deallocate memory each time... static Vec target; // (but be careful that static means shared!) input.resize(inputsize()); // the train_set's inputsize() target.resize(targetsize()); // the train_set's targetsize() real weight; if(!train_stats) // make a default stats collector, in case there's none train_stats = new VecStatsCollector(); if(nstages<stage) // asking to revert to a previous stage! forget(); // reset the learner to stage=0 while(stage<nstages) { clear statistics of previous epoch train_stats->forget(); ... train for 1 stage, and update train_stats, using train_set->getSample(input, target, weight); and train_stats->update(train_costs) ++stage; train_stats->finalize(); // finalize statistics for this epoch } Implements PLearn::PLearner. Definition at line 579 of file NeighborhoodSmoothnessNNet.cc. References batch_size, build(), PLearn::endl(), f, invars_to_training_cost, PLearn::PP< Function >::isNull(), PLearn::VMat::length(), max_n_instances, optimizer, output_and_target_to_cost, params, PLERROR, PLearn::sumOverBags(), test_costf, PLearn::tostring(), PLearn::ProgressBar::update(), and PLearn::VMat::width(). |
|
Definition at line 70 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 68 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 69 of file NeighborhoodSmoothnessNNet.h. Referenced by makeDeepCopyFromShallowCopy(). |
|
Definition at line 67 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 132 of file NeighborhoodSmoothnessNNet.h. Referenced by train(). |
|
Definition at line 109 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 117 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
a list of cost functions to use in the form "[ cf1; cf2; cf3; ... ]"
Definition at line 127 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), getTestCostNames(), getTrainCostNames(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 74 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 120 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 116 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 86 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), computeOutput(), makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 87 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 58 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 122 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 122 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 78 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 72 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 119 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 65 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 111 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 110 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 113 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 112 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 99 of file NeighborhoodSmoothnessNNet.h. |
|
Definition at line 101 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 102 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and initializeParams(). |
|
Definition at line 103 of file NeighborhoodSmoothnessNNet.h. Referenced by outputsize(). |
|
Definition at line 130 of file NeighborhoodSmoothnessNNet.h. Referenced by initializeParams(), makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 66 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 89 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), computeCostsFromOutputs(), makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 115 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 114 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 121 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 82 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 79 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 80 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 75 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 60 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 105 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 106 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 59 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 71 of file NeighborhoodSmoothnessNNet.h. |
|
Definition at line 88 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), computeOutputAndCosts(), makeDeepCopyFromShallowCopy(), and train(). |
|
Definition at line 77 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 76 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 61 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), initializeParams(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 62 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), initializeParams(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 64 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), initializeParams(), and makeDeepCopyFromShallowCopy(). |
|
Definition at line 108 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(). |
|
Definition at line 63 of file NeighborhoodSmoothnessNNet.h. Referenced by build_(), initializeParams(), and makeDeepCopyFromShallowCopy(). |