PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Types | Private Member Functions | Private Attributes
PLearn::LocalizedFeaturesLayerVariable Class Reference

Single layer of a neural network with local connectivity upon a set of localized features, i.e. More...

#include <LocalizedFeaturesLayerVariable.h>

Inheritance diagram for PLearn::LocalizedFeaturesLayerVariable:
Inheritance graph
[legend]
Collaboration diagram for PLearn::LocalizedFeaturesLayerVariable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LocalizedFeaturesLayerVariable ()
 Default constructor for persistence.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual
LocalizedFeaturesLayerVariable
deepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.
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 fprop ()
 compute output given input
virtual void bprop ()

Static Public Member Functions

static string _classname_ ()
 LocalizedFeaturesLayerVariable.
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Public Attributes

bool backprop_to_inputs
 OPTIONS.
VMat feature_locations
TVec< TVec< int > > feature_subsets
int n_hidden_per_subset
bool knn_subsets
int n_neighbors_per_subset
bool gridding_subsets
bool center_on_feature_locations
long seed
bool shared_weights
int n_box
real sigma

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Member Functions

virtual void computeSubsets ()

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Default constructor for persistence.

Private Types

typedef NaryVariable inherited

Private Member Functions

void build_ ()
 Object-specific post-constructor.

Private Attributes

int n_features
 INTERNAL LEARNED PARAMETERS.
int n_subsets
int n_weights
 Total number of weights in the layer.
Mat mu
 Local offsets when using shared weights with a local box.
TVec< Matlocal_weights
 The element k is a matrix whose element (i,j) is the weight of the i-th local pattern in the ponderation of the j-th neighbor of the k-th feature (when using shared weights with n_box > 0).

Detailed Description

Single layer of a neural network with local connectivity upon a set of localized features, i.e.

each feature is associated with a location in some low-dimensional space and each hidden unit takes input only from a subset of features that are in some local region in that space.

Definition at line 55 of file LocalizedFeaturesLayerVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::NaryVariable.

Definition at line 57 of file LocalizedFeaturesLayerVariable.h.


Constructor & Destructor Documentation

PLearn::LocalizedFeaturesLayerVariable::LocalizedFeaturesLayerVariable ( )

Default constructor for persistence.

Definition at line 78 of file LocalizedFeaturesLayerVariable.cc.


Member Function Documentation

string PLearn::LocalizedFeaturesLayerVariable::_classname_ ( ) [static]
OptionList & PLearn::LocalizedFeaturesLayerVariable::_getOptionList_ ( ) [static]

Reimplemented from PLearn::NaryVariable.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

RemoteMethodMap & PLearn::LocalizedFeaturesLayerVariable::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::NaryVariable.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

bool PLearn::LocalizedFeaturesLayerVariable::_isa_ ( const Object o) [static]

Reimplemented from PLearn::NaryVariable.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

Object * PLearn::LocalizedFeaturesLayerVariable::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

StaticInitializer LocalizedFeaturesLayerVariable::_static_initializer_ & PLearn::LocalizedFeaturesLayerVariable::_static_initialize_ ( ) [static]

Reimplemented from PLearn::NaryVariable.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

void PLearn::LocalizedFeaturesLayerVariable::bprop ( ) [virtual]

Implements PLearn::Variable.

Definition at line 382 of file LocalizedFeaturesLayerVariable.cc.

References backprop_to_inputs, feature_subsets, PLearn::Variable::gradientdata, i, j, PLearn::TMat< T >::length(), PLearn::TVec< T >::length(), local_weights, mu, n_box, n_hidden_per_subset, n_subsets, PLASSERT, shared_weights, PLearn::Variable::valuedata, PLearn::NaryVariable::varray, w, and x.

