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

Manifold Parzen Windows classifier and distribution. More...

#include <ManifoldParzen.h>

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

List of all members.

Public Member Functions

 ManifoldParzen ()
 Default constructor.
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.
virtual void computeCostsFromOutputs (const Vec &input, const Vec &output, const Vec &target, Vec &costs) const
 Computes the costs from already computed output.
virtual TVec< std::string > getTestCostNames () const
 Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).
virtual TVec< std::string > getTrainCostNames () const
 Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats.
virtual void setTrainingSet (VMat training_set, bool call_forget=true)
 Declares the training set.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual ManifoldParzendeepCopy (CopiesMap &copies) const
virtual void build ()
 Finish building the object; just call inherited::build followed by build_()
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.

Static Public Member Functions

static string _classname_ ()
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

int nneighbors
 Number of nearest neighbors to use to learn the manifold structure.
int ncomponents
 Dimensionality of the manifold.
real global_lambda0
 Additive minimum value for the variance in all directions.
bool learn_mu
 Indication that the meam of the gaussians should also be learned.
int nclasses
 Number of classes.

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.

Protected Attributes

Vec mu
 Variables for density of a Gaussian.
Mat Ut
 Variables for the SVD and gradient computation.
Mat U
Mat V
Vec diff_neighbor_input
Vec uk
Vec sm_svd
Vec S
Vec diff
TVec< Mateigenvectors
 Eigenvectors.
Mat eigenvalues
 Eigenvalues.
Vec sigma_noises
 Sigma noises.
Mat mus
 Mus.
TVec< PP< ClassSubsetVMatrix > > class_datasets
 Datasets for each class.
TMat< intnearest_neighbors_indices
 Proportions of examples from the other classes (columns), for each class (rows)
Vec test_votes
 Nearest neighbor votes for test example.

Private Types

typedef PLearner inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Manifold Parzen Windows classifier and distribution.

Definition at line 51 of file ManifoldParzen.h.


Member Typedef Documentation

Reimplemented from PLearn::PLearner.

Definition at line 53 of file ManifoldParzen.h.


Constructor & Destructor Documentation

PLearn::ManifoldParzen::ManifoldParzen ( )

Default constructor.

Definition at line 57 of file ManifoldParzen.cc.

                               :
    nneighbors( 1 ),
    ncomponents( 1 ),
    global_lambda0( 0 ),
    learn_mu( false ),
    nclasses( -1 )
{
}

Member Function Documentation

string PLearn::ManifoldParzen::_classname_ ( ) [static]

Reimplemented from PLearn::PLearner.

Definition at line 55 of file ManifoldParzen.cc.

OptionList & PLearn::ManifoldParzen::_getOptionList_ ( ) [static]

Reimplemented from PLearn::PLearner.

Definition at line 55 of file ManifoldParzen.cc.

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

Reimplemented from PLearn::PLearner.

Definition at line 55 of file ManifoldParzen.cc.

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

Reimplemented from PLearn::PLearner.

Definition at line 55 of file ManifoldParzen.cc.

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

Reimplemented from PLearn::Object.

Definition at line 55 of file ManifoldParzen.cc.

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

Reimplemented from PLearn::PLearner.

Definition at line 55 of file ManifoldParzen.cc.

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

Finish building the object; just call inherited::build followed by build_()

Reimplemented from PLearn::PLearner.

Definition at line 170 of file ManifoldParzen.cc.

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

Here is the call graph for this function:

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

This does the actual building.

Reimplemented from PLearn::PLearner.

Definition at line 124 of file ManifoldParzen.cc.

References PLearn::endl(), global_lambda0, PLearn::PLearner::inputsize_, nclasses, nneighbors, PLERROR, PLearn::TVec< T >::resize(), setTrainingSet(), test_votes, PLearn::PLearner::train_set, and PLearn::PLearner::weightsize_.

Referenced by build().

