Xmipp  v3.23.11-Nereus
Public Types | Public Member Functions | Public Attributes | List of all members
FuzzyCodeBook Class Reference

#include <fuzzy_code_book.h>

Inheritance diagram for FuzzyCodeBook:
Inheritance graph
[legend]
Collaboration diagram for FuzzyCodeBook:
Collaboration graph
[legend]

Public Types

typedef std::vector< std::vector< floatFeature > > MM
 
typedef ClassicTrainingVectors TS
 Alias for Membership Matrix. More...
 
typedef ClassificationTrainingSet< std::vector< floatFeature >, floatFeatureFV
 Alias for a Training set. More...
 
- 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, OutTS
 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 Member Functions

 FuzzyCodeBook (const bool &_calib=false)
 
 FuzzyCodeBook (unsigned _n, unsigned _size, unsigned _data, bool _cal=false)
 
 FuzzyCodeBook (unsigned _n, unsigned _size, unsigned _data, double _lower=0, double _upper=1, bool _cal=false)
 
 FuzzyCodeBook (unsigned _n, const ClassicTrainingVectors &_ts, const bool _use_rand_cvs=false)
 
 FuzzyCodeBook (std::istream &_is, const unsigned _size=0)
 
virtual ~FuzzyCodeBook ()
 
floatFeaturemembAt (unsigned _di, unsigned _ci)
 
unsigned membClusters () const
 
unsigned membVectors () const
 
virtual FeatureVectorfuzzyTest (unsigned _in) const
 
virtual unsigned fuzzyTestIndex (unsigned _in) const
 
virtual unsigned fuzzyWinner (unsigned _in) const
 
virtual unsigned fuzzyOutput (unsigned _in) const
 
virtual void classify (const ClassicTrainingVectors *_ts)
 
virtual TS alphaCore (TS _ts, double _alpha, unsigned _cluster) const
 
virtual void writeMembership (std::ostream &_os) const
 
virtual void readMembership (std::istream &_is)
 
virtual void saveObject (std::ostream &_os) const
 
virtual void loadObject (std::istream &_is)
 
virtual void readSelf (std::istream &_is, const unsigned _size=0)
 
- 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 FeatureVectortest (const FeatureVector &_in) const
 
virtual unsigned testIndex (const FeatureVector &_in) const
 
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 printSelf (std::ostream &_os) 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, const Label &_tg)
 
virtual void add (const FeatureVector &_i)
 
virtual bool remove (unsigned int _idx)
 
size_t size () const
 
const LabeltargetAt (unsigned _i) const
 
LabeltargetAt (unsigned _i)
 
const FeatureVectoritemAt (unsigned _i) const
 
FeatureVectoritemAt (unsigned _i)
 
bool calibrated () const
 
void calibrated (const bool &_calib)
 
void clear ()
 
virtual void readSelf (std::istream &_is)
 
unsigned numTargets () const
 
virtual bool swapItems (unsigned _i, unsigned _j)
 

Public Attributes

MM memb
 Alias for Fuzzy vectors. 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< FeatureVectortheItems
 
std::vector< LabeltheTargets
 

Additional Inherited Members

- 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
 
- Protected Attributes inherited from ClassificationTrainingSet< FeatureVector, Label >
bool isCalibrated
 
splitTS splitTrainingSet
 
unsigned nTargets
 

Detailed Description

This class implements an specific Data Structure for Fuzzy algorithms. It inherits fron CodeBook, so this Data Structure is basically a codebook with a Fuzzy-membership Matrix. Some of the methods from CodeBook are redefined.

Definition at line 44 of file fuzzy_code_book.h.

Member Typedef Documentation

◆ FV

Alias for a Training set.

Definition at line 53 of file fuzzy_code_book.h.

◆ MM

typedef std::vector< std::vector< floatFeature > > FuzzyCodeBook::MM

Definition at line 48 of file fuzzy_code_book.h.

◆ TS

Alias for Membership Matrix.

Definition at line 51 of file fuzzy_code_book.h.

Constructor & Destructor Documentation

◆ FuzzyCodeBook() [1/5]

FuzzyCodeBook::FuzzyCodeBook ( const bool &  _calib = false)
inline

Default constructor Parameter: _calib Calibrated or not, that is, a CB with class labels or not

Definition at line 63 of file fuzzy_code_book.h.

