Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
caf93ade
Commit
caf93ade
authored
Jun 01, 2013
by
Davis King
Browse files
fixed grammar
parent
dc24bef4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
examples/one_class_classifiers_ex.cpp
examples/one_class_classifiers_ex.cpp
+6
-6
No files found.
examples/one_class_classifiers_ex.cpp
View file @
caf93ade
...
@@ -45,7 +45,7 @@ int main()
...
@@ -45,7 +45,7 @@ int main()
svm_one_class_trainer
<
kernel_type
>
trainer
;
svm_one_class_trainer
<
kernel_type
>
trainer
;
// Here we set the width of the radial basis kernel to 4.0. Larger values make the
// Here we set the width of the radial basis kernel to 4.0. Larger values make the
// width smaller and give the radial basis kernel more resolution. If you play with
// width smaller and give the radial basis kernel more resolution. If you play with
// the value and observe the program output
s
you get a more intuitive feel for what
// the value and observe the program output you
will
get a more intuitive feel for what
// that means.
// that means.
trainer
.
set_kernel
(
kernel_type
(
4.0
));
trainer
.
set_kernel
(
kernel_type
(
4.0
));
...
@@ -60,9 +60,9 @@ int main()
...
@@ -60,9 +60,9 @@ int main()
samples
.
push_back
(
m
);
samples
.
push_back
(
m
);
}
}
// Now train a one-class SVM. The result is a function df() that outputs large
values
// Now train a one-class SVM. The result is a function
,
df()
,
that outputs large
// for points from the sinc() curve and smaller values for points that are
anomalous or
//
values
for points from the sinc() curve and smaller values for points that are
// not on the sinc() curve in our case.
//
anomalous (i.e.
not on the sinc() curve in our case
)
.
decision_function
<
kernel_type
>
df
=
trainer
.
train
(
samples
);
decision_function
<
kernel_type
>
df
=
trainer
.
train
(
samples
);
// So for example, lets look at the output from some points on the sinc() curve.
// So for example, lets look at the output from some points on the sinc() curve.
...
@@ -132,7 +132,7 @@ int main()
...
@@ -132,7 +132,7 @@ int main()
// feature to 1. This means that if the linear SVM assigned all other weights a value
// feature to 1. This means that if the linear SVM assigned all other weights a value
// of 0 then the output from a learned decision function would always be -1. The
// of 0 then the output from a learned decision function would always be -1. The
// second step is that we ask the SVM to label each training sample with +1. This
// second step is that we ask the SVM to label each training sample with +1. This
// causes the SVM set the other feature weights such that the training samples have
// causes the SVM
to
set the other feature weights such that the training samples have
// positive outputs from the learned decision function. But the starting bias for all
// positive outputs from the learned decision function. But the starting bias for all
// the points in the whole feature space is -1. The result is that points outside our
// the points in the whole feature space is -1. The result is that points outside our
// training set will not be affected, so their outputs from the decision function will
// training set will not be affected, so their outputs from the decision function will
...
@@ -161,7 +161,7 @@ int main()
...
@@ -161,7 +161,7 @@ int main()
// The svm_c_linear_dcd_trainer is a very fast SVM solver which only works with the
// The svm_c_linear_dcd_trainer is a very fast SVM solver which only works with the
// linear_kernel. It has the nice feature of supporting this "force_last_weight_to_1"
// linear_kernel. It has the nice feature of supporting this "force_last_weight_to_1"
//
featur
e we discussed above.
//
mod
e we discussed above.
svm_c_linear_dcd_trainer
<
linear_kernel
<
sample_type
>
>
linear_trainer
;
svm_c_linear_dcd_trainer
<
linear_kernel
<
sample_type
>
>
linear_trainer
;
linear_trainer
.
force_last_weight_to_1
(
true
);
linear_trainer
.
force_last_weight_to_1
(
true
);
...
...
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