SHOGUN  6.1.3
FisherLDA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Shogun Toolbox Foundation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7 
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18 
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  * Written (W) 2014 Abhijeet Kislay
32  */
33 
34 #ifndef LDA_H_
35 #define LDA_H_
36 
37 #include <shogun/lib/config.h>
38 
40 #include <shogun/labels/Labels.h>
43 #include <vector>
44 
45 namespace shogun
46 {
47 
50  {
54  AUTO_FLDA = 10,
59  };
60 
93 {
94  public:
109  CFisherLDA(
110  EFLDAMethod method = AUTO_FLDA, float64_t thresh = 0.01,
111  float64_t gamma = 0, bool bdc_svd = true);
112 
114  virtual ~CFisherLDA();
115 
122  virtual bool fit(CFeatures* features, CLabels* labels, int32_t num_dimensions=0);
123 
125  virtual void cleanup();
126 
133 
139 
143 
147 
151 
153  virtual const char* get_name() const {return "FisherLDA";}
154 
156  virtual EPreprocessorType get_type() const {return P_FISHERLDA;}
157 
158  private:
159 
160  void initialize_parameters();
161 
162  protected:
168  bool solver_canvar(
169  CDenseFeatures<float64_t>* features, CMulticlassLabels* labels);
170 
176  bool solver_classic(
177  CDenseFeatures<float64_t>* features, CMulticlassLabels* labels);
178 
182  int32_t m_num_dim;
188  int32_t m_method;
190  bool m_bdc_svd;
195 };
196 }
197 #endif //ifndef
the class DimensionReductionPreprocessor, a base class for preprocessors used to lower the dimensiona...
virtual const char * get_name() const
Definition: FisherLDA.h:153
EPreprocessorType
Definition: Preprocessor.h:32
virtual SGMatrix< float64_t > apply_to_feature_matrix(CFeatures *features)
Definition: FisherLDA.cpp:213
SGMatrix< float64_t > get_transformation_matrix()
Definition: FisherLDA.cpp:266
virtual bool fit(CFeatures *features, CLabels *labels, int32_t num_dimensions=0)
Definition: FisherLDA.cpp:93
virtual SGVector< float64_t > apply_to_feature_vector(SGVector< float64_t > vector)
Definition: FisherLDA.cpp:251
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
float64_t m_gamma
Definition: FisherLDA.h:184
Preprocessor FisherLDA attempts to model the difference between the classes of data by performing lin...
Definition: FisherLDA.h:92
virtual ~CFisherLDA()
Definition: FisherLDA.cpp:89
Multiclass Labels for multi-class classification.
double float64_t
Definition: common.h:60
bool solver_classic(CDenseFeatures< float64_t > *features, CMulticlassLabels *labels)
Definition: FisherLDA.cpp:158
SGMatrix< float64_t > m_transformation_matrix
Definition: FisherLDA.h:180
virtual EPreprocessorType get_type() const
Definition: FisherLDA.h:156
SGVector< float64_t > m_mean_vector
Definition: FisherLDA.h:192
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:69
CFisherLDA(EFLDAMethod method=AUTO_FLDA, float64_t thresh=0.01, float64_t gamma=0, bool bdc_svd=true)
Definition: FisherLDA.cpp:52
SGVector< float64_t > m_eigenvalues_vector
Definition: FisherLDA.h:194
EFLDAMethod
Definition: FisherLDA.h:49
float64_t m_threshold
Definition: FisherLDA.h:186
SGVector< float64_t > get_mean()
Definition: FisherLDA.cpp:276
bool solver_canvar(CDenseFeatures< float64_t > *features, CMulticlassLabels *labels)
Definition: FisherLDA.cpp:145
virtual void cleanup()
Definition: FisherLDA.cpp:206
SGVector< float64_t > get_eigenvalues()
Definition: FisherLDA.cpp:271

SHOGUN Machine Learning Toolbox - Documentation