63  : CodeBook(_calib)
64  {};
CodeBook(const bool &_calib=false)
Definition: code_book.h:69

◆ FuzzyCodeBook() [2/5]

FuzzyCodeBook::FuzzyCodeBook ( unsigned  _n,
unsigned  _size,
unsigned  _data,
bool  _cal = false 
)

Constructor. Constructs a fuzzy codebook with initial code vectors filled with zero. Parameter: _n Number of code vectors Parameter: _size Size of code vectors Parameter: _data Size of the training set Parameter: _cal Calibrated or not, that is, a CB with class labels or not It calls Base Class constructor (CodeBook)

Constructor. Constructs a codebook with initial code vectors filled with zero. Parameter: _n Number of vectors (clusters) Parameter: _size Size of code vectors Parameter: _cal Calibrated or not, that is, a CB with class labels or not It calls Base Class constructor (CodeBook)

Definition at line 41 of file fuzzy_code_book.cpp.

42  : CodeBook(_n, _size, _cal)
43 {
44 
45  // Initialize Fuzzy membership Matrix
46 
47  numClusters = _n;
48  numVectors = _data;
49  memb.resize(numVectors);
50  for (unsigned k = 0; k < numVectors; k++)
51  {
52  std::vector <floatFeature> v;
53  v.resize(numClusters, 0);
54  memb[k] = v;
55  } // for k
56 
57 }
MM memb
Alias for Fuzzy vectors.
CodeBook(const bool &_calib=false)
Definition: code_book.h:69
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac

◆ FuzzyCodeBook() [3/5]

FuzzyCodeBook::FuzzyCodeBook ( unsigned  _n,
unsigned  _size,
unsigned  _data,
double  _lower = 0,
double  _upper = 1,
bool  _cal = false 
)

Constructor. Constructs a fuzzy codebook with random initial code vectors. Parameter: _n Number of code vectors Parameter: _size Size of code vectors Parameter: _data Size of the training set Parameter: _lower Lower value for random elements Parameter: _upper Upper value for random elements Parameter: _cal Calibrated or not, that is, a CB with class labels or not It calls Base Class constructor (CodeBook)

Constructor. Constructs a codebook with random initial code vectors. Parameter: _n Number of vectors Parameter: _size Size of code vectors Parameter: _lower Lower value for random elements Parameter: _upper Upper value for random elements Parameter: _cal Calibrated or not, that is, a CB with class labels or not It calls Base Class constructor (CodeBook)

Definition at line 72 of file fuzzy_code_book.cpp.

73  : CodeBook(_n, _size, _lower, _upper, _cal)
74 {
75 
76  // Initialize Fuzzy membership Matrix
77 
78  numClusters = _n;
79  numVectors = _data;
80  memb.resize(numVectors);
81  for (unsigned k = 0; k < numVectors; k++)
82  {
83  std::vector <floatFeature> v;
84  v.resize(numClusters, 0);
85  memb[k] = v;
86  } // for k
87 
88 }
MM memb
Alias for Fuzzy vectors.
CodeBook(const bool &_calib=false)
Definition: code_book.h:69
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac

◆ FuzzyCodeBook() [4/5]

FuzzyCodeBook::FuzzyCodeBook ( unsigned  _n,
const ClassicTrainingVectors _ts,
const bool  _use_rand_cvs = false 
)

Constructor. Constructs a fuzzy codebook with initial code vectors taken randomly from the training file. Parameter: _n Number of vectors Parameter: _ts Training set; will be used to get initial values Parameter: _use_rand_cvs Use random code vectors (inherited from base class) It calls Base Class constructor (CodeBook)

Constructor. Constructs a codebook with initial code vectors taken randomly from the training file. Parameter: _n Number of vectors Parameter: _ts Training set; will be used to get initial values Parameter: _use_rand_cvs Use random code vectors (inherited from base class) It calls Base Class constructor (CodeBook)

Definition at line 105 of file fuzzy_code_book.cpp.

106  : CodeBook(_n, _ts, _use_rand_cvs)
107 {
108  // Initialize Fuzzy membership Matrix
109 
110  numClusters = _n;
111  numVectors = _ts.size();
112  memb.resize(numVectors);
113  std::vector <floatFeature> v;
114  v.resize(numClusters, 0);
115  for (unsigned k = 0; k < numVectors; k++)
116  {
117  memb[k] = v;
118  } // for k
119 }
MM memb
Alias for Fuzzy vectors.
CodeBook(const bool &_calib=false)
Definition: code_book.h:69
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac

