Xmipp  v3.23.11-Nereus
training_vector.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 //-----------------------------------------------------------------------------
27 // ClassicTrainingVectors.hh
28 //-----------------------------------------------------------------------------
29 
30 #ifndef XMIPPCTVECTORS_H
31 #define XMIPPCTVECTORS_H
32 
33 #include <sstream>
34 #include <core/xmipp_filename.h>
35 #include "data_types.h"
36 #include "training_set.h"
37 #include "vector_ops.h"
38 
46 class ClassicTrainingVectors : public ClassificationTrainingSet<FeatureVector, Label>
47 {
48 public:
49 
50  typedef struct stats
51  {
54  }
56 
57 
63  ClassicTrainingVectors(unsigned _vecSize = 0, bool _calib = true)
64  : ClassificationTrainingSet<FeatureVector, Label>(_calib), /*varStats(_vecSize),*/
65  normalized(false)
66  {}
67  ;
68 
75 
81 
86  {}
87  ;
88 
89 #ifdef UNUSED // detected as unused 29.6.2018
90 
93  unsigned featureSize() const;
94 #endif
95 
99  unsigned dimension() const;
100 
104  void clear();
105 
110  virtual void printSelf(std::ostream& _os) const;
111 
117  virtual void readSelf(std::istream& _is);
118 
121  void read(const FileName & fnIn);
122 
128  virtual void saveObject(std::ostream& _os) const;
129 
130 
136  virtual void loadObject(std::istream& _is);
137 
138 #ifdef UNUSED // detected as unused 29.6.2018
139 
143  void deleteVariable(int _var);
144 #endif
145 
151 
152 #ifdef UNUSED // detected as unused 29.6.2018
153 
157  bool copyStructure(ClassicTrainingVectors& _ts);
158 
159 
165  bool insertRowFrom(ClassicTrainingVectors& _ts, unsigned int _idx);
166 
170  bool deleteRow(unsigned int _idx);
171 #endif
172 
177  virtual void normalizeFeature(unsigned _i);
178 
179 
183  void normalize();
184 
188  virtual void unNormalize();
189 
190 #ifdef UNUSED // detected as unused 29.6.2018
191 
194  virtual double getUnormalizedVar(unsigned _item, unsigned _var) const;
195 #endif
196 
200  bool isNormalized() const;
201 
205  virtual const std::vector<statsStruct>& getNormalizationInfo() const
206  {
207  return varStats;
208  };
209 
214  void getFeatureStats(unsigned _i, floatFeature& _mean, floatFeature& _sd);
215 
216 #ifdef UNUSED // detected as unused 29.6.2018
217 
221  ClassicTrainingVectors getStatVector();
222 #endif
223 
224 protected:
225  std::vector <statsStruct> varStats;
227 
228 };
230 #endif//XMIPPCTVECTORS_H
std::string Label
Definition: data_types.h:79
void getFeatureStats(unsigned _i, floatFeature &_mean, floatFeature &_sd)
virtual void saveObject(std::ostream &_os) const
ClassicTrainingVectors(unsigned _vecSize=0, bool _calib=true)
void read(const FileName &fnIn)
struct ClassicTrainingVectors::stats statsStruct
float floatFeature
Definition: data_types.h:72
ClassicTrainingVectors & operator=(const ClassicTrainingVectors &op1)
std::vector< statsStruct > varStats
virtual void loadObject(std::istream &_is)
unsigned dimension() const
virtual void readSelf(std::istream &_is)
basic_istream< char, std::char_traits< char > > istream
Definition: utilities.cpp:815
virtual void normalizeFeature(unsigned _i)
virtual void printSelf(std::ostream &_os) const
virtual const std::vector< statsStruct > & getNormalizationInfo() const
std::vector< floatFeature > FeatureVector
Definition: data_types.h:86
virtual ~ClassicTrainingVectors()