Xmipp  v3.23.11-Nereus
fcmeans.h
Go to the documentation of this file.
1 /***************************************************************************
2  *
3  * Authors: Alberto Pascual Montano (pascual@cnb.csic.es)
4  *
5  * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA
21  *
22  * All comments concerning this program package may be sent to the
23  * e-mail address 'xmipp@cnb.csic.es'
24  ***************************************************************************/
25 //-----------------------------------------------------------------------------
26 // FuzzyCMeans.hh
27 // Fuzzy c-means clustering algorithm
28 //-----------------------------------------------------------------------------
29 
30 #ifndef _XMIPPFCMEANS_H
31 #define _XMIPPFCMEANS_H
32 
33 #include <iostream>
34 #include <vector>
35 
36 #include "base_algorithm.h"
37 #include "fuzzy_code_book.h"
38 
46 class FuzzyCMeans: public ClassificationAlgorithm<FuzzyCodeBook >
47 {
48 
49 public:
50 
57  FuzzyCMeans(double _m, double _epsilon, unsigned _epochs)
58  : ClassificationAlgorithm< FuzzyCodeBook >("xmippFCMeans"),
59  m(_m), epsilon(_epsilon),
60  epochs(_epochs)
61  {}
62  ;
63 
64 
65  /*
66  * Ctor from stream
67  * Parameter: _is Must have the parameters in the same order than the previous ctor.
68  */
69  // FuzzyCMeans( std::istream& _is );
70 
71 
72  /*
73  * Virtual destructor
74  */
75  virtual ~FuzzyCMeans()
76  {}
77  ;
78 
79 
85  virtual void train(FuzzyCodeBook& _xmippDS,
86  TS& _examples) const;
87 
88 
96  virtual double fuzzyTest(const FuzzyCodeBook& _xmippDS,
97  const TS& _examples) const;
98 
99 
105  virtual double test(const FuzzyCodeBook& _xmippDS,
106  const TS& _examples) const;
107 
108 
118  double F(const FuzzyCodeBook& _xmippDS) const;
119 
130  double H(const FuzzyCodeBook& _xmippDS) const;
131 
132 #ifdef UNUSED // detected as unused 29.6.2018
133 
143  double NFI(const FuzzyCodeBook& _xmippDS) const;
144 #endif
145 
156  double S(const FuzzyCodeBook& _xmippDS, const TS& _examples) const;
157 
158 protected:
159 
161  void printSelf(std::ostream& _os) const ;
162 
163  double m; // Fuzzy constant
164  double epsilon; // Stopping criterion Error < epsilon
165  unsigned epochs; // Number of presentations of the whole sample
166 };
168 #endif//_XMIPPFCMEANS_H
double m
Definition: fcmeans.h:163
double S(const FuzzyCodeBook &_xmippDS, const TS &_examples) const
Definition: fcmeans.cpp:337
virtual void train(FuzzyCodeBook &_xmippDS, TS &_examples) const
Definition: fcmeans.cpp:50
void printSelf(std::ostream &_os) const
print itself on standard output
Definition: fcmeans.cpp:382
virtual double test(const FuzzyCodeBook &_xmippDS, const TS &_examples) const
Definition: fcmeans.cpp:184
FuzzyCMeans(double _m, double _epsilon, unsigned _epochs)
Definition: fcmeans.h:57
double F(const FuzzyCodeBook &_xmippDS) const
Definition: fcmeans.cpp:262
virtual ~FuzzyCMeans()
Definition: fcmeans.h:75
double H(const FuzzyCodeBook &_xmippDS) const
Definition: fcmeans.cpp:289
virtual double fuzzyTest(const FuzzyCodeBook &_xmippDS, const TS &_examples) const
Definition: fcmeans.cpp:218
double epsilon
Definition: fcmeans.h:164
unsigned epochs
Definition: fcmeans.h:165