◆ FuzzyCodeBook() [5/5]

FuzzyCodeBook::FuzzyCodeBook ( std::istream &  _is,
const unsigned  _size = 0 
)

Constructs a fuzzy code book given a stream Parameter: _is The input stream Parameter: _size Size of code vectors (number of data points)

Exceptions
runtime_errorIf there are problems with the stream

Definition at line 127 of file fuzzy_code_book.cpp.

128 {
129  readSelf(_is);
130  // Initialize Fuzzy membership Matrix
131 
132  numClusters = theItems.size();
133  numVectors = _size;
134  memb.clear();
135  memb.resize(numVectors);
136  for (unsigned k = 0; k < numVectors; k++)
137  {
138  std::vector <floatFeature> v;
139  v.resize(numClusters, 0);
140  memb[k] = v;
141  } // for k
142 }
MM memb
Alias for Fuzzy vectors.
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
virtual void readSelf(std::istream &_is, const unsigned _size=0)

◆ ~FuzzyCodeBook()

virtual FuzzyCodeBook::~FuzzyCodeBook ( )
inlinevirtual

Virtual destructor

Definition at line 120 of file fuzzy_code_book.h.

121  {};

Member Function Documentation

◆ alphaCore()

FuzzyCodeBook::TS FuzzyCodeBook::alphaCore ( TS  _ts,
double  _alpha,
unsigned  _cluster 
) const
virtual

Returns the alpha-core set (also called alpha-level set or simply "core") Parameter: _ts The training set Parameter: _alpha A threshold to identify the core. Parameter: _cluster The cluster or partition Returns a training vector "contained" in the cluster

Returns the alpha-core set (also called alpha-level set or simply "core") Parameter: _ts The training set Parameter: _alpha A threshold to identify the core. Parameter: _cluster The cluster or partition

Definition at line 369 of file fuzzy_code_book.cpp.

370 {
371  FuzzyCodeBook::TS _alphaSet(0, _ts.calibrated());
372 
373  _alphaSet.theItems.resize(membVectors());
374  if (_ts.calibrated())
375  _alphaSet.theTargets.resize(membVectors());
376 
377  if ((_alpha < 0) || (_alpha > 1))
378  {
379  std::ostringstream msg;
380  msg << "threshold must be in [0,1]";
381  throw std::runtime_error(msg.str());
382  }
383 
384  if ((_cluster < 0) || (_cluster >= membClusters()))
385  {
386  std::ostringstream msg;
387  msg << "Invalid cluster number";
388  throw std::runtime_error(msg.str());
389  }
390  for (unsigned k = 1; k < membVectors(); k++)
391  { // Number of input vectors
392 
393  double maxMemb = memb[k][_cluster];
394  unsigned maxIndex = _cluster; // Impossible cluster index
395  for (unsigned i = 0; i < membClusters(); i++)
396  { // Number of clusters
397  if (i != _cluster)
398  if (maxMemb < memb[k][i])
399  { // Always find the maximum
400  maxMemb = memb[k][i];
401  maxIndex = i;
402  }
403  } // for i
404 
405  if (maxIndex == _cluster && maxMemb >= _alpha) // If above threshold
406  _alphaSet.theItems[k] = _ts.theItems[k];
407  if (_ts.calibrated())
408  _alphaSet.theTargets[k] = _ts.theTargets[k];
409 
410  } // for k
411 
412  return _alphaSet;
413 }
MM memb
Alias for Fuzzy vectors.
unsigned membVectors() const
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
std::vector< Item > theItems
Definition: training_set.h:84
unsigned membClusters() const

◆ classify()

void FuzzyCodeBook::classify ( const ClassicTrainingVectors _ts)
virtual

Fills the classifVectors with the list of the best input vectors associated to it. In this case, it uses the Fuzzy Memberships to make the assignments Parameter: _ts Sample list to classify

Reimplemented from CodeBook.

Definition at line 310 of file fuzzy_code_book.cpp.

