Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
5aa65077
Commit
5aa65077
authored
Jul 30, 2015
by
Guillaume Pasero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: libSVM support confidence index
parent
458da28b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
...ning/Supervised/include/otbLibSVMMachineLearningModel.txx
+21
-0
No files found.
Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
View file @
5aa65077
...
...
@@ -74,6 +74,8 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue>
m_SVMestimator->SetTrainingSampleList(this->GetTargetListSample());
m_SVMestimator->Update();
this->m_ConfidenceIndex = m_DoProbabilityEstimates;
}
template <class TInputValue, class TOutputValue>
...
...
@@ -96,6 +98,23 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue>
{
itkExceptionMacro("Confidence index not available for this classifier !");
}
typename SVMEstimatorType::ModelType::ProbabilitiesVectorType probaVector =
m_SVMestimator->GetModel()->EvaluateProbabilities(mfunctor(input));
double maxProb = 0.0;
double secProb = 0.0;
for (unsigned int i=0 ; i<probaVector.Size() ; ++i)
{
if (maxProb < probaVector[i])
{
secProb = maxProb;
maxProb = probaVector[i];
}
else if (secProb < probaVector[i])
{
secProb = probaVector[i];
}
}
(*quality) = static_cast<ConfidenceValueType>(maxProb - secProb);
}
return target;
...
...
@@ -115,6 +134,8 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue>
::Load(const std::string & filename, const std::string & itkNotUsed(name))
{
m_SVMestimator->GetModel()->LoadModel(filename.c_str());
this->m_ConfidenceIndex = m_SVMestimator->GetModel()->HasProbabilities();
}
template <class TInputValue, class TOutputValue>
...
...
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