Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drwnFeatureWhitener.h
1 /******************************************************************************
2 ** DARWIN: A FRAMEWORK FOR MACHINE LEARNING RESEARCH AND DEVELOPMENT
3 ** Distributed under the terms of the BSD license (see the LICENSE file)
4 ** Copyright (c) 2007-2015, Stephen Gould
5 ** All rights reserved.
6 **
7 ******************************************************************************
8 ** FILENAME: drwnFeatureWhitener.h
9 ** AUTHOR(S): Stephen Gould <stephen.gould@anu.edu.au>
10 **
11 *****************************************************************************/
12 
13 #pragma once
14 
15 #include <vector>
16 #include <limits>
17 
18 #include "Eigen/Core"
19 
20 #include "drwnBase.h"
21 #include "drwnFeatureTransform.h"
22 #include "drwnSuffStats.h"
23 
24 using namespace std;
25 using namespace Eigen;
26 
27 // drwnFeatureWhitener class --------------------------------------------------
54 
56  private:
57  VectorXd _mu;
58  VectorXd _beta;
59 
60  public:
64  drwnFeatureWhitener(const drwnSuffStats& stats);
68 
69  // access functions
70  const char *type() const { return "drwnFeatureWhitener"; }
71  drwnFeatureWhitener *clone() const { return new drwnFeatureWhitener(*this); }
72 
73  // i/o
74  void clear();
75  bool save(drwnXMLNode& node) const;
76  bool load(drwnXMLNode& node);
77 
78  // training
82  double train(const drwnSuffStats& stats);
83  double train(const vector<vector<double> >& features);
84 
85  // evaluation
87  void transform(vector<double>& x) const;
88  void transform(const vector<double>& x, vector<double>& y) const;
89 };
drwnFeatureWhitener * clone() const
returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } ...
Definition: drwnFeatureWhitener.h:71
Whitens (zero mean, unit variance) feature vector (see also drwnPCA).
Definition: drwnFeatureWhitener.h:55
virtual void transform(vector< double > &x) const
transforms a feature vector in-place
Definition: drwnFeatureTransform.cpp:57
virtual double train(const vector< vector< double > > &features)=0
Estimate the parameters of the features transformation. This function must be implemented in the deri...
const char * type() const
returns object type as a string (e.g., Foo::type() { return "Foo"; })
Definition: drwnFeatureWhitener.h:70
Implements interface for unsupervised feature transforms (i.e, without class labels).
Definition: drwnFeatureTransform.h:118
Implements a class for accumulating first- and second-order sufficient statistics (moments)...
Definition: drwnSuffStats.h:43