64 template<
typename TCModel>
71 typedef typename TCModel::FV_type
FV;
75 :_owningSupportVectors(false),
85 :_collectedSupportVectors( orig._collectedSupportVectors),
86 _classIndexToLabel( orig._classIndexToLabel),
87 _owningSupportVectors( false),
88 _maxUniqueID( orig._maxUniqueID)
94 _collectedSupportVectors = orig._collectedSupportVectors;
95 _classIndexToLabel = orig._classIndexToLabel;
96 _owningSupportVectors =
false;
97 _maxUniqueID = orig._maxUniqueID;
105 if( size != _collectedSupportVectors.size())
107 _collectedSupportVectors.resize( size);
115 if( _owningSupportVectors)
117 for(
unsigned int i = 0; i < _collectedSupportVectors.size(); ++i)
119 delete _collectedSupportVectors[i];
120 _collectedSupportVectors[i] = 0;
123 _owningSupportVectors =
false;
130 return _collectedSupportVectors;
142 _classIndexToLabel = v;
147 SVM_ASSERT( classIndex < _classIndexToLabel.size());
148 return _classIndexToLabel[classIndex];
165 const std::vector<char>& leaveOutFlagsByUID)
const 167 for(
unsigned int i = 0; i < _collectedSupportVectors.size(); ++i)
169 unsigned int uid = _collectedSupportVectors[i]->uniqueID();
172 if( leaveOutFlagsByUID[uid] == 1)
return true;
180 return _collectedSupportVectors;
184 template<
typename ForwardIter>
186 const ForwardIter& modelsEnd);
189 template<
typename STDATA>
192 template<
typename STDATA>
195 template<
typename ForwardIter,
typename STDATA>
197 const ForwardIter& modelsBegin,
const ForwardIter& modelsEnd,
204 std::vector<FV*> _collectedSupportVectors;
205 std::vector<double> _classIndexToLabel;
206 bool _owningSupportVectors;
207 unsigned int _maxUniqueID;
214 #include "Model_MC.icc"
unsigned int maxUniqueID() const
void freeCollectedSupportVectors()
const std::vector< FV * > & collectedSupportVectors() const
#define SVM_ASSERT(condition)
Ensure that TCMODEL provides minimal functions to be used With Multiclass-Algortithms.
double classIndexToLabel(unsigned int classIndex) const
void collectSupportVectorsFromTCModels(const ForwardIter &modelsBegin, const ForwardIter &modelsEnd)
#define CHECK_CLASS_TEMPLATE1(c)
void setClassIndizesToLabels(const std::vector< double > &v)
bool isModelAffectedByLeftOutVectors(const std::vector< char > &leaveOutFlagsByUID) const
check, if this model is affected by specified left out vectors, which means, that it needs to be retr...
std::vector< FV * > getSupportVectors() const
void saveSupportVectorsAndClassLabels(STDATA &stData) const
Model_MC< TCModel > & operator=(const Model_MC< TCModel > &orig)
Model_MC(const Model_MC< TCModel > &orig)
void resizeCollectedSupportVectors(unsigned int size)
void loadSupportVectorsAndClassLabels(STDATA &stData)
void calcTrainingStatisticsFromTCModels(const ForwardIter &modelsBegin, const ForwardIter &modelsEnd, STDATA &statistics)