311 {
312  classifVectors.clear(); // clear previous classification.
313  classifVectors.resize(size());
314  aveDistances.clear(); // clear previous classification.
315  aveDistances.resize(size());
316 
317  for (unsigned j = 0 ; j < _ts->size() ; j++)
318  classifVectors[fuzzyTestIndex(j)].push_back(j);
319 
320  for (unsigned i = 0 ; i < size() ; i++)
321  {
322  double aveDist = 0;
323  for (unsigned j = 0 ; j < classifVectors[i].size() ; j++)
324  aveDist += euclideanDistance(theItems[i], _ts->theItems[classifVectors[i][j]]);
325  if (classifVectors[i].size() != 0)
326  aveDist /= (double) classifVectors[i].size();
327  aveDistances[i] = (double) aveDist;
328  }
329 
330 }
double euclideanDistance(const std::vector< T > &_v1, const std::vector< T > &_v2)
Definition: vector_ops.h:377
virtual unsigned fuzzyTestIndex(unsigned _in) const
#define i
std::vector< double > aveDistances
Definition: code_book.h:62
#define j
std::vector< std::vector< unsigned > > classifVectors
Definition: code_book.h:61

◆ fuzzyOutput()

unsigned FuzzyCodeBook::fuzzyOutput ( unsigned  _in) const
virtual

Returns the index of the codevector closest to an input. This is the method used to classify inputs Parameter: _in Index to the Sample to be classified

Definition at line 299 of file fuzzy_code_book.cpp.

300 {
301  return fuzzyTestIndex(_in);
302 }
virtual unsigned fuzzyTestIndex(unsigned _in) const

◆ fuzzyTest()

FeatureVector & FuzzyCodeBook::fuzzyTest ( unsigned  _in) const
virtual

Returns the code vector that represents the input in the codebook Parameter: _in Sample to classify Note: The difference between Fuzzy codevector and non-Fuzzy codevector is that the best (winner) is estimated using the fuzzy membership matrix.

Definition at line 209 of file fuzzy_code_book.cpp.

210 {
211  double maxMemb = 0;
212  unsigned best = 0;
213 
214  for (unsigned c = 0; c < membClusters(); c++)
215  {
216  if (maxMemb < memb[_in][c])
217  {
218  maxMemb = (double) memb[_in][c];
219  best = c;
220  } //if
221  } // for i
222 
223  return (FeatureVector&) theItems[best];
224 }
doublereal * c
MM memb
Alias for Fuzzy vectors.
unsigned membClusters() const
std::vector< floatFeature > FeatureVector
Definition: data_types.h:86

◆ fuzzyTestIndex()

unsigned FuzzyCodeBook::fuzzyTestIndex ( unsigned  _in) const
virtual

Returns the index to the code vector that represents the input in the codebook Parameter: _in Sample to classify Note: The difference between Fuzzy codevector and non-Fuzzy codevector is that the best (winner) is estimated using the fuzzy membership matrix.

Definition at line 233 of file fuzzy_code_book.cpp.

234 {
235  double maxMemb = 0;
236  unsigned best = 0;
237 
238  for (unsigned c = 0; c < membClusters(); c++)
239  {
240  if (maxMemb < memb[_in][c])
241  {
242  maxMemb = (double) memb[_in][c];
243  best = c;
244  } //if
245  } // for i
246 
247  return best;
248 }
doublereal * c
MM memb
Alias for Fuzzy vectors.
unsigned membClusters() const

◆ fuzzyWinner()

unsigned FuzzyCodeBook::fuzzyWinner ( unsigned  _in) const
virtual

Returns the index of the codevector closest to an input. This is the method used to classify inputs Parameter: _in Index to the Sample to be classified

Definition at line 289 of file fuzzy_code_book.cpp.

290 {
291  return fuzzyTestIndex(_in);
292 }
virtual unsigned fuzzyTestIndex(unsigned _in) const

◆ loadObject()

void FuzzyCodeBook::loadObject ( std::istream &  _is)
virtual

Loads the xmippFuzzyCodeBook class from a stream. this method can be used to load the status of the class. Parameter: _is The output stream

Loads the FuzzyCodeBook class from a stream. this method can be used to load the status of the class. Parameter: _is The output stream

Reimplemented from CodeBook.

Reimplemented in FuzzyMap.

Definition at line 483 of file fuzzy_code_book.cpp.

