Xmipp
v3.23.11-Nereus
|
#include <training_vector.h>
Classes | |
struct | stats |
Public Types | |
typedef struct ClassicTrainingVectors::stats | statsStruct |
Public Types inherited from ClassificationTrainingSet< FeatureVector, Label > | |
enum | splitMode |
Ways the training set can be used. More... | |
enum | useMode |
use of samples More... | |
typedef std::multimap< unsigned, unsigned, std::less< unsigned > > | splitTS |
Training sets mode. More... | |
typedef splitTS::iterator | splitIt |
iterator More... | |
Public Member Functions | |
ClassicTrainingVectors (unsigned _vecSize=0, bool _calib=true) | |
ClassicTrainingVectors (std::istream &_is) | |
ClassicTrainingVectors (const ClassicTrainingVectors &op1) | |
virtual | ~ClassicTrainingVectors () |
unsigned | dimension () const |
void | clear () |
virtual void | printSelf (std::ostream &_os) const |
virtual void | readSelf (std::istream &_is) |
void | read (const FileName &fnIn) |
virtual void | saveObject (std::ostream &_os) const |
virtual void | loadObject (std::istream &_is) |
ClassicTrainingVectors & | operator= (const ClassicTrainingVectors &op1) |
virtual void | normalizeFeature (unsigned _i) |
void | normalize () |
virtual void | unNormalize () |
bool | isNormalized () const |
virtual const std::vector< statsStruct > & | getNormalizationInfo () const |
void | getFeatureStats (unsigned _i, floatFeature &_mean, floatFeature &_sd) |
Public Member Functions inherited from ClassificationTrainingSet< FeatureVector, Label > | |
ClassificationTrainingSet (const bool &_calib=true, unsigned _n=0) | |
ClassificationTrainingSet (std::istream &_is) | |
virtual | ~ClassificationTrainingSet () |
void | setSplit (float _tp, float _vp) |
splitIt | beginSubset (unsigned _um) |
splitIt | endSubset (unsigned _um) |
Returns an iterator to the end of the subset. More... | |
virtual void | add (const FeatureVector &_i, const Label &_tg) |
virtual void | add (const FeatureVector &_i) |
virtual bool | remove (unsigned int _idx) |
size_t | size () const |
const Label & | targetAt (unsigned _i) const |
Label & | targetAt (unsigned _i) |
const FeatureVector & | itemAt (unsigned _i) const |
FeatureVector & | itemAt (unsigned _i) |
bool | calibrated () const |
void | calibrated (const bool &_calib) |
void | clear () |
unsigned | numTargets () const |
virtual bool | swapItems (unsigned _i, unsigned _j) |
Protected Attributes | |
std::vector< statsStruct > | varStats |
bool | normalized |
Protected Attributes inherited from ClassificationTrainingSet< FeatureVector, Label > | |
bool | isCalibrated |
splitTS | splitTrainingSet |
unsigned | nTargets |
Additional Inherited Members | |
Public Attributes inherited from ClassificationTrainingSet< FeatureVector, Label > | |
std::vector< FeatureVector > | theItems |
std::vector< Label > | theTargets |
Protected Member Functions inherited from ClassificationTrainingSet< FeatureVector, Label > | |
void | computeNumTargets () |
void | checkCalibrated (std::istream &_is) |
void | readItems (std::istream &_is) |
void | writeCalibrated (std::ostream &_os) const |
void | writeItems (std::ostream &_os, bool _delim=false) const |
void | skipComments (std::istream &_is) const |
std::vector< FeatureVector >::const_iterator | itemsBegin () const |
std::vector< FeatureVector >::const_iterator | itemsEnd () const |
std::vector< Label >::const_iterator | targetsBegin () const |
std::vector< Label >::const_iterator | targetsEnd () const |
This class implements all the necessary functionality for classic training vectors.
Definition at line 46 of file training_vector.h.
typedef struct ClassicTrainingVectors::stats ClassicTrainingVectors::statsStruct |
|
inline |
Default constructor Parameter: _vecSize Vector dimension; required to dim the feature and types vector Parameter: _calib calibration which should be true if the data set has labels
Definition at line 63 of file training_vector.h.
ClassicTrainingVectors::ClassicTrainingVectors | ( | std::istream & | _is | ) |
Constructs a training set given a stream Parameter: _is The input stream
runtime_error | If there are problems with the stream |
TrainingSet for ClassicTrainingVectors Constructs a training set given a stream Parameter: _is The input stream
runtime_error | If there are problems with the stream |
Definition at line 46 of file training_vector.cpp.
ClassicTrainingVectors::ClassicTrainingVectors | ( | const ClassicTrainingVectors & | op1 | ) |
Copy Constructor. Useful when returning a ClassicTrainingVectors Class. Parameter: op1 ClassicTrainingVectors
Definition at line 67 of file training_vector.cpp.
|
inlinevirtual |
void ClassicTrainingVectors::clear | ( | ) |
Clears the training set
Definition at line 105 of file training_vector.cpp.
unsigned ClassicTrainingVectors::dimension | ( | ) | const |
Returns the dimension of the vectors (number of features)
Returns dimension (the same as above)
Definition at line 97 of file training_vector.cpp.
void ClassicTrainingVectors::getFeatureStats | ( | unsigned | _i, |
floatFeature & | _mean, | ||
floatFeature & | _sd | ||
) |
Calcualtes the average and SD of a feature in the training set Parameter: _i The index to the feature
Returns a const reference to the normalization vector Calcualtes the average and SD of a feature in the training set Parameter: _i The index to the feature
Definition at line 505 of file training_vector.cpp.
|
inlinevirtual |
Returns a const reference to the normalization vector
Definition at line 205 of file training_vector.h.
bool ClassicTrainingVectors::isNormalized | ( | ) | const |
|
virtual |
Loads the class from a stream. this method can be used to load the status of the class. Parameter: _is The output stream
Reimplemented from ClassificationTrainingSet< FeatureVector, Label >.
Definition at line 252 of file training_vector.cpp.
void ClassicTrainingVectors::normalize | ( | ) |
Normalize all features in the training set
Definition at line 417 of file training_vector.cpp.
|
virtual |
Normalize a feature in the training set Parameter: _i The index to the feature
Normalize all features in the training set Parameter: _i The index to the feature
Definition at line 362 of file training_vector.cpp.
ClassicTrainingVectors & ClassicTrainingVectors::operator= | ( | const ClassicTrainingVectors & | op1 | ) |
Operator "=" Parameter: op1 ClassicTrainingVectors
Definition at line 287 of file training_vector.cpp.
|
virtual |
Standard output for a training set Parameter: _os The output stream
Standard output for a training set Parameter: _os The output stream Parameter: _ts The training set to be printed
Reimplemented from ClassificationTrainingSet< FeatureVector, Label >.
Definition at line 117 of file training_vector.cpp.
void ClassicTrainingVectors::read | ( | const FileName & | fnIn | ) |
Read data from a metadata.
Definition at line 182 of file training_vector.cpp.
|
virtual |
Standard input for a training set Parameter: _is The input stream
runtime_error | If there are problems with the stream |
Standard input for a training set Parameter: _is The input stream Parameter: _ts The training set to be read
runtime_error | If there are problems with the stream |
Reimplemented from ClassificationTrainingSet< FeatureVector, Label >.
Definition at line 129 of file training_vector.cpp.
|
virtual |
Saves the class into a stream. this method can be used to save the status of the class. Parameter: _os The output stream
Reimplemented from ClassificationTrainingSet< FeatureVector, Label >.
Definition at line 233 of file training_vector.cpp.
|
virtual |
UnNormalize all features in the training set
Definition at line 431 of file training_vector.cpp.
|
protected |
Definition at line 226 of file training_vector.h.
|
protected |
Definition at line 225 of file training_vector.h.