Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
6d32e8c8
Commit
6d32e8c8
authored
Feb 22, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made test a little more numerically robust.
parent
5bcfa685
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
one_vs_one_trainer.cpp
dlib/test/one_vs_one_trainer.cpp
+6
-9
No files found.
dlib/test/one_vs_one_trainer.cpp
View file @
6d32e8c8
...
@@ -116,18 +116,17 @@ namespace
...
@@ -116,18 +116,17 @@ namespace
ovo_trainer
trainer
;
ovo_trainer
trainer
;
typedef
polynomial_kernel
<
sample_type
>
poly
_kernel
;
typedef
histogram_intersection_kernel
<
sample_type
>
hist
_kernel
;
typedef
radial_basis_kernel
<
sample_type
>
rbf_kernel
;
typedef
radial_basis_kernel
<
sample_type
>
rbf_kernel
;
// make the binary trainers and set some parameters
// make the binary trainers and set some parameters
krr_trainer
<
rbf_kernel
>
rbf_trainer
;
krr_trainer
<
rbf_kernel
>
rbf_trainer
;
svm_nu_trainer
<
poly_kernel
>
poly_trainer
;
svm_nu_trainer
<
hist_kernel
>
hist_trainer
;
poly_trainer
.
set_kernel
(
poly_kernel
(
0.1
,
1
,
2
));
rbf_trainer
.
set_kernel
(
rbf_kernel
(
0.1
));
rbf_trainer
.
set_kernel
(
rbf_kernel
(
0.1
));
trainer
.
set_trainer
(
rbf_trainer
);
trainer
.
set_trainer
(
rbf_trainer
);
trainer
.
set_trainer
(
poly
_trainer
,
1
,
2
);
trainer
.
set_trainer
(
hist
_trainer
,
1
,
2
);
randomize_samples
(
samples
,
labels
);
randomize_samples
(
samples
,
labels
);
matrix
<
double
>
res
=
cross_validate_multiclass_trainer
(
trainer
,
samples
,
labels
,
2
);
matrix
<
double
>
res
=
cross_validate_multiclass_trainer
(
trainer
,
samples
,
labels
,
2
);
...
@@ -143,8 +142,7 @@ namespace
...
@@ -143,8 +142,7 @@ namespace
// test using a normalized_function with a one_vs_one_decision_function
// test using a normalized_function with a one_vs_one_decision_function
{
{
poly_trainer
.
set_kernel
(
poly_kernel
(
1.1
,
1
,
2
));
trainer
.
set_trainer
(
hist_trainer
,
1
,
2
);
trainer
.
set_trainer
(
poly_trainer
,
1
,
2
);
vector_normalizer
<
sample_type
>
normalizer
;
vector_normalizer
<
sample_type
>
normalizer
;
normalizer
.
train
(
samples
);
normalizer
.
train
(
samples
);
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
...
@@ -156,8 +154,7 @@ namespace
...
@@ -156,8 +154,7 @@ namespace
DLIB_TEST
(
ndf
(
samples
[
40
])
==
labels
[
40
]);
DLIB_TEST
(
ndf
(
samples
[
40
])
==
labels
[
40
]);
DLIB_TEST
(
ndf
(
samples
[
90
])
==
labels
[
90
]);
DLIB_TEST
(
ndf
(
samples
[
90
])
==
labels
[
90
]);
DLIB_TEST
(
ndf
(
samples
[
120
])
==
labels
[
120
]);
DLIB_TEST
(
ndf
(
samples
[
120
])
==
labels
[
120
]);
poly_trainer
.
set_kernel
(
poly_kernel
(
0.1
,
1
,
2
));
trainer
.
set_trainer
(
hist_trainer
,
1
,
2
);
trainer
.
set_trainer
(
poly_trainer
,
1
,
2
);
print_spinner
();
print_spinner
();
}
}
...
@@ -173,7 +170,7 @@ namespace
...
@@ -173,7 +170,7 @@ namespace
one_vs_one_decision_function
<
ovo_trainer
,
one_vs_one_decision_function
<
ovo_trainer
,
decision_function
<
poly_kernel
>
,
// This is the output of the poly
_trainer
decision_function
<
hist_kernel
>
,
// This is the output of the hist
_trainer
decision_function
<
rbf_kernel
>
// This is the output of the rbf_trainer
decision_function
<
rbf_kernel
>
// This is the output of the rbf_trainer
>
df2
,
df3
;
>
df2
,
df3
;
...
...
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