#include <EntropyContrast.h>
Inheritance diagram for PLearn::EntropyContrast:
Public Member Functions | |
EntropyContrast () | |
virtual void | build () |
simply calls inherited::build() then build_() | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
Transforms a shallow copy into a deep copy. | |
PLEARN_DECLARE_OBJECT (EntropyContrast) | |
virtual int | outputsize () const |
returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options) | |
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 void | train () |
The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process. | |
virtual void | computeOutput (const Vec &input, Vec &output) const |
Computes the output from the input. | |
void | reconstruct (const Vec &output, Vec &input) const |
Reconstructs an input from a (possibly partial) output (i.e. the first few princial components kept). | |
virtual void | computeCostsFromOutputs (const Vec &input, const Vec &output, const Vec &target, Vec &costs) const |
Computes the costs from already computed output. | |
virtual TVec< string > | getTestCostNames () const |
Returns [ "squared_reconstruction_error" ]. | |
virtual TVec< string > | getTrainCostNames () const |
No trian costs are computed for this learner. | |
Public Attributes | |
string | cost_real |
string | cost_gen |
string | cost_extra |
string | gen_method |
string | evaluation_method |
int | nconstraints |
int | inputsize |
The number of constraints. | |
real | learning_rate |
real | decay_factor |
the learning rate | |
real | weight_real |
the decay factor of the learning rate | |
real | weight_gen |
the decay factor of the learning rate | |
real | weight_extra |
the decay factor of the learning rate | |
real | weight_decay_output |
real | weight_decay_hidden |
int | n_seen_examples |
real | starting_learning_rate |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
Declares this class' options. | |
Private Types | |
typedef PLearner | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. | |
string | getInfo () |
void | initialize_NNcontinuous () |
Initialize all the data structures for the NNet. | |
void | update_NNcontinuous () |
update the parameters of the NNet from the regular cost | |
void | computeNNcontinuous_hidden (const Vec &input_units, Vec &hidden_units) |
compute the hidden units of the NNet given the input | |
void | computeNNcontinuous_constraints (Vec &hidden_units, Vec &output_units) |
Compute the output units given the hidden units. | |
void | get_NNcontinuous_output (const Vec &x, Vec &f_x, Vec &z_x) |
Compute the output units and also the hidden units given the input. | |
void | update_mu_sigma_f (const Vec &f_x, Vec &mu, Vec &sigma) |
Given the output of the NNet it updates the running averages(mu, variance). | |
void | update_alpha (int stage, int current_input_index) |
Update the weight of a sample(alpha). | |
void | compute_diversity_cost (const Vec &f_x, const Vec &cost, Vec &grad_C_extra_cost_wrt_f_x) |
Compute the cost and the gradiant for the diversity cost given by C_i = sum_j<i {cov((f_i)^2,(f_j)^2)}. | |
void | get_real_grad_variance_wrt_f (const Vec &f_x, Vec &grad) |
Compute d Var(f_x) / df_x. | |
void | get_gen_grad_variance_wrt_f (const Vec &f_x, Vec &grad) |
Compute d Var(f_x_hat) / df_x_hat. | |
void | set_NNcontinuous_gradient (Vec &grad_C_real_wrt_f_x, Mat &grad_H_f_x_wrt_w, Mat &grad_H_f_x_wrt_v, Vec &z_x, Vec &x, Vec &grad_H_f_x_wrt_bias_output, Vec &grad_H_f_x_wrt_bias_hidden) |
Compute all the gradiants wrt to the parameters of the neural network. | |
void | gen_normal_0_1 (Vec &output) |
Fill a vector with numbers from a gaussian having mu=0 , and sigma=1 This can be used for the generataion of the data. | |
void | set_NNcontinuous_gradient_from_extra_cost (Mat &grad_C_wrt_df_dx, const Vec &input) |
do the bprop step for NNet, compute all the gradiants | |
void | compute_df_dx (Mat &df_dx, const Vec &input) |
Compute df/dx, given x(input). | |
void | compute_extra_grad_wrt_df_dx (Mat &grad_C_wrt_df_dx) |
compute the grad extra_cost wrt df_dx | |
void | update_NNcontinuous_from_extra_cost () |
update the parameters of the NNet from the extra cost given by the derivative(angle) cost | |
Private Attributes | |
int | n |
int | evaluate_every_n_epochs |
bool | evaluate_first_epoch |
Mat | w |
Mat | v |
Vec | x |
Vec | f_x |
Vec | grad_C_real_wrt_f_x |
Vec | grad_C_extra_cost_wrt_f_x |
Vec | x_hat |
Vec | f_x_hat |
Vec | grad_C_generated_wrt_f_x_hat |
VMat | test_set |
VMat | validation_set |
real | alpha |
int | nhidden |
Vec | mu_f |
the number of hidden units, in the one existing hidden layer | |
Vec | sigma_f |
Vec | mu_f_hat |
Vec | sigma_f_hat |
Vec | mu_f_square |
Vec | sigma_f_square |
Mat | grad_H_f_x_wrt_w |
Mat | grad_H_f_x_hat_wrt_w |
Mat | grad_H_f_x_wrt_v |
Mat | grad_H_f_x_hat_wrt_v |
Vec | grad_H_f_x_wrt_bias_output |
Vec | grad_H_f_x_wrt_bias_hidden |
Vec | grad_H_f_x_hat_wrt_bias_output |
Vec | grad_H_f_x_hat_wrt_bias_hidden |
Mat | grad_H_g_wrt_w |
Vec | sigma_g |
Vec | mu_g |
Vec | g_x |
Vec | bias_hidden |
Vec | z_x |
Vec | z_x_hat |
Vec | bias_output |
Vec | full_sum |
real | full |
Mat | df_dx |
Mat | grad_C_wrt_df_dx |
Mat | grad_extra_wrt_w |
Mat | grad_extra_wrt_v |
Vec | grad_extra_wrt_bias_hidden |
Vec | grad_extra_wrt_bias_output |
|
Reimplemented from PLearn::PLearner. Definition at line 65 of file EntropyContrast.h. |
|
Definition at line 49 of file EntropyContrast.cc. References alpha, decay_factor, evaluate_every_n_epochs, evaluate_first_epoch, evaluation_method, learning_rate, n, nconstraints, nhidden, weight_extra, weight_gen, and weight_real. |
|
simply calls inherited::build() then build_()
Reimplemented from PLearn::PLearner. Definition at line 539 of file EntropyContrast.cc. References build_(). |
|
This does the actual building.
Reimplemented from PLearn::PLearner. Definition at line 459 of file EntropyContrast.cc. References bias_hidden, bias_output, df_dx, f_x, f_x_hat, full_sum, g_x, grad_C_extra_cost_wrt_f_x, grad_C_generated_wrt_f_x_hat, grad_C_real_wrt_f_x, grad_C_wrt_df_dx, grad_extra_wrt_v, grad_extra_wrt_w, grad_H_f_x_hat_wrt_bias_hidden, grad_H_f_x_hat_wrt_bias_output, grad_H_f_x_hat_wrt_v, grad_H_f_x_hat_wrt_w, grad_H_f_x_wrt_bias_hidden, grad_H_f_x_wrt_bias_output, grad_H_f_x_wrt_v, grad_H_f_x_wrt_w, grad_H_g_wrt_w, inputsize, PLearn::PP< VMatrix >::isNull(), learning_rate, PLearn::VMat::length(), mu_f, mu_f_hat, mu_f_square, mu_g, n, n_seen_examples, nconstraints, nhidden, PLearn::TMat< T >::resize(), PLearn::TVec< T >::resize(), sigma_f, sigma_f_hat, sigma_f_square, sigma_g, starting_learning_rate, v, w, PLearn::VMat::width(), x, x_hat, z_x, and z_x_hat. Referenced by build(). |
|
Compute df/dx, given x(input).
Definition at line 254 of file EntropyContrast.cc. References bias_hidden, PLearn::diag(), PLearn::diagonalizedFactorsProduct(), PLearn::TVec< T >::fill(), nhidden, PLearn::product(), PLearn::square(), PLearn::tanh(), v, and w. Referenced by train(). |
|
Compute the cost and the gradiant for the diversity cost given by C_i = sum_j<i {cov((f_i)^2,(f_j)^2)}.
Definition at line 229 of file EntropyContrast.cc. References PLearn::TVec< T >::fill(), full_sum, PLearn::VMat::length(), mu_f, nconstraints, PLearn::pow(), and sigma_f. Referenced by train(). |
|
compute the grad extra_cost wrt df_dx
Definition at line 375 of file EntropyContrast.cc. References df_dx, PLearn::dot(), k, n, and nconstraints. Referenced by train(). |
|
Computes the costs from already computed output. The only computed cost is the squared_reconstruction_error Implements PLearn::PLearner. Definition at line 786 of file EntropyContrast.cc. |
|
Compute the output units given the hidden units.
Definition at line 166 of file EntropyContrast.cc. References bias_output, nconstraints, nhidden, and w. Referenced by get_NNcontinuous_output(). |
|
compute the hidden units of the NNet given the input
Definition at line 149 of file EntropyContrast.cc. References bias_hidden, PLearn::compute_tanh(), n, nhidden, and v. Referenced by get_NNcontinuous_output(). |
|
Computes the output from the input.
Implements PLearn::PLearner. Definition at line 777 of file EntropyContrast.cc. |
|
Declares this class' options.
Reimplemented from PLearn::PLearner. Definition at line 69 of file EntropyContrast.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!)
Implements PLearn::PLearner. Definition at line 559 of file EntropyContrast.cc. References initialize_NNcontinuous(). Referenced by train(). |
|
Fill a vector with numbers from a gaussian having mu=0 , and sigma=1 This can be used for the generataion of the data.
Definition at line 193 of file EntropyContrast.cc. References PLearn::gaussian_01(), and PLearn::TVec< T >::length(). Referenced by train(). |
|
Compute d Var(f_x_hat) / df_x_hat.
Definition at line 280 of file EntropyContrast.cc. References PLearn::TVec< T >::length(), mu_f_hat, and sigma_f_hat. Referenced by train(). |
|
Compute the output units and also the hidden units given the input.
Definition at line 180 of file EntropyContrast.cc. References computeNNcontinuous_constraints(), and computeNNcontinuous_hidden(). Referenced by train(). |
|
Compute d Var(f_x) / df_x.
Definition at line 269 of file EntropyContrast.cc. References PLearn::TVec< T >::length(), mu_f, and sigma_f. Referenced by train(). |
|
Definition at line 181 of file EntropyContrast.h. References PLearn::split(). Referenced by train(). |
|
Returns [ "squared_reconstruction_error" ].
Implements PLearn::PLearner. Definition at line 791 of file EntropyContrast.cc. |
|
No trian costs are computed for this learner.
Implements PLearn::PLearner. Definition at line 796 of file EntropyContrast.cc. |
|
Initialize all the data structures for the NNet.
Definition at line 119 of file EntropyContrast.cc. References bias_hidden, bias_output, PLearn::TVec< T >::fill(), PLearn::fill_random_uniform(), full, mu_f, mu_f_hat, mu_f_square, mu_g, sigma_f, sigma_f_hat, sigma_f_square, sigma_g, v, and w. Referenced by forget(). |
|
Transforms a shallow copy into a deep copy.
Definition at line 546 of file EntropyContrast.cc. |
|
returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options)
Implements PLearn::PLearner. Definition at line 554 of file EntropyContrast.cc. References nconstraints. |
|
|
|
Reconstructs an input from a (possibly partial) output (i.e. the first few princial components kept).
Definition at line 782 of file EntropyContrast.cc. |
|
Compute all the gradiants wrt to the parameters of the neural network.
Definition at line 291 of file EntropyContrast.cc. References bias_hidden, k, n, nconstraints, nhidden, PLearn::sum(), PLearn::tanh(), v, and w. Referenced by train(). |
|
do the bprop step for NNet, compute all the gradiants
Definition at line 402 of file EntropyContrast.cc. References PLearn::addToDiagonal(), bias_hidden, PLearn::diag(), PLearn::TMat< T >::fill(), PLearn::TVec< T >::fill(), grad_extra_wrt_bias_hidden, grad_extra_wrt_v, grad_extra_wrt_w, n, nconstraints, nhidden, PLearn::product(), PLearn::productTranspose(), PLearn::square(), PLearn::tanh(), PLearn::transpose(), v, and w. Referenced by train(). |
|
|
Update the weight of a sample(alpha). It can range from 1/2, when the first sample is presented, to 1/inputsize if stage > 0 Definition at line 217 of file EntropyContrast.cc. References alpha, and inputsize. Referenced by train(). |
|
Given the output of the NNet it updates the running averages(mu, variance).
Definition at line 204 of file EntropyContrast.cc. References alpha, and PLearn::square(). Referenced by train(). |
|
update the parameters of the NNet from the regular cost
Definition at line 355 of file EntropyContrast.cc. References bias_hidden, bias_output, grad_H_f_x_hat_wrt_bias_hidden, grad_H_f_x_hat_wrt_bias_output, grad_H_f_x_hat_wrt_v, grad_H_f_x_hat_wrt_w, grad_H_f_x_wrt_bias_hidden, grad_H_f_x_wrt_bias_output, grad_H_f_x_wrt_v, grad_H_f_x_wrt_w, learning_rate, n, nconstraints, nhidden, v, w, weight_decay_hidden, and weight_decay_output. Referenced by train(). |
|
update the parameters of the NNet from the extra cost given by the derivative(angle) cost
Definition at line 331 of file EntropyContrast.cc. References bias_hidden, grad_extra_wrt_bias_hidden, grad_extra_wrt_v, grad_extra_wrt_w, learning_rate, n, nconstraints, nhidden, v, and w. Referenced by train(). |
|
Definition at line 89 of file EntropyContrast.h. Referenced by EntropyContrast(), train(), update_alpha(), and update_mu_sigma_f(). |
|
Definition at line 119 of file EntropyContrast.h. Referenced by build_(), compute_df_dx(), computeNNcontinuous_hidden(), initialize_NNcontinuous(), set_NNcontinuous_gradient(), set_NNcontinuous_gradient_from_extra_cost(), update_NNcontinuous(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 125 of file EntropyContrast.h. Referenced by build_(), computeNNcontinuous_constraints(), initialize_NNcontinuous(), and update_NNcontinuous(). |
|
Definition at line 149 of file EntropyContrast.h. Referenced by train(). |
|
Definition at line 148 of file EntropyContrast.h. Referenced by train(). |
|
Definition at line 147 of file EntropyContrast.h. Referenced by train(). |
|
the learning rate
Definition at line 158 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
Definition at line 132 of file EntropyContrast.h. Referenced by build_(), compute_extra_grad_wrt_df_dx(), and train(). |
|
Definition at line 67 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
Definition at line 68 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
Definition at line 151 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
Definition at line 75 of file EntropyContrast.h. |
|
Definition at line 81 of file EntropyContrast.h. |
|
Definition at line 129 of file EntropyContrast.h. Referenced by initialize_NNcontinuous(), and train(). |
|
Definition at line 127 of file EntropyContrast.h. Referenced by build_(), and compute_diversity_cost(). |
|
Definition at line 117 of file EntropyContrast.h. |
|
Definition at line 150 of file EntropyContrast.h. Referenced by train(). |
|
Definition at line 78 of file EntropyContrast.h. |
|
Definition at line 82 of file EntropyContrast.h. |
|
Definition at line 76 of file EntropyContrast.h. |
|
Definition at line 133 of file EntropyContrast.h. |
|
Definition at line 135 of file EntropyContrast.h. Referenced by set_NNcontinuous_gradient_from_extra_cost(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 135 of file EntropyContrast.h. |
|
Definition at line 134 of file EntropyContrast.h. Referenced by build_(), set_NNcontinuous_gradient_from_extra_cost(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 134 of file EntropyContrast.h. Referenced by build_(), set_NNcontinuous_gradient_from_extra_cost(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 111 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 110 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 105 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 103 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 108 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 107 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 104 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 102 of file EntropyContrast.h. Referenced by build_(), train(), and update_NNcontinuous(). |
|
Definition at line 113 of file EntropyContrast.h. Referenced by build_(). |
|
The number of constraints.
Definition at line 155 of file EntropyContrast.h. Referenced by build_(), and update_alpha(). |
|
Definition at line 157 of file EntropyContrast.h. Referenced by build_(), EntropyContrast(), train(), update_NNcontinuous(), and update_NNcontinuous_from_extra_cost(). |
|
the number of hidden units, in the one existing hidden layer
Definition at line 94 of file EntropyContrast.h. Referenced by build_(), compute_diversity_cost(), get_real_grad_variance_wrt_f(), initialize_NNcontinuous(), and train(). |
|
Definition at line 97 of file EntropyContrast.h. Referenced by build_(), get_gen_grad_variance_wrt_f(), initialize_NNcontinuous(), and train(). |
|
Definition at line 100 of file EntropyContrast.h. Referenced by build_(), initialize_NNcontinuous(), and train(). |
|
Definition at line 116 of file EntropyContrast.h. Referenced by build_(), and initialize_NNcontinuous(). |
|
Definition at line 66 of file EntropyContrast.h. Referenced by build_(), compute_extra_grad_wrt_df_dx(), computeNNcontinuous_hidden(), EntropyContrast(), set_NNcontinuous_gradient(), set_NNcontinuous_gradient_from_extra_cost(), update_NNcontinuous(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 162 of file EntropyContrast.h. |
|
|
Definition at line 92 of file EntropyContrast.h. Referenced by build_(), compute_df_dx(), computeNNcontinuous_constraints(), computeNNcontinuous_hidden(), EntropyContrast(), set_NNcontinuous_gradient(), set_NNcontinuous_gradient_from_extra_cost(), train(), update_NNcontinuous(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 95 of file EntropyContrast.h. Referenced by build_(), compute_diversity_cost(), get_real_grad_variance_wrt_f(), initialize_NNcontinuous(), and train(). |
|
Definition at line 98 of file EntropyContrast.h. Referenced by build_(), get_gen_grad_variance_wrt_f(), initialize_NNcontinuous(), and train(). |
|
Definition at line 101 of file EntropyContrast.h. Referenced by build_(), initialize_NNcontinuous(), and train(). |
|
Definition at line 115 of file EntropyContrast.h. Referenced by build_(), and initialize_NNcontinuous(). |
|
Definition at line 163 of file EntropyContrast.h. |
|
Definition at line 84 of file EntropyContrast.h. |
|
Definition at line 71 of file EntropyContrast.h. Referenced by build_(), compute_df_dx(), computeNNcontinuous_hidden(), initialize_NNcontinuous(), set_NNcontinuous_gradient(), set_NNcontinuous_gradient_from_extra_cost(), train(), update_NNcontinuous(), and update_NNcontinuous_from_extra_cost(). |
|
Reimplemented from PLearn::PLearner. Definition at line 85 of file EntropyContrast.h. |
|
Definition at line 70 of file EntropyContrast.h. Referenced by build_(), compute_df_dx(), computeNNcontinuous_constraints(), initialize_NNcontinuous(), set_NNcontinuous_gradient(), set_NNcontinuous_gradient_from_extra_cost(), train(), update_NNcontinuous(), and update_NNcontinuous_from_extra_cost(). |
|
Definition at line 161 of file EntropyContrast.h. Referenced by update_NNcontinuous(). |
|
Definition at line 160 of file EntropyContrast.h. Referenced by update_NNcontinuous(). |
|
the decay factor of the learning rate
Definition at line 159 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
the decay factor of the learning rate
Definition at line 159 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
the decay factor of the learning rate
Definition at line 159 of file EntropyContrast.h. Referenced by EntropyContrast(), and train(). |
|
Definition at line 74 of file EntropyContrast.h. |
|
Definition at line 80 of file EntropyContrast.h. |
|
Definition at line 120 of file EntropyContrast.h. |
|
Definition at line 122 of file EntropyContrast.h. |