{
    // ### This method should do the real building of the object,
    // ### according to set 'options', in *any* situation.
    // ### Typical situations include:
    // ###  - Initial building of an object from a few user-specified options
    // ###  - Building of a "reloaded" object: i.e. from the complete set of
    // ###    all serialised options.
    // ###  - Updating or "re-building" of an object after a few "tuning"
    // ###    options have been modified.
    // ### You should assume that the parent class' build_() has already been
    // ### called.

    MODULE_LOG << "build_() called" << endl;

    if(inputsize_ > 0 )
    {
        // Builds some variables using the training set
        setTrainingSet(train_set, false);
        
        if( nclasses <= 0 )
            PLERROR("ManifoldParzen::build_() - \n"
                    "nclasses should be > 0.\n");
        test_votes.resize(nclasses);

        if( nneighbors <= 0 )
            PLERROR("ManifoldParzen::build_() - \n"
                    "nneighbors should be > 0.\n");

        if( weightsize_ > 0 )
            PLERROR("ManifoldParzen::build_() - \n"
                    "usage of weighted samples (weight size > 0) is not\n"
                    "implemented yet.\n");

        if( ncomponents < 1 || ncomponents > inputsize_)
            PLERROR("ManifoldParzen::build_() - \n"
                    "ncomponents should be > 0 and < or = to inputsize.\n");

        if( global_lambda0 < 0)
            PLERROR("ManifoldParzen::build_() - \n"
                    "global_lambda0 should be > or = to 0.\n");

    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 55 of file ManifoldParzen.cc.

void PLearn::ManifoldParzen::computeCostsFromOutputs ( const Vec input,
const Vec output,
const Vec target,
Vec costs 
) const [virtual]

Computes the costs from already computed output.

Implements PLearn::PLearner.

Definition at line 429 of file ManifoldParzen.cc.

References class_datasets, PLearn::TVec< T >::fill(), getTestCostNames(), MISSING_VALUE, nclasses, pl_log, PLearn::TVec< T >::resize(), and test_votes.

{

    //Assumes that computeOutput has been called

    costs.resize( getTestCostNames().length() );
    costs.fill( MISSING_VALUE );

    if( nclasses > 1 )
    {
        int target_class = ((int)round(target[0]));
        if( ((int)round(output[0])) == target_class )
            costs[0] = 0;
        else
            costs[0] = 1;
        costs[1] = - test_votes[target_class]
            +pl_log(class_datasets[target_class]->length()); // Must take into account the 1/n normalization
    }
    else
    {
        costs[1] = - output[0]; // 1/n normalization already accounted for
    }
}

Here is the call graph for this function:

void PLearn::ManifoldParzen::computeOutput ( const Vec input,
Vec output 
) const [virtual]

Computes the output from the input.

Reimplemented from PLearn::PLearner.

Definition at line 349 of file ManifoldParzen.cc.

References PLearn::argmax(), class_datasets, PLearn::TVec< T >::clear(), diff, diff_neighbor_input, PLearn::dot(), eigenvalues, eigenvectors, PLearn::VMat::getExample(), global_lambda0, i, PLearn::PLearner::inputsize(), j, PLearn::VMat::length(), PLearn::TVec< T >::length(), Log2Pi, PLearn::logadd(), mu, mus, n, nclasses, ncomponents, pl_log, PLearn::pownorm(), PLearn::TMat< T >::resize(), PLearn::TVec< T >::resize(), sigma_noises, sm_svd, PLearn::substract(), PLearn::PLearner::targetsize(), test_votes, PLearn::PLearner::train_set, U, and uk.

{

    test_votes.resize(nclasses);
    test_votes.clear();

    // Variables for probability computations
    real log_p_x_g_y = 0;
    real mahal = 0;
    real norm_term = 0;
    real n = inputsize();
    real dotp = 0;
    real coef = 0;
    real sigma_noise = 0;
    
    Vec input_j(inputsize());
    Vec target(targetsize());
    real weight;

    U.resize( ncomponents, inputsize() );
    sm_svd.resize( ncomponents );
    mu.resize( inputsize() );


    int input_j_index;
    for( int i=0; i<nclasses; i++ )
    {
        for( int j=0; 
             j<(nclasses > 1 ? 
                class_datasets[i]->length() 
                : train_set->length()); 
             j++ )
        {
            if( nclasses > 1 )
            {
                class_datasets[i]->getExample(j,input_j,target,weight);
                input_j_index = class_datasets[i]->indices[j];
            }
            else
            {
                train_set->getExample(j,input_j,target,weight);
                input_j_index = j;
            }
            
            U << eigenvectors[input_j_index];
            sm_svd << eigenvalues(input_j_index);
            sigma_noise = sigma_noises[input_j_index] + global_lambda0;
            mu << mus(input_j_index);
            
            substract(input,input_j,diff_neighbor_input); 
            substract(diff_neighbor_input,mu,diff); 
            
            mahal = -0.5*pownorm(diff)/sigma_noise;      
            norm_term = - n/2.0 * Log2Pi - 0.5*(n-ncomponents)*
                pl_log(sigma_noise);
            
            for(int k=0; k<ncomponents; k++)
            { 
                uk = U(k);
                dotp = dot(diff,uk);
                coef = (1.0/(sm_svd[k]+global_lambda0) - 1.0/sigma_noise);
                mahal -= dotp*dotp*0.5*coef;
                norm_term -= 0.5*pl_log(sm_svd[k]+global_lambda0);
            }
            
            if( j==0 )
                log_p_x_g_y = norm_term + mahal;
            else
                log_p_x_g_y = logadd(norm_term + mahal, log_p_x_g_y);
        }
        
        test_votes[i] = log_p_x_g_y;
    }

    if( nclasses > 1 )
        output[0] = argmax(test_votes);
    else
        output[0] = test_votes[0]-pl_log(train_set->length());
}

Here is the call graph for this function:

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

Declares the class options.

Reimplemented from PLearn::PLearner.

Definition at line 66 of file ManifoldParzen.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::PLearner::declareOptions(), eigenvalues, global_lambda0, learn_mu, PLearn::OptionBase::learntoption, mus, nclasses, ncomponents, nneighbors, sigma_noises, and PLearn::PLearner::train_set.

{
    declareOption(ol, "nneighbors", 
                  &ManifoldParzen::nneighbors,
                  OptionBase::buildoption,
                  "Number of nearest neighbors to use to learn "
                  "the manifold structure..\n");

    declareOption(ol, "ncomponents", 
                  &ManifoldParzen::ncomponents,
                  OptionBase::buildoption,
                  "Dimensionality of the manifold.\n");

    declareOption(ol, "global_lambda0", 
                  &ManifoldParzen::global_lambda0,
                  OptionBase::buildoption,
                  "Additive minimum value for the variance in all directions.\n");

    declareOption(ol, "learn_mu", 
                  &ManifoldParzen::learn_mu,
                  OptionBase::buildoption,
                  "Additive minimum value for the variance in all directions.\n");

    declareOption(ol, "nclasses", 
                  &ManifoldParzen::nclasses,
                  OptionBase::buildoption,
                  "Number of classes. If nclasses = 1, learner will output\n"
                  "log likelihood of a given input. If nclasses > 1,\n"
                  "classification will be performed.\n");

    declareOption(ol, "train_set", 
                  &ManifoldParzen::train_set,
                  OptionBase::learntoption,
                  "Training set.\n"
        );

    declareOption(ol, "eigenvalues", 
                  &ManifoldParzen::eigenvalues,
                  OptionBase::learntoption,
                  ""
        );

    declareOption(ol, "sigma_noises", 
                  &ManifoldParzen::sigma_noises,
                  OptionBase::learntoption,
                  ""
        );

    declareOption(ol, "mus", 
                  &ManifoldParzen::mus,
                  OptionBase::learntoption,
                  ""
        );

    // Now call the parent class' declareOptions
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::PLearner.

Definition at line 125 of file ManifoldParzen.h.

:
    //#####  Not Options  #####################################################
ManifoldParzen * PLearn::ManifoldParzen::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::PLearner.

Definition at line 55 of file ManifoldParzen.cc.

void PLearn::ManifoldParzen::forget ( ) [virtual]

(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!).

(Re-)initialize 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!)

A typical forget() method should do the following:

  • call inherited::forget() to initialize its random number generator with the 'seed' option
  • initialize the learner's parameters, using this random generator
  • stage = 0

Reimplemented from PLearn::PLearner.

Definition at line 207 of file ManifoldParzen.cc.

References PLearn::TVec< T >::clear(), PLearn::TMat< T >::clear(), PLearn::clear(), eigenvalues, eigenvectors, PLearn::PLearner::forget(), i, PLearn::TVec< T >::length(), mus, sigma_noises, and PLearn::PLearner::stage.

{

    inherited::forget();

    for(int i=0; i < eigenvectors.length(); i++)
        eigenvectors[i].clear();
    eigenvalues.clear();
    sigma_noises.clear();
    mus.clear();
    stage = 0;
}

Here is the call graph for this function:

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

Reimplemented from PLearn::Object.

Definition at line 55 of file ManifoldParzen.cc.

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

Reimplemented from PLearn::Object.

Definition at line 55 of file ManifoldParzen.cc.

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

Reimplemented from PLearn::Object.

Definition at line 55 of file ManifoldParzen.cc.

TVec< string > PLearn::ManifoldParzen::getTestCostNames ( ) const [virtual]

Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).

Implements PLearn::PLearner.

Definition at line 454 of file ManifoldParzen.cc.

References PLearn::TVec< T >::append().

Referenced by computeCostsFromOutputs().

{
    // Return the names of the costs computed by computeCostsFromOutputs
    // (these may or may not be exactly the same as what's returned by
    // getTrainCostNames).

    TVec<string> cost_names(0);

    cost_names.append( "class_error" );
    cost_names.append( "NLL" );

    return cost_names;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TVec< string > PLearn::ManifoldParzen::getTrainCostNames ( ) const [virtual]

Returns 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 468 of file ManifoldParzen.cc.

Referenced by train().

{
    TVec<string> cost_names(0);
    return cost_names ;    
}

Here is the caller graph for this function:

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::PLearner.

Definition at line 177 of file ManifoldParzen.cc.

References class_datasets, PLearn::deepCopyField(), diff, diff_neighbor_input, eigenvalues, eigenvectors, PLearn::PLearner::makeDeepCopyFromShallowCopy(), mu, mus, nearest_neighbors_indices, S, sigma_noises, sm_svd, test_votes, U, uk, Ut, and V.

{
    inherited::makeDeepCopyFromShallowCopy(copies);
    // deepCopyField(, copies);

    // Protected options
    deepCopyField(mu, copies);
    deepCopyField(Ut, copies);
    deepCopyField(U, copies);
    deepCopyField(V, copies);
    deepCopyField(diff_neighbor_input, copies);
    deepCopyField(uk, copies);
    deepCopyField(sm_svd, copies);
    deepCopyField(S, copies);
    deepCopyField(diff, copies);
    deepCopyField(eigenvectors, copies);
    deepCopyField(eigenvalues, copies);
    deepCopyField(sigma_noises, copies);
    deepCopyField(mus, copies);
    deepCopyField(class_datasets, copies);
    deepCopyField(nearest_neighbors_indices, copies);
    deepCopyField(test_votes, copies);
}

Here is the call graph for this function:

int PLearn::ManifoldParzen::outputsize ( ) const [virtual]

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 202 of file ManifoldParzen.cc.

{
    return 1;
}
void PLearn::ManifoldParzen::setTrainingSet ( VMat  training_set,
bool  call_forget = true 
) [virtual]

Declares the training set.

Then calls build() and forget() if necessary. Also sets this learner's inputsize_ targetsize_ weightsize_ from those of the training_set. Note: You shouldn't have to override this in subclasses, except in maybe to forward the call to an underlying learner.

Reimplemented from PLearn::PLearner.

Definition at line 474 of file ManifoldParzen.cc.

References class_datasets, nclasses, PLearn::TVec< T >::resize(), and PLearn::PLearner::setTrainingSet().

Referenced by build_().

{
    inherited::setTrainingSet(training_set,call_forget);
    
    // Separate classes
    if( nclasses > 1 )
    {
        class_datasets.resize(nclasses);
        for(int k=0; k<nclasses; k++)
        {
            class_datasets[k] = new ClassSubsetVMatrix();
            class_datasets[k]->classes.resize(1);
            class_datasets[k]->classes[0] = k;
            class_datasets[k]->source = training_set;
            class_datasets[k]->build();
        }
    }

}

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::ManifoldParzen::train ( ) [virtual]

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.

Implements PLearn::PLearner.

Definition at line 229 of file ManifoldParzen.cc.

References class_datasets, PLearn::TMat< T >::clear(), PLearn::columnMean(), PLearn::computeNearestNeighbors(), eigenvalues, eigenvectors, PLearn::endl(), PLearn::TVec< T >::fill(), PLearn::VMat::getExample(), getTrainCostNames(), i, PLearn::PLearner::inputsize(), PLearn::lapackSVD(), learn_mu, PLearn::VMat::length(), PLearn::TVec< T >::length(), MISSING_VALUE, mu, mus, PLearn::mypow(), nclasses, ncomponents, nearest_neighbors_indices, nneighbors, PLERROR, PLearn::PLearner::report_progress, PLearn::TVec< T >::resize(), PLearn::TMat< T >::resize(), S, PLearn::sample(), sigma_noises, PLearn::PLearner::stage, PLearn::substractFromRows(), PLearn::PLearner::targetsize(), PLearn::PLearner::train_set, PLearn::PLearner::train_stats, Ut, and V.

{
    MODULE_LOG << "train() called " << endl;

    Vec input( inputsize() );
    Vec nearest_neighbor( inputsize() );
    Mat nearest_neighbors( nneighbors, inputsize() );
    Vec target( targetsize() );
    Vec target2( targetsize() );
    real weight; // unused
    real weight2; // unused

    TVec<string> train_cost_names = getTrainCostNames() ;
    Vec train_costs( train_cost_names.length() );
    train_costs.fill(MISSING_VALUE) ;

    int sample;
    PP<ProgressBar> pb;

    // clear stats of previous epoch
    train_stats->forget();

    if( stage < 1 && nstages > 0 )
    {
        stage = 1;
        MODULE_LOG << "Finding the nearest neighbors" << endl;
        // Find training nearest neighbors
        TVec<int> nearest_neighbors_indices_row;
        nearest_neighbors_indices.resize(train_set->length(), nneighbors);
        if( nclasses > 1 )
            for(int k=0; k<nclasses; k++)
            {
                for(int i=0; i<class_datasets[k]->length(); i++)
                {
                    class_datasets[k]->getExample(i,input,target,weight);
                    nearest_neighbors_indices_row = nearest_neighbors_indices(
                        class_datasets[k]->indices[i]);
                
                    computeNearestNeighbors(
                        new GetInputVMatrix((VMatrix *)class_datasets[k]),input,
                        nearest_neighbors_indices_row,
                        i);
                }
            }
        else
            for(int i=0; i<train_set->length(); i++)
            {
                train_set->getExample(i,input,target,weight);
                nearest_neighbors_indices_row = nearest_neighbors_indices(i);
                computeNearestNeighbors(
                    train_set,input,
                    nearest_neighbors_indices_row,
                    i);
            }
      
        train_costs.fill(MISSING_VALUE);

        if( report_progress )
            pb = new ProgressBar( "Training ManifoldParzen",
                                  train_set->length() );

        eigenvectors.resize( train_set->length() );
        eigenvalues.resize( train_set->length(), ncomponents );
        sigma_noises.resize( train_set->length(), 1 );
        mus.resize( train_set->length(), inputsize() );
        mus.clear();
        for( sample = 0; sample < train_set->length() ; sample++ )
        { 
            train_set->getExample( sample, input, target, weight );
            
            // Find nearest neighbors
            if( nclasses > 1 )
                for( int k=0; k<nneighbors; k++ )
                {
                    class_datasets[(int)round(target[0])]->getExample(
                        nearest_neighbors_indices(sample,k),
                        nearest_neighbor, target2, weight2);
                  
                    if(round(target[0]) != round(target2[0]))
                        PLERROR("ManifoldParzen::train(): similar"
                                " example is not from same class!");
                    nearest_neighbors(k) << nearest_neighbor;
                }
            else
                for( int k=0; k<nneighbors; k++ )
                {
                    train_set->getExample(
                        nearest_neighbors_indices(sample,k),
                        nearest_neighbor, target2, weight2);
                    nearest_neighbors(k) << nearest_neighbor;
                }
            
            if( learn_mu )
            {
                mu.resize(inputsize());
                columnMean( nearest_neighbors, mu );
                mus(sample) << mu;
                mus(sample) -= input;
            }
            substractFromRows(nearest_neighbors, input, false); // Boolean is somehow unused???
            lapackSVD(nearest_neighbors, Ut, S, V,'A',1.5);
            eigenvectors[sample].resize(ncomponents,inputsize());
            for (int k=0;k<ncomponents;k++)
            {
                eigenvalues(sample,k) = mypow(S[k],2)/nneighbors;
                eigenvectors[sample](k) << Ut(k);
            }
            sigma_noises[sample] = 0; // HUGO: Seems stupid for now, but I keep 
                                      //       this variable in case I want to use
                                      //       the last eigen value or something...

            if( pb )
                pb->update( sample + 1 );
        }
    }
    
    train_stats->finalize();
    MODULE_LOG << "  train costs = " << train_stats->getMean() << endl;
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::PLearner.

Definition at line 125 of file ManifoldParzen.h.

Datasets for each class.

Definition at line 155 of file ManifoldParzen.h.

Referenced by computeCostsFromOutputs(), computeOutput(), makeDeepCopyFromShallowCopy(), setTrainingSet(), and train().

Vec PLearn::ManifoldParzen::diff [mutable, protected]

Definition at line 142 of file ManifoldParzen.h.

Referenced by computeOutput(), and makeDeepCopyFromShallowCopy().

Definition at line 142 of file ManifoldParzen.h.

Referenced by computeOutput(), and makeDeepCopyFromShallowCopy().

Eigenvalues.

Definition at line 148 of file ManifoldParzen.h.

Referenced by computeOutput(), declareOptions(), forget(), makeDeepCopyFromShallowCopy(), and train().

Eigenvectors.

Definition at line 146 of file ManifoldParzen.h.

Referenced by computeOutput(), forget(), makeDeepCopyFromShallowCopy(), and train().

Additive minimum value for the variance in all directions.

Definition at line 66 of file ManifoldParzen.h.

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

Indication that the meam of the gaussians should also be learned.

Definition at line 69 of file ManifoldParzen.h.

Referenced by declareOptions(), and train().

Vec PLearn::ManifoldParzen::mu [mutable, protected]

Variables for density of a Gaussian.

Definition at line 138 of file ManifoldParzen.h.

Referenced by computeOutput(), makeDeepCopyFromShallowCopy(), and train().

Mat PLearn::ManifoldParzen::mus [mutable, protected]

Mus.

Definition at line 152 of file ManifoldParzen.h.

Referenced by computeOutput(), declareOptions(), forget(), makeDeepCopyFromShallowCopy(), and train().

Number of classes.

Definition at line 72 of file ManifoldParzen.h.

Referenced by build_(), computeCostsFromOutputs(), computeOutput(), declareOptions(), setTrainingSet(), and train().

Dimensionality of the manifold.

Definition at line 63 of file ManifoldParzen.h.

Referenced by computeOutput(), declareOptions(), and train().

Proportions of examples from the other classes (columns), for each class (rows)

Nearest neighbors for each training example

Definition at line 162 of file ManifoldParzen.h.

Referenced by makeDeepCopyFromShallowCopy(), and train().

Number of nearest neighbors to use to learn the manifold structure.

Definition at line 60 of file ManifoldParzen.h.

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

Vec PLearn::ManifoldParzen::S [mutable, protected]

Definition at line 142 of file ManifoldParzen.h.

Referenced by makeDeepCopyFromShallowCopy(), and train().

Sigma noises.

Definition at line 150 of file ManifoldParzen.h.

Referenced by computeOutput(), declareOptions(), forget(), makeDeepCopyFromShallowCopy(), and train().

Vec PLearn::ManifoldParzen::sm_svd [mutable, protected]

Definition at line 142 of file ManifoldParzen.h.

Referenced by computeOutput(), and makeDeepCopyFromShallowCopy().

Nearest neighbor votes for test example.

Definition at line 165 of file ManifoldParzen.h.

Referenced by build_(), computeCostsFromOutputs(), computeOutput(), and makeDeepCopyFromShallowCopy().

Mat PLearn::ManifoldParzen::U [mutable, protected]

Definition at line 141 of file ManifoldParzen.h.

Referenced by computeOutput(), and makeDeepCopyFromShallowCopy().

Vec PLearn::ManifoldParzen::uk [mutable, protected]

Definition at line 142 of file ManifoldParzen.h.

Referenced by computeOutput(), and makeDeepCopyFromShallowCopy().

Mat PLearn::ManifoldParzen::Ut [mutable, protected]

Variables for the SVD and gradient computation.

Definition at line 141 of file ManifoldParzen.h.

Referenced by makeDeepCopyFromShallowCopy(), and train().

Mat PLearn::ManifoldParzen::V [mutable, protected]

Definition at line 141 of file ManifoldParzen.h.

Referenced by makeDeepCopyFromShallowCopy(), and train().


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