Commit a6ca8195 authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: expose method to check if SVM model has probability estimates

parent 18a51239
......@@ -307,6 +307,12 @@ public:
return static_cast<bool>(m_Parameters.probability);
/** Test if the model has probabilities */
bool HasProbabilities(void) const
return static_cast<bool>(svm_check_probability_model(m_Model));
/** Return number of support vectors */
int GetNumberOfSupportVectors(void) const
......@@ -464,7 +464,7 @@ SVMModel<TValue, TLabel>::EvaluateProbabilities(const MeasurementType& measure)
itkExceptionMacro(<< "Model is not up-to-date, can not predict probabilities");
if (svm_check_probability_model(m_Model) == 0)
if (!this->HasProbabilities())
throw itk::ExceptionObject(__FILE__, __LINE__,
"Model does not support probability estimates", ITK_LOCATION);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment