Xmipp
v3.23.11-Nereus
|
#include <map.h>
Public Member Functions | |
ClassificationMap (const ClassificationMap &op1) | |
ClassificationMap (const std::string &_layout, unsigned _width, const unsigned &_height, const unsigned &_size) | |
ClassificationMap (const std::string &_layout, unsigned _width, const unsigned &_height, const unsigned &_size, const double &_lower, const double &_upper) | |
ClassificationMap (const std::string &_layout, unsigned _width, const unsigned &_height, const ClassicTrainingVectors &_ts, const bool _use_rand_cvs=false) | |
ClassificationMap (std::istream &_is, bool _cv=true) | |
virtual | ~ClassificationMap () |
virtual void | add (const FeatureVector &_v, const Label &_l=Label()) |
const std::string & | layout () const |
std::vector< unsigned > | neighborhood (const SomPos &_center, double _radius) const |
double | neighDist (const SomPos &_center, const SomPos &_v) const |
unsigned | width () const |
unsigned | height () const |
const SomIn & | itemAtPos (const SomPos &_pos) const |
const Label & | targetAtPos (const SomPos &_pos) const |
void | clear () |
SomPos | indexToPos (const unsigned &_i) const |
unsigned | PosToIndex (const SomPos &_pos) const |
SomPos | codVecPos (SomIn &_v) |
ClassificationMap & | operator= (const ClassificationMap &op1) |
virtual void | printSelf (std::ostream &_os) const |
virtual void | readSelf (std::istream &_is) |
virtual void | saveObject (std::ostream &_os) const |
virtual void | loadObject (std::istream &_is) |
virtual const Layout & | getLayout () const |
Public Member Functions inherited from CodeBook | |
CodeBook (const bool &_calib=false) | |
CodeBook (unsigned _n, unsigned _size, bool _cal=false) | |
CodeBook (unsigned _n, unsigned _size, floatFeature _lower=0, floatFeature _upper=1, bool _cal=false) | |
CodeBook (unsigned _n, const ClassicTrainingVectors &_ts, const bool _use_rand_cvs) | |
CodeBook (std::istream &_is) | |
virtual | ~CodeBook () |
virtual FeatureVector & | test (const FeatureVector &_in) const |
virtual unsigned | testIndex (const FeatureVector &_in) const |
virtual void | classify (const ClassicTrainingVectors *_ts) |
virtual const std::vector< unsigned > & | classifAt (const unsigned &_index) const |
virtual unsigned | classifSizeAt (const unsigned &_index) const |
virtual Label | apply (const FeatureVector &_in) const |
virtual void | calibrate (ClassicTrainingVectors &_ts, Label _def="") |
virtual unsigned | output (const FeatureVector &_in) const |
virtual void | readSelf (std::istream &_is, long _dim=-1, long _size=-1) |
virtual void | Normalize (const std::vector< ClassicTrainingVectors::statsStruct > &_varStats) |
virtual void | unNormalize (const std::vector< ClassicTrainingVectors::statsStruct > &_varStats) |
virtual void | printHistogram (std::ostream &_os) const |
virtual void | printQuantError (std::ostream &_os) const |
Public Member Functions inherited from ClassificationDataSet< FeatureVector, Label > | |
ClassificationDataSet () | |
virtual | ~ClassificationDataSet () |
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) |
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 | |
const Layout * | somLayout |
unsigned | somWidth |
unsigned | somHeight |
Protected Attributes inherited from ClassificationTrainingSet< FeatureVector, Label > | |
bool | isCalibrated |
splitTS | splitTrainingSet |
unsigned | nTargets |
Friends | |
std::ostream & | operator<< (std::ostream &_os, const ClassificationMap &_som) |
std::istream & | operator>> (std::istream &_is, ClassificationMap &_som) |
Additional Inherited Members | |
Public Types inherited from ClassificationDataSet< FeatureVector, Label > | |
typedef FeatureVector | In |
Class of input vectors. Usually a FeatureVector (vector of Feature) More... | |
typedef Label | Out |
Class of the target. Can be a double, string, unsigned, even a vector ... More... | |
typedef ClassificationTrainingSet< In, Out > | TS |
Training set. Set of vectors (training vectors), probably classified. More... | |
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 Attributes inherited from CodeBook | |
std::vector< std::vector< unsigned > > | classifVectors |
std::vector< double > | aveDistances |
Public Attributes inherited from ClassificationTrainingSet< FeatureVector, Label > | |
std::vector< FeatureVector > | theItems |
std::vector< Label > | theTargets |
Protected Member Functions inherited from CodeBook | |
void | readClassifVectors (std::istream &_is) |
void | writeClassifVectors (std::ostream &_os) const |
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 a Map of the type used by Kohonen Algorithms
|
explicit |
ClassificationMap::ClassificationMap | ( | const std::string & | _layout, |
unsigned | _width, | ||
const unsigned & | _height, | ||
const unsigned & | _size | ||
) |
Constructs a SOM with initial code vectors filled with zero. Parameter: _layout Type of layout Parameter: _width Width of the output plane Parameter: _height Height of the output plane Parameter: _size Size of code vectors
ClassificationMap::ClassificationMap | ( | const std::string & | _layout, |
unsigned | _width, | ||
const unsigned & | _height, | ||
const unsigned & | _size, | ||
const double & | _lower, | ||
const double & | _upper | ||
) |
Constructs a SOM with random initial code vectors Parameter: _layout Type of layout Parameter: _width Width of the output plane Parameter: _height Height of the output plane Parameter: _size Size of code vectors Parameter: _lower Lower value for random elements Parameter: _upper Upper value for random elements
ClassificationMap::ClassificationMap | ( | const std::string & | _layout, |
unsigned | _width, | ||
const unsigned & | _height, | ||
const ClassicTrainingVectors & | _ts, | ||
const bool | _use_rand_cvs = false |
||
) |
Constructs a SOM with initial code vectors taken randomly from the training file. Parameter: _layout Type of layout Parameter: _width Width of the output plane Parameter: _height Height of the output plane Parameter: _ts Training set; will be used to get initial values Parameter: _use_rand_cvs Use random code vector values
Constructs a SOM with initial code vectors taken randomly from the training file. Parameter: _layout Type of layout Parameter: _width Width of the output plane Parameter: _height Height of the output plane Parameter: _ts Training set; will be used to get initial values Parameter: _use_rand_cvs Use random code vector pixel values
ClassificationMap::ClassificationMap | ( | std::istream & | _is, |
bool | _cv = true |
||
) |
Construct a SOM from the code vectors in a stream Parameter: _is The stream Parameter: _cv If the stream holds a codevector file or a whole codebook file
runtime_error | If there are problems with the stream |
Construct a SOM from the code vectors in a stream Parameter: _is The stream
runtime_error | If there are problems with the stream |
Definition at line 134 of file map.cpp.
|
inlinevirtual |
|
virtual |
This method throws an exception if called. There is no sense in adding vectors to a som
range_error | If this method is called |
Reimplemented from ClassificationTrainingSet< FeatureVector, Label >.
Returns the position in the som of a code vector Parameter: _v Reference to the code vector
Definition at line 341 of file map.cpp.
|
inlinevirtual |
unsigned ClassificationMap::height | ( | ) | const |
SomPos ClassificationMap::indexToPos | ( | const unsigned & | _i | ) | const |
Returns a const reference to a code vector given its position Parameter: _pos The position of the code vector
out_of | _range If _pos is out of range |
Definition at line 224 of file map.cpp.
const std::string & ClassificationMap::layout | ( | ) | const |
|
virtual |
Loads the ClassificationMap class from a stream. this method can be used to load the status of the class. Parameter: _is The output stream
Reimplemented from CodeBook.
Definition at line 451 of file map.cpp.
std::vector< unsigned > ClassificationMap::neighborhood | ( | const SomPos & | _center, |
double | _radius | ||
) | const |
Returns the neighborhood of a neuron Parameter: _center Reference to the center of neighborhood Parameter: _radius Radius of neighbohood
Definition at line 167 of file map.cpp.
ClassificationMap & ClassificationMap::operator= | ( | const ClassificationMap & | op1 | ) |
unsigned ClassificationMap::PosToIndex | ( | const SomPos & | _pos | ) | const |
|
virtual |
Standard output for a map Parameter: _os The output stream
Standard output for a SOM Parameter: _os The output stream
Reimplemented from CodeBook.
Definition at line 375 of file map.cpp.
|
virtual |
Standard input for a map Parameter: _is The input stream
Standard input for a SOM Parameter: _is The input stream
Reimplemented from ClassificationTrainingSet< FeatureVector, Label >.
Definition at line 386 of file map.cpp.
|
virtual |
Saves the ClassificationMap class into a stream. this method can be used to save the status of the class. Parameter: _os The output stream
Reimplemented from CodeBook.
Definition at line 438 of file map.cpp.
Returns a const target of a code vector given its position Parameter: _pos The position of the code vector
Definition at line 266 of file map.cpp.
unsigned ClassificationMap::width | ( | ) | const |
|
friend |
|
friend |