Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::FeatureScaling Class Reference

#include <FeatureScaling.h>

List of all members.


Detailed Description

This class contains static methods for scaling feature values.

Standard template library (stl) functionals are used as template parameters to perform the scaling calculations. An example:

 include <functional>

 ...

 List<Sample<double> > samples; //produce these somehow
 List<double> means, variances;

 //Loop through all features
 for (int i=0;i<featureCount;i++)
   {
     //Collect the ith features
     List<double> tmpLst(FeatureScaling::getFeature(samples,i));

     //Calculate mean and variance
     means += Math::mean(tmpLst);
     variances += Math::variance(tmpList);
   }

  //Subtract the mean value from each feature.
  FeatureScaling::scaleFeatures<minus<double> >(samples,means);
  //Divide by variance.
  FeatureScaling::scaleFeatures<divides<double> >(samples,variances);
 


Static Public Methods

template<class T, class I, class C> List< T > getFeature (const List< Sample< T, I, C > > &samples, int n)
 Get the nth feature from each sample in a sample list.

template<class T, class I, class C> List< T > getFeature (const List< Sample< List< T >, I, C > > &samples, int featureVector, int n)
 Get the nth feature from the given feature vector of each sample in a sample list.

template<class operation, class T, class I, class C> void scaleFeatures (List< Sample< T, I, C > > &samples, const List< T > &values)
template<class operation, class T, class I, class C> void scaleFeatures (List< Sample< List< T >, I, C > > &samples, int featureVector, const List< T > &values)
 Scale feature values with the corresponding values in a list.


Member Function Documentation

template<class T, class I, class C>
List< T > prapi::FeatureScaling::getFeature const List< Sample< List< T >, I, C > > &    samples,
int    featureVector,
int    n
[static]
 

Get the nth feature from the given feature vector of each sample in a sample list.

This method goes through all samples in a list and stores the nth sample of the required feature vector into the resulting list.

Parameters:
samples  a list of multi-feature samples
featureVector  a zero-based index to the wanted feature vector
n  a zero-based feature index

template<class T, class I, class C>
List< T > prapi::FeatureScaling::getFeature const List< Sample< T, I, C > > &    samples,
int    n
[static]
 

Get the nth feature from each sample in a sample list.

This method goes through all samples in a list and stores the nth sample into the resulting list.

Parameters:
samples  a list of samples
n  a zero-based feature index

template<class operation, class T, class I, class C>
void prapi::FeatureScaling::scaleFeatures List< Sample< List< T >, I, C > > &    samples,
int    featureVector,
const List< T > &    values
[static]
 

Scale feature values with the corresponding values in a list.

Parameters:
samples  the samples whose feature vectors are to be modified
featureVector  the index of the feature vector to modify
values  the values to multiply the feature values by


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.