{
    real* x = varray[0]->valuedata;
    real* dx = varray[0]->gradientdata;
    real* y = valuedata;
    real* dy = gradientdata;
    real* w = varray[1]->valuedata;
    real* dw = varray[1]->gradientdata;
    real* db = varray[2]->gradientdata;
    for (int s=0;s<n_subsets;s++)
    {
        TVec<int> subset = feature_subsets[s];
        int subset_size = subset.length();
        Mat& local_weights_s = local_weights[s];
        for (int k=0;k<n_hidden_per_subset;k++,db++,y++,dy++)
        {
            real dact = *dy * (1 - *y * *y);
            *db += dact;
            if (shared_weights && n_box >= 0) {
                real* dw_ = dw;
                for (int j=0;j<subset_size;j++) {
                    dw_ = dw;
                    real x_val = x[subset[j]];
                    for (int i = 0; i < mu.length(); i++, dw_++) {
                        *dw_ += dact * x_val * local_weights_s(i, j);
                    }
                }
                dw = dw_;
            } else
                for (int j=0;j<subset_size;j++,dw++)
                    *dw += dact * x[subset[j]];
            if (backprop_to_inputs) {
                PLASSERT( !shared_weights || n_box < 0 ); // Case not handled.
                for (int j=0;j<subset_size;j++,w++)
                    dx[subset[j]] += dact * *w;
            }
        }
        if (shared_weights) {
            w  = varray[1]->valuedata;
            dw = varray[1]->gradientdata;
            db = varray[2]->gradientdata;
        }
    }
}

Here is the call graph for this function:

void PLearn::LocalizedFeaturesLayerVariable::build ( ) [virtual]

Post-constructor.

The normal implementation 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::NaryVariable.

Definition at line 94 of file LocalizedFeaturesLayerVariable.cc.

References PLearn::NaryVariable::build(), and build_().

Here is the call graph for this function:

void PLearn::LocalizedFeaturesLayerVariable::build_ ( ) [private]

Object-specific post-constructor.

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 its parent's build_() has already been called.

Reimplemented from PLearn::NaryVariable.

Definition at line 101 of file LocalizedFeaturesLayerVariable.cc.

References PLearn::Array< T >::clear(), computeSubsets(), feature_locations, PLearn::fill_random_uniform(), PLearn::ipow(), knn_subsets, PLearn::TVec< T >::length(), PLearn::manual_seed(), n_box, n_features, n_hidden_per_subset, n_neighbors_per_subset, n_subsets, n_weights, PLERROR, PLearn::Variable::resize(), PLearn::TVec< T >::resize(), seed, shared_weights, PLearn::TVec< T >::size(), PLearn::Variable::value, PLearn::Variable::Var, PLearn::NaryVariable::varray, and PLearn::VMat::width().

Referenced by build().

{
    if (varray.length() == 0)
        // Cannot do anything yet.
        return;
    computeSubsets();
    if (   varray.size() != 3
           || n_weights != varray[1]->value.size()
           || n_hidden_per_subset * (shared_weights ? 1 : n_subsets) != varray[2]->value.size()  )
    {
        varray.resize(3);
        varray[1] = Var(n_weights);
        varray[2] = Var(n_hidden_per_subset * (shared_weights ? 1 : n_subsets));
        // varray[0] = input
        // varray[1] = connection weights
        // varray[2] = biases
    }
    if (varray[0]) {
        if (n_features != varray[0]->value.size())
            PLERROR("In LocalizedFeaturesLayerVariable: input var 0 (features) should have size = %d = n_features, but is %d\n",
                    n_features, varray[0]->value.size());
        // Initialize parameters.
        real n_inputs_per_neuron = 0;
        if (knn_subsets) {
            if (shared_weights && n_box >= 0)
                n_inputs_per_neuron = ipow(n_box, feature_locations->width());
            else
                n_inputs_per_neuron = 1 + n_neighbors_per_subset;
        }
        else
            PLERROR("In LocalizedFeaturesLayerVariable::build_ - Not supported");
        real delta = 1/n_inputs_per_neuron;
        if (seed >= 0)
            manual_seed(seed);
        fill_random_uniform(varray[1]->value, -delta, delta);
        varray[2]->value.clear();
    }
    resize(1, n_hidden_per_subset * n_subsets);
}

Here is the call graph for this function:

Here is the caller graph for this function:

string PLearn::LocalizedFeaturesLayerVariable::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

void PLearn::LocalizedFeaturesLayerVariable::computeSubsets ( ) [protected, virtual]

