Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
898734b9
Commit
898734b9
authored
Apr 20, 2017
by
Guillaume Pasero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: svm_predict_probabilities() and svm_predict() don't give the same labels
parent
e38ade22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
...ning/Supervised/include/otbLibSVMMachineLearningModel.txx
+13
-1
No files found.
Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
View file @
898734b9
...
...
@@ -183,7 +183,19 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue>
}
else
{
target[0] = static_cast<TargetValueType>(svm_predict(m_Model, x));
// default case : if the model has probabilities, we call svm_predict_probabilities()
// which gives different results than svm_predict()
if (svm_check_probability_model(m_Model))
{
unsigned int nr_class = svm_get_nr_class(m_Model);
double *prob_estimates = new double[nr_class];
target[0] = static_cast<TargetValueType>(svm_predict_probability(m_Model, x, prob_estimates));
delete[] prob_estimates;
}
else
{
target[0] = static_cast<TargetValueType>(svm_predict(m_Model, x));
}
}
// Free allocated memory
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment