Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.libsvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
bob
bob.learn.libsvm
Commits
0b720f7f
Commit
0b720f7f
authored
9 years ago
by
Artur Costa Pazo
Browse files
Options
Downloads
Patches
Plain Diff
Fix error on OC-SVM documentation example code on py 3.x caused by reused variables.
parent
4607ce8d
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
doc/guide.rst
+10
-10
10 additions, 10 deletions
doc/guide.rst
with
10 additions
and
10 deletions
doc/guide.rst
+
10
−
10
View file @
0b720f7f
...
@@ -161,8 +161,8 @@ On the other hand, the package allows you to train a One Class Support Vector Ma
...
@@ -161,8 +161,8 @@ On the other hand, the package allows you to train a One Class Support Vector Ma
:options: +NORMALIZE_WHITESPACE
:options: +NORMALIZE_WHITESPACE
>>> oc_pos = 0.4 * numpy.random.randn(100, 2).astype(numpy.float64)
>>> oc_pos = 0.4 * numpy.random.randn(100, 2).astype(numpy.float64)
>>> data = [oc_pos]
>>>
oc_
data = [oc_pos]
>>> print(data) # doctest: +SKIP
>>> print(
oc_
data) # doctest: +SKIP
As the above example, an SVM [1]_ for one class problem can be trained easily using the
As the above example, an SVM [1]_ for one class problem can be trained easily using the
...
@@ -171,20 +171,20 @@ As the above example, an SVM [1]_ for one class problem can be trained easily us
...
@@ -171,20 +171,20 @@ As the above example, an SVM [1]_ for one class problem can be trained easily us
.. doctest::
.. doctest::
:options: +NORMALIZE_WHITESPACE
:options: +NORMALIZE_WHITESPACE
>>> trainer = bob.learn.libsvm.Trainer(machine_type='ONE_CLASS')
>>>
oc_
trainer = bob.learn.libsvm.Trainer(machine_type='ONE_CLASS')
>>> machine = trainer.train(data)
>>>
oc_
machine =
oc_
trainer.train(
oc_
data)
Then, as explained before, a :py:class:`bob.learn.libsvm.Machine` can be used for classify the new entries.
Then, as explained before, a :py:class:`bob.learn.libsvm.Machine` can be used for classify the new entries.
.. doctest::
.. doctest::
:options: +NORMALIZE_WHITESPACE
:options: +NORMALIZE_WHITESPACE
>>> test = 0.4 * numpy.random.randn(20, 2).astype(numpy.float64)
>>>
oc_
test = 0.4 * numpy.random.randn(20, 2).astype(numpy.float64)
>>> outliers = numpy.random.uniform(low=-4, high=4, size=(20, 2)).astype(numpy.float64)
>>>
oc_
outliers = numpy.random.uniform(low=-4, high=4, size=(20, 2)).astype(numpy.float64)
>>> predicted_label_test = machine(test)
>>> predicted_label_
oc_
test =
oc_
machine(
oc_
test)
>>> predicted_label_outliers = machine(outliers)
>>> predicted_label_
oc_
outliers =
oc_
machine(
oc_
outliers)
>>> print(predicted_label_test) # doctest: +SKIP
>>> print(predicted_label_
oc_
test) # doctest: +SKIP
>>> print(predicted_label_outliers) # doctest: +SKIP
>>> print(predicted_label_
oc_
outliers) # doctest: +SKIP
Acknowledgements
Acknowledgements
...
...
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