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
d86223e9
Commit
d86223e9
authored
9 years ago
by
Jordi Inglada
Browse files
Options
Downloads
Patches
Plain Diff
TEST: update old SVM regression to use new API
parent
c8184750
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
Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx
+11
-18
11 additions, 18 deletions
...Learning/Supervised/test/otbTrainMachineLearningModel.cxx
with
11 additions
and
18 deletions
Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx
+
11
−
18
View file @
d86223e9
...
...
@@ -380,20 +380,12 @@ int otbSVMMachineLearningRegressionModel(int argc, char * argv[])
SVMType
::
Pointer
classifier
=
SVMType
::
New
();
//Init SVM type in regression mode
//Available mode for regression in openCV are eps_svr and nu_svr
classifier
->
SetRegressionMode
(
1
);
classifier
->
SetSVMType
(
CvSVM
::
EPS_SVR
);
//classifier->SetSVMType(CvSVM::NU_SVR);
//P should be >0. Increasing value give better result. Need to investigate why.
classifier
->
SetP
(
10
);
//IN case you're using nu_svr you should set nu to a positive value between 0
//and 1.
//classifier->SetNu(0.9);
//Use RBF kernel.Don't know what is recommended in case of svm regression
classifier
->
SetKernelType
(
CvSVM
::
RBF
);
classifier
->
SetInputListSample
(
samples
);
classifier
->
SetTargetListSample
(
labels
);
classifier
->
Train
();
...
...
@@ -431,6 +423,7 @@ int otbSVMMachineLearningRegressionModel(int argc, char * argv[])
}
else
{
std
::
cout
<<
age
<<
"
\t
"
<<
predicted
->
GetMeasurementVector
(
0
)[
0
]
<<
"
\n
"
;
return
EXIT_FAILURE
;
}
}
...
...
@@ -446,9 +439,9 @@ int otbKNearestNeighborsMachineLearningModel(int argc, char * argv[])
{
if
(
argc
!=
3
)
{
std
::
cout
<<
"Wrong number of arguments "
<<
std
::
endl
;
std
::
cout
<<
"Usage : sample file, output file"
<<
std
::
endl
;
return
EXIT_FAILURE
;
std
::
cout
<<
"Wrong number of arguments "
<<
std
::
endl
;
std
::
cout
<<
"Usage : sample file, output file"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
typedef
otb
::
KNearestNeighborsMachineLearningModel
<
InputValueType
,
TargetValueType
>
KNearestNeighborsType
;
...
...
@@ -527,11 +520,11 @@ int otbRandomForestsMachineLearningModelNew(int itkNotUsed(argc), char * itkNotU
int
otbRandomForestsMachineLearningModel
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
3
)
{
{
std
::
cout
<<
"Wrong number of arguments "
<<
std
::
endl
;
std
::
cout
<<
"Usage : sample file, output file "
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
}
typedef
otb
::
RandomForestsMachineLearningModel
<
InputValueType
,
TargetValueType
>
RandomForestType
;
InputListSampleType
::
Pointer
samples
=
InputListSampleType
::
New
();
...
...
@@ -619,9 +612,9 @@ int otbBoostMachineLearningModel(int argc, char * argv[])
{
if
(
argc
!=
3
)
{
std
::
cout
<<
"Wrong number of arguments "
<<
std
::
endl
;
std
::
cout
<<
"Usage : sample file, output file "
<<
std
::
endl
;
return
EXIT_FAILURE
;
std
::
cout
<<
"Wrong number of arguments "
<<
std
::
endl
;
std
::
cout
<<
"Usage : sample file, output file "
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
typedef
otb
::
BoostMachineLearningModel
<
InputValueType
,
TargetValueType
>
BoostType
;
...
...
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