484 {
485  clear();
486  readMembership(_is);
488 }
virtual void readMembership(std::istream &_is)
virtual void loadObject(std::istream &_is)
Definition: code_book.cpp:478

◆ membAt()

floatFeature & FuzzyCodeBook::membAt ( unsigned  _di,
unsigned  _ci 
)

Fuctions to access the Fuzzy Membership Matrix Returns a reference to the specified item Parameter: _ci cluster index Parameter: _di data index

Exceptions
out_of_rangeIf _i is out of range

Definition at line 174 of file fuzzy_code_book.cpp.

175 {
176  std::ostringstream msg;
177  if ((_di >= membVectors()) || (_ci >= membClusters()))
178  {
179  msg << "Out of range. No item at position " << _di << "," << _ci << std::endl;
180  throw std::out_of_range(msg.str());
181  }
182 
183  return memb[_di][_ci];
184 }
MM memb
Alias for Fuzzy vectors.
unsigned membVectors() const
unsigned membClusters() const

◆ membClusters()

unsigned FuzzyCodeBook::membClusters ( ) const

Returns dimensions of the Membership matrix

Definition at line 191 of file fuzzy_code_book.cpp.

192 {
193  return numClusters;
194 }

◆ membVectors()

unsigned FuzzyCodeBook::membVectors ( ) const

Definition at line 195 of file fuzzy_code_book.cpp.

196 {
197  return numVectors;
198 }

◆ readMembership()

void FuzzyCodeBook::readMembership ( std::istream &  _is)
virtual

Reads the membership values Parameter: _is The input stream

Definition at line 432 of file fuzzy_code_book.cpp.

433 {
434  _is >> numVectors;
435  memb.resize(numVectors);
436  for (unsigned k = 0; k < numVectors; k++) // Number of input vectors
437  _is >> memb[k];
438  numClusters = memb[0].size();
439 }
MM memb
Alias for Fuzzy vectors.
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac

◆ readSelf()

void FuzzyCodeBook::readSelf ( std::istream &  _is,
const unsigned  _size = 0 
)
virtual

Constructs a fuzzy code book given a stream Parameter: _is The input stream Parameter: _size Size of code vectors (number of data points)

Exceptions
runtime_errorIf there are problems with the stream

Reimplemented in FuzzyMap.

Definition at line 460 of file fuzzy_code_book.cpp.

461 {
462  CodeBook::readSelf(_is);
463  // Initialize Fuzzy membership Matrix
464  numClusters = theItems.size();
465  numVectors = _size;
466  memb.clear();
467  memb.resize(numVectors);
468  for (size_t k = 0; k < numVectors; k++)
469  {
470  std::vector <floatFeature> v;
471  v.resize(numClusters, 0);
472  memb[k] = v;
473  } // for k
474 }
MM memb
Alias for Fuzzy vectors.
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
virtual void readSelf(std::istream &_is, long _dim=-1, long _size=-1)
Definition: code_book.cpp:370

◆ saveObject()

void FuzzyCodeBook::saveObject ( std::ostream &  _os) const
virtual

Saves the xmippFuzzyCodeBook class into a stream. this method can be used to save the status of the class. Parameter: _os The output stream

Saves the FuzzyCodeBook class into a stream. this method can be used to save the status of the class. Parameter: _os The output stream

Reimplemented from CodeBook.

Reimplemented in FuzzyMap.

Definition at line 447 of file fuzzy_code_book.cpp.

448 {
449  writeMembership(_os);
451 }
virtual void writeMembership(std::ostream &_os) const
virtual void saveObject(std::ostream &_os) const
Definition: code_book.cpp:466

◆ writeMembership()

void FuzzyCodeBook::writeMembership ( std::ostream &  _os) const
virtual

Writes the membership values Parameter: _os The output stream

Definition at line 420 of file fuzzy_code_book.cpp.

421 {
422  _os << membVectors() << std::endl;
423  for (unsigned k = 0; k < numVectors; k++) // Number of input vectors
424  _os << memb[k] << std::endl;
425 }
MM memb
Alias for Fuzzy vectors.
unsigned membVectors() const
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac

Member Data Documentation

◆ memb

MM FuzzyCodeBook::memb

Alias for Fuzzy vectors.

Definition at line 57 of file fuzzy_code_book.h.


The documentation for this class was generated from the following files: