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
b4722fba
Commit
b4722fba
authored
14 years ago
by
OTB Bot
Browse files
Options
Downloads
Patches
Plain Diff
STYLE
parent
4885a539
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Learning/otbDecisionTree.txx
+64
-64
64 additions, 64 deletions
Code/Learning/otbDecisionTree.txx
with
64 additions
and
64 deletions
Code/Learning/otbDecisionTree.txx
+
64
−
64
View file @
b4722fba
...
@@ -108,28 +108,28 @@ DecisionTree<AttributeValueType, LabelType>
...
@@ -108,28 +108,28 @@ DecisionTree<AttributeValueType, LabelType>
DecisionTreeTestType theTest = theKey.second;
DecisionTreeTestType theTest = theKey.second;
AttributeValueType theValue = theKey.first;
AttributeValueType theValue = theKey.first;
switch( theTest )
switch( theTest )
{
{
case LT:
case LT:
if( attrValue < theValue )
if( attrValue < theValue )
return lmIt->second;
return lmIt->second;
break;
break;
case LE:
case LE:
if( attrValue <= theValue )
if( attrValue <= theValue )
return lmIt->second;
return lmIt->second;
break;
break;
case EQ:
case EQ:
if( attrValue == theValue )
if( attrValue == theValue )
return lmIt->second;
return lmIt->second;
break;
break;
case GE:
case GE:
if( attrValue >= theValue )
if( attrValue >= theValue )
return lmIt->second;
return lmIt->second;
break;
break;
case GT:
case GT:
if( attrValue > theValue )
if( attrValue > theValue )
return lmIt->second;
return lmIt->second;
break;
break;
}
}
++lmIt;
++lmIt;
}
}
...
@@ -150,43 +150,43 @@ DecisionTree<AttributeValueType, LabelType>
...
@@ -150,43 +150,43 @@ DecisionTree<AttributeValueType, LabelType>
DecisionTreeTestType theTest = theKey.second;
DecisionTreeTestType theTest = theKey.second;
AttributeValueType theValue = theKey.first;
AttributeValueType theValue = theKey.first;
switch( theTest )
switch( theTest )
{
{
case LT:
case LT:
if( attrValue < theValue )
if( attrValue < theValue )
{
{
candidateKeys.push_back( theKey );
candidateKeys.push_back( theKey );
found = true;
found = true;
}
}
break;
break;
case LE:
case LE:
if( attrValue <= theValue )
if( attrValue <= theValue )
{
{
candidateKeys.push_back( theKey );
candidateKeys.push_back( theKey );
found = true;
found = true;
}
}
break;
break;
case EQ:
case EQ:
if( attrValue == theValue )
if( attrValue == theValue )
{
{
candidateKeys.push_back( theKey );
candidateKeys.push_back( theKey );
found = true;
found = true;
}
}
break;
break;
case GE:
case GE:
if( attrValue >= theValue )
if( attrValue >= theValue )
{
{
candidateKeys.push_back( theKey );
candidateKeys.push_back( theKey );
found = true;
found = true;
}
}
break;
break;
case GT:
case GT:
if( attrValue > theValue )
if( attrValue > theValue )
{
{
candidateKeys.push_back( theKey );
candidateKeys.push_back( theKey );
found = true;
found = true;
}
}
break;
break;
}
}
++tmIt;
++tmIt;
}
}
...
@@ -201,11 +201,11 @@ DecisionTree<AttributeValueType, LabelType>
...
@@ -201,11 +201,11 @@ DecisionTree<AttributeValueType, LabelType>
// If we found one or several matching tests
// If we found one or several matching tests
typename std::vector< KeyType >::const_iterator ckIt = candidateKeys.begin();
typename std::vector< KeyType >::const_iterator ckIt = candidateKeys.begin();
while ( ckIt != candidateKeys.end() )
while ( ckIt != candidateKeys.end() )
{
{
std::cout << (*ckIt).first << " " << (*ckIt).second << std::endl;
std::cout << (*ckIt).first << " " << (*ckIt).second << std::endl;
Pointer child = (*m_TreeMap)[(*ckIt)];
Pointer child = (*m_TreeMap)[(*ckIt)];
return child->Decide(example);
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