Definition at line 141 of file LocalizedFeaturesLayerVariable.cc.

References a, b, PLearn::center(), PLearn::dist(), PLearn::GaussianKernel::evaluate(), feature_locations, feature_subsets, PLearn::BottomNI< T >::getBottomN(), i, PLearn::BottomNI< T >::init(), PLearn::ipow(), j, knn_subsets, PLearn::TMat< T >::length(), PLearn::TVec< T >::length(), local_weights, mu, n, n_box, n_features, n_hidden_per_subset, n_neighbors_per_subset, n_subsets, n_weights, PLearn::normalizeColumns(), PLASSERT, PLERROR, PLearn::pow(), PLearn::powdistance(), PLearn::TMat< T >::resize(), PLearn::TVec< T >::resize(), PLearn::Variable::row(), shared_weights, sigma, PLearn::TVec< T >::size(), PLearn::sqrt(), PLearn::BottomNI< T >::update(), PLearn::NaryVariable::varray, w, PLearn::VMat::width(), and PLearn::TMat< T >::width().

Referenced by build_().

{
    if (knn_subsets)
    {
        n_features = varray[0]->value.size();    // Get n_features from first var.
        n_subsets = n_features;
#ifdef UGLY_HACK
        n_subsets = UGLY_DIV * UGLY_DIV;
#endif
        n_weights = n_hidden_per_subset;
        int dim = feature_locations->width();
        if (!shared_weights)
            n_weights *= n_subsets * (1 + n_neighbors_per_subset);
        else {
            if (n_box == -1)
                // No spatial sharing.
                n_weights *= (1 + n_neighbors_per_subset);
            else
                n_weights *= ipow(n_box, dim);
        }
        feature_subsets.resize(n_subsets);
        BottomNI<real> lowest_distances;
        Vec center(feature_locations->width());
        Vec feature(feature_locations->width());
        Mat mu_copy;
        real sig = sigma;
        if (shared_weights && n_box >= 0) {
            PLASSERT( n_box >= 2 );
            int count_max = ipow(n_box, dim);
            mu.resize(count_max, dim);
            mu_copy.resize(mu.length(), mu.width());
            // Find bounding box of the features.
            TVec< pair<real,real> > bbox = feature_locations->getBoundingBox();
            PLASSERT( bbox.length() == dim );
            // Heuristic for approximate volume of the neighbors.
            real total_volume = 1.0;
            for (int i = 0; i < dim; i++)
                total_volume *= (bbox[i].second - bbox[i].first);
            real k_features_volume = total_volume / real(n_features)
                * (n_neighbors_per_subset + 1);
            real step = pow(k_features_volume, 1.0 / dim) / n_box;
            // Precompute the offsets for the pre-defined centers.
            for (int count = 0; count < count_max; count++) {
                int rest = count;
                for (int i = 0; i < dim; i++) {
                    int coord_i = rest % n_box;
                    rest /= n_box;
                    mu(count, i) = (coord_i - n_box / 2) * step;
                }
            }
            // Heuristic to compute sigma.
            if (sigma < 0) {
                sig = step;
            }
        }

        GaussianKernel K(sig);
        local_weights.resize(n_features);
        for (int s=0; s<n_subsets; s++)
        {
            feature_subsets[s].resize(n_neighbors_per_subset + 1);
            // Find k-nearest neighbors of features according to feature_locations
            lowest_distances.init(n_neighbors_per_subset);
            feature_locations->getRow(s, center);
#ifdef UGLY_HACK
            int w = int(sqrt(real(n_features)) + 1e-6);
            if (w % UGLY_DIV != 0)
                PLERROR("Ouch");
            int w_s = UGLY_DIV;
            int w_zone = w / UGLY_DIV;
            int x_s = s % w_s;
            int y_s = s / w_s;
            int x_f = x_s * w_zone + w_zone / 2;
            int y_f = y_s * w_zone + w_zone / 2;
            int index_f = y_f * w + x_f;
            feature_locations->getRow(index_f, center);
#endif
            for (int f=0;f<n_features;f++)
                if (f!=s)
                {
                    feature_locations->getRow(f, feature);
                    real dist = powdistance(center, feature);
                    lowest_distances.update(dist,f);
                }
            TVec< pair<real,int> > neighbors = lowest_distances.getBottomN();
            feature_subsets[s][0] = s;
            for (int k=0;k<n_neighbors_per_subset;k++)
                feature_subsets[s][k+1] = neighbors[k].second;
            if (shared_weights && n_box >= 0) {
                mu_copy << mu;
                mu_copy += center;
                int n_neighb = feature_subsets[s].length();
                local_weights[s].resize(mu.length(), n_neighb);
                for (int j = 0; j < feature_subsets[s].length(); j++) {
                    for (int i = 0; i < mu.length(); i++) {
                        feature_locations->getRow(feature_subsets[s][j], feature);
                        real k = K.evaluate(mu_copy(i), feature);
                        local_weights[s](i,j) = k;
                    }
                }
                normalizeColumns(local_weights[s]);
            }
#ifdef UGLY_HACK
            int a = int(sqrt(real(n_neighbors_per_subset + 1)) + 1e-6);
            if (fabs(a - sqrt(real(n_neighbors_per_subset + 1))) > 1e-8 || a % 2 != 1)
                PLERROR("Arg");
            w = int(sqrt(real(n_features)) + 1e-6);
            int b = (a - 1) / 2;
            int n_start = index_f - b - b * w;
            int count = 0;
            for (int row = 0; row < a; row++) {
                for (int col = 0; col < a; col++) {
                    int n = n_start + row * w + col;
                    if (n < 0)
                        n += n_features;
                    if (n >= n_features)
                        n -= n_features;
                    feature_subsets[s][count++] = n;
                }
            }
#endif
        }
    }
    else
        PLERROR("In LocalizedFeaturesLayerVariable: currently the only method for computing subsets is 'knn_subsets'.\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::LocalizedFeaturesLayerVariable::declareOptions ( OptionList ol) [static, protected]

Default constructor for persistence.

Reimplemented from PLearn::NaryVariable.

Definition at line 271 of file LocalizedFeaturesLayerVariable.cc.

References backprop_to_inputs, PLearn::OptionBase::buildoption, center_on_feature_locations, PLearn::declareOption(), PLearn::NaryVariable::declareOptions(), feature_locations, feature_subsets, gridding_subsets, knn_subsets, n_box, n_hidden_per_subset, n_neighbors_per_subset, seed, shared_weights, and sigma.

{
    declareOption(ol, "backprop_to_inputs", &LocalizedFeaturesLayerVariable::backprop_to_inputs, OptionBase::buildoption, 
                  "    If true then gradient is propagated to the inputs. When this object is the first layer\n"
                  "    of a neural network, it is more efficient to set this option to false (which is its default).\n");

    declareOption(ol, "feature_locations", &LocalizedFeaturesLayerVariable::feature_locations, 
                  OptionBase::buildoption, 
                  "    (n_features x n_dim) matrix assigning each feature to a location in n_dimensional space.\n"
                  "    If feature_subsets is directly provided, it is not necessary to provide this option, as\n"
                  "    the feature locations are only used to infer the feature_subsets.\n");

    declareOption(ol, "feature_subsets", &LocalizedFeaturesLayerVariable::feature_subsets, 
                  OptionBase::buildoption, 
                  "    Sequence of vector indices, one sequence per subset, containing indices of features\n"
                  "    associated with each subset. If not specified (empty sequence) it will be inferred\n"
                  "    using the feature_locations (which MUST be specified, in that case).\n");

    declareOption(ol, "n_hidden_per_subset", &LocalizedFeaturesLayerVariable::n_hidden_per_subset, 
                  OptionBase::buildoption, 
                  "    Number of hidden units per unique feature subset.\n");

    declareOption(ol, "shared_weights", &LocalizedFeaturesLayerVariable::shared_weights, OptionBase::buildoption, 
                  "If true, similar hidden neurons in different subsets will share the same weights.");

    declareOption(ol, "n_box", &LocalizedFeaturesLayerVariable::n_box, OptionBase::buildoption, 
                  "Only used when 'shared_weights' is true: the gridding factor of the box around each feature\n"
                  "where we put the reference centers. The number of centers will thus be n_box^d.\n"
                  "If set to -1, a more basic weights sharing method is used, with no spatial consistency.");

    declareOption(ol, "sigma", &LocalizedFeaturesLayerVariable::sigma, OptionBase::buildoption, 
                  "Width of the Gaussian kernel for the local interpolation when sharing weights.\n"
                  "If set to -1, will be heuristically selected.");

    declareOption(ol, "knn_subsets", &LocalizedFeaturesLayerVariable::knn_subsets, 
                  OptionBase::buildoption, 
                  "    Whether to infer feature_subsets using the k-nearest-neighbor algorithm or not.\n"
                  "    This option is only used when feature_subsets is not directly provided by the user.\n"
                  "    Each subset will have size 'n_neighbors_per_subset' and there will be one subset\n"
                  "    per feature, comprising that feature and its 'n_neighbors_per_subset' neighbors\n"
                  "    in terms of Euclidean distance in feature locations.\n");

    declareOption(ol, "n_neighbors_per_subset", &LocalizedFeaturesLayerVariable::n_neighbors_per_subset, 
                  OptionBase::buildoption, 
                  "   Number of feature neighbors to consider in each subset, if knn_subsets == true and\n"
                  "   feature_subsets is not specified directly by the user.\n");

    declareOption(ol, "gridding_subsets", &LocalizedFeaturesLayerVariable::gridding_subsets, 
                  OptionBase::buildoption, 
                  "    Whether to infer feature_subsets using a gridding algorithm.\n"
                  "    NOT IMPLEMENTED YET.\n");

    declareOption(ol, "center_on_feature_locations", &LocalizedFeaturesLayerVariable::center_on_feature_locations,
                  OptionBase::buildoption, 
                  "    If gridding_subsets == true, whether to center each subset window on feature locations\n"
                  "    or on regularly spaced centers in a volume.\n"
                  "    NOT IMPLEMENTED YET.\n");

    declareOption(ol, "seed", &LocalizedFeaturesLayerVariable::seed, OptionBase::buildoption,
                  "Positive seed to initialize the weights (will be ignored if set to -1).");

    inherited::declareOptions(ol);
}

Here is the call graph for this function:

static const PPath& PLearn::LocalizedFeaturesLayerVariable::declaringFile ( ) [inline, static]

Reimplemented from PLearn::NaryVariable.

Definition at line 93 of file LocalizedFeaturesLayerVariable.h.

:

LocalizedFeaturesLayerVariable * PLearn::LocalizedFeaturesLayerVariable::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::NaryVariable.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

void PLearn::LocalizedFeaturesLayerVariable::fprop ( ) [virtual]

compute output given input

Implements PLearn::Variable.

Definition at line 345 of file LocalizedFeaturesLayerVariable.cc.

References b, feature_subsets, i, j, PLearn::TMat< T >::length(), PLearn::TVec< T >::length(), local_weights, mu, n_box, n_hidden_per_subset, n_subsets, shared_weights, PLearn::tanh(), PLearn::Variable::valuedata, PLearn::NaryVariable::varray, w, and x.

{
    real* x = varray[0]->valuedata;
    real* y = valuedata;
    real* w = varray[1]->valuedata;
    real* b = varray[2]->valuedata;
    for (int s=0;s<n_subsets;s++)
    {
        TVec<int> subset = feature_subsets[s];
        int subset_size = subset.length();
        Mat& local_weights_s = local_weights[s];
        for (int k=0;k<n_hidden_per_subset;k++,b++,y++)
        {
            real act = *b;
            if (shared_weights && n_box >= 0) {
                real* w_ = w;
                for (int j=0;j<subset_size;j++) {
                    w_ = w;
                    real x_val = x[subset[j]];
                    for (int i = 0; i < mu.length(); i++, w_++) {
                        act += *w_ * x_val * local_weights_s(i, j);
                    }
                }
                w = w_;
            } else
                for (int j=0;j<subset_size;j++,w++)
                    act += *w * x[subset[j]];
            *y = tanh(act);
        }
        if (shared_weights) {
            b = varray[2]->valuedata;
            w = varray[1]->valuedata;
        }
    }
}

Here is the call graph for this function:

OptionList & PLearn::LocalizedFeaturesLayerVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

OptionMap & PLearn::LocalizedFeaturesLayerVariable::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

RemoteMethodMap & PLearn::LocalizedFeaturesLayerVariable::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 76 of file LocalizedFeaturesLayerVariable.cc.

void PLearn::LocalizedFeaturesLayerVariable::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.

This needs to be overridden by every class that adds "complex" data members to the class, such as Vec, Mat, PP<Something>, etc. Typical implementation:

  void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies)
  {
      inherited::makeDeepCopyFromShallowCopy(copies);
      deepCopyField(complex_data_member1, copies);
      deepCopyField(complex_data_member2, copies);
      ...
  }
Parameters:
copiesA map used by the deep-copy mechanism to keep track of already-copied objects.

Reimplemented from PLearn::NaryVariable.

Definition at line 430 of file LocalizedFeaturesLayerVariable.cc.

References PLearn::deepCopyField(), feature_locations, feature_subsets, and PLearn::NaryVariable::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:

void PLearn::LocalizedFeaturesLayerVariable::recomputeSize ( int l,
int w 
) const [virtual]

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 336 of file LocalizedFeaturesLayerVariable.cc.

References PLearn::TVec< T >::length(), n_hidden_per_subset, n_subsets, and PLearn::NaryVariable::varray.

{
    if (varray.length() >= 2 && varray[0] && varray[1]) {
        l = 1;
        w = n_hidden_per_subset * n_subsets;
    } else
        l = w = 0;
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::NaryVariable.

Definition at line 93 of file LocalizedFeaturesLayerVariable.h.

OPTIONS.

Definition at line 77 of file LocalizedFeaturesLayerVariable.h.

Referenced by bprop(), and declareOptions().

Definition at line 84 of file LocalizedFeaturesLayerVariable.h.

Referenced by declareOptions().

Definition at line 83 of file LocalizedFeaturesLayerVariable.h.

Referenced by declareOptions().

Definition at line 81 of file LocalizedFeaturesLayerVariable.h.

Referenced by build_(), computeSubsets(), and declareOptions().

The element k is a matrix whose element (i,j) is the weight of the i-th local pattern in the ponderation of the j-th neighbor of the k-th feature (when using shared weights with n_box > 0).

Definition at line 72 of file LocalizedFeaturesLayerVariable.h.

Referenced by bprop(), computeSubsets(), and fprop().

Local offsets when using shared weights with a local box.

Definition at line 67 of file LocalizedFeaturesLayerVariable.h.

Referenced by bprop(), computeSubsets(), and fprop().

Definition at line 87 of file LocalizedFeaturesLayerVariable.h.

Referenced by bprop(), build_(), computeSubsets(), declareOptions(), and fprop().

INTERNAL LEARNED PARAMETERS.

INTERNAL COMPUTATION

Definition at line 62 of file LocalizedFeaturesLayerVariable.h.

Referenced by build_(), and computeSubsets().

Definition at line 82 of file LocalizedFeaturesLayerVariable.h.

Referenced by build_(), computeSubsets(), and declareOptions().

Definition at line 63 of file LocalizedFeaturesLayerVariable.h.

Referenced by bprop(), build_(), computeSubsets(), fprop(), and recomputeSize().

Total number of weights in the layer.

Definition at line 64 of file LocalizedFeaturesLayerVariable.h.

Referenced by build_(), and computeSubsets().

Definition at line 85 of file LocalizedFeaturesLayerVariable.h.

Referenced by build_(), and declareOptions().

Definition at line 86 of file LocalizedFeaturesLayerVariable.h.

Referenced by bprop(), build_(), computeSubsets(), declareOptions(), and fprop().

Definition at line 88 of file LocalizedFeaturesLayerVariable.h.

Referenced by computeSubsets(), and declareOptions().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines