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
David Youssefi
otb
Commits
db5a0584
Commit
db5a0584
authored
14 years ago
by
Jordi Inglada
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: clean code a little bit
parent
0519abd5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Learning/otbDecisionTree.txx
+72
-68
72 additions, 68 deletions
Code/Learning/otbDecisionTree.txx
with
72 additions
and
68 deletions
Code/Learning/otbDecisionTree.txx
+
72
−
68
View file @
db5a0584
...
...
@@ -108,28 +108,28 @@ DecisionTree<AttributeValueType, LabelType>
DecisionTreeTestType theTest = theKey.second;
AttributeValueType theValue = theKey.first;
switch( theTest )
{
case LT:
if( attrValue < theValue )
return lmIt->second;
break;
case LE:
if( attrValue <= theValue )
return lmIt->second;
break;
case EQ:
if( attrValue == theValue )
return lmIt->second;
break;
case GE:
if( attrValue >= theValue )
return lmIt->second;
break;
case GT:
if( attrValue > theValue )
return lmIt->second;
break;
}
{
case LT:
if( attrValue < theValue )
return lmIt->second;
break;
case LE:
if( attrValue <= theValue )
return lmIt->second;
break;
case EQ:
if( attrValue == theValue )
return lmIt->second;
break;
case GE:
if( attrValue >= theValue )
return lmIt->second;
break;
case GT:
if( attrValue > theValue )
return lmIt->second;
break;
}
++lmIt;
}
...
...
@@ -151,58 +151,62 @@ DecisionTree<AttributeValueType, LabelType>
DecisionTreeTestType theTest = theKey.second;
AttributeValueType theValue = theKey.first;
switch( theTest )
{
case LT:
if( attrValue < theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case LE:
if( attrValue <= theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case EQ:
if( attrValue == theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case GE:
if( attrValue >= theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case GT:
if( attrValue > theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
}
{
case LT:
if( attrValue < theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case LE:
if( attrValue <= theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case EQ:
if( attrValue == theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case GE:
if( attrValue >= theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
case GT:
if( attrValue > theValue )
{
candidateKeys.push_back( theKey );
found = true;
}
break;
}
++tmIt;
}
if( ! found ) // attribute
// not found
// in the map
// not found
// in the map
{
itkGenericExceptionMacro(<< "Example could not be handled by decision tree.");
// If we found one or several matching tests
typename std::vector< KeyType >::const_iterator ckIt = candidateKeys.begin();
while ( ckIt != candidateKeys.end() )
}
else
{
std::cout << (*ckIt).first << " " << (*ckIt).second << std::endl;
Pointer child = (*m_TreeMap)[(*ckIt)];
return child->Decide(example);
// If we found one or several matching tests
typename std::vector< KeyType >::const_iterator ckIt = candidateKeys.begin();
while ( ckIt != candidateKeys.end() )
{
std::cout << (*ckIt).first << " " << (*ckIt).second << std::endl;
Pointer child = (*m_TreeMap)[(*ckIt)];
return child->Decide(example);
}
}
}
...
...
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