Skip to content
Snippets Groups Projects
Commit f68bd295 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

Modif sur otbModel

parent e12e4461
No related branches found
No related tags found
No related merge requests found
...@@ -435,7 +435,7 @@ public: ...@@ -435,7 +435,7 @@ public:
return m_Model->sv_coef; return m_Model->sv_coef;
} }
/** Set the alphas values (SV Coef) */ /** Set the alphas values (SV Coef) */
void SetAlpha( double ** alpha ); void SetAlpha( double ** alpha, int nbOfSupportVector );
/** Return the labels lists */ /** Return the labels lists */
int * GetLabels(){ return m_Model->label; }; int * GetLabels(){ return m_Model->label; };
......
...@@ -243,7 +243,6 @@ SVMModel<TInputPixel, TLabel> ...@@ -243,7 +243,6 @@ SVMModel<TInputPixel, TLabel>
// Compute the total number of SV elements. // Compute the total number of SV elements.
unsigned int elements = 0; unsigned int elements = 0;
// std::cout<<nbOfSupportVector<<std::endl;
for (int p=0; p<nbOfSupportVector; p++) for (int p=0; p<nbOfSupportVector; p++)
{ {
std::cout<<p<<" "; std::cout<<p<<" ";
...@@ -251,13 +250,11 @@ SVMModel<TInputPixel, TLabel> ...@@ -251,13 +250,11 @@ SVMModel<TInputPixel, TLabel>
std::cout<<p<<" "; std::cout<<p<<" ";
while(tempNode->index != -1) while(tempNode->index != -1)
{ {
//std::cout<<tempNode->value<<std::endl;
tempNode++; tempNode++;
elements++; elements++;
} }
elements++;// for -1 values elements++;// for -1 values
} }
std::cout<<std::endl;
if(m_Model->l>0) if(m_Model->l>0)
{ {
...@@ -287,11 +284,10 @@ SVMModel<TInputPixel, TLabel> ...@@ -287,11 +284,10 @@ SVMModel<TInputPixel, TLabel>
this->Modified(); this->Modified();
} }
// BEFORE CALLING THE METHOD, CHANGE l VALUE
template <class TInputPixel, class TLabel > template <class TInputPixel, class TLabel >
void void
SVMModel<TInputPixel, TLabel> SVMModel<TInputPixel, TLabel>
::SetAlpha( double ** alpha ) ::SetAlpha( double ** alpha, int nbOfSupportVector )
{ {
// Erase the old sv_coef // Erase the old sv_coef
for(int i=0; i<m_Model->nr_class-1; i++) for(int i=0; i<m_Model->nr_class-1; i++)
...@@ -300,6 +296,8 @@ SVMModel<TInputPixel, TLabel> ...@@ -300,6 +296,8 @@ SVMModel<TInputPixel, TLabel>
} }
delete [] m_Model->sv_coef; delete [] m_Model->sv_coef;
this->SetNumberOfSupportVectors(nbOfSupportVector);
// copy new sv_coef values // copy new sv_coef values
m_Model->sv_coef = Malloc(double *,m_Model->nr_class-1); m_Model->sv_coef = Malloc(double *,m_Model->nr_class-1);
for(int i=0; i<m_Model->nr_class-1; i++) for(int i=0; i<m_Model->nr_class-1; i++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment