Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Cabieces
otb
Commits
32ae1ccf
Commit
32ae1ccf
authored
9 years ago
by
Guillaume Pasero
Browse files
Options
Downloads
Patches
Plain Diff
ENH: only save decision rule for regression mode
parent
129a9e93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx
+13
-8
13 additions, 8 deletions
...ised/include/otbKNearestNeighborsMachineLearningModel.txx
with
13 additions
and
8 deletions
Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx
+
13
−
8
View file @
32ae1ccf
...
...
@@ -145,8 +145,11 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
//Save K parameter and IsRegression flag.
ofs << "K=" << m_K << "\n";
ofs << "IsRegression=" << this->m_RegressionMode << "\n";
// Save the DecisionRule
ofs << "DecisionRule=" << m_DecisionRule << "\n";
// Save the DecisionRule if regression
if (this->m_RegressionMode)
{
ofs << "DecisionRule=" << m_DecisionRule << "\n";
}
//Save the samples. First column is the Label and other columns are the sample data.
typename InputListSampleType::ConstIterator sampleIt = this->GetInputListSample()->Begin();
...
...
@@ -190,12 +193,14 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
pos = line.find_first_of("=", 0);
nextpos = line.find_first_of(" \n\r", pos+1);
this->SetRegressionMode(boost::lexical_cast<bool>(line.substr(pos+1, nextpos-pos-1)));
//third line is the DecisionRule parameter
std::getline(ifs, line);
pos = line.find_first_of("=", 0);
nextpos = line.find_first_of(" \n\r", pos+1);
this->SetDecisionRule(boost::lexical_cast<int>(line.substr(pos+1, nextpos-pos-1)));
//third line is the DecisionRule parameter (only for regression)
if (this->m_RegressionMode)
{
std::getline(ifs, line);
pos = line.find_first_of("=", 0);
nextpos = line.find_first_of(" \n\r", pos+1);
this->SetDecisionRule(boost::lexical_cast<int>(line.substr(pos+1, nextpos-pos-1)));
}
//Clear previous listSample (if any)
typename InputListSampleType::Pointer samples = InputListSampleType::New();
typename TargetListSampleType::Pointer labels = TargetListSampleType::New();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment