Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scikit-learn
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
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
Ian Johnson
scikit-learn
Commits
1a5f412d
Commit
1a5f412d
authored
14 years ago
by
Fabian Pedregosa
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Update svm examples affected by latest API changes."
This reverts commit
8606d6f0
.
parent
ca5c6ac1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/svm/plot_separating_hyperplane.py
+4
-7
4 additions, 7 deletions
examples/svm/plot_separating_hyperplane.py
with
4 additions
and
7 deletions
examples/svm/plot_separating_hyperplane.py
+
4
−
7
View file @
1a5f412d
"""
===========================================
SVM: Maximum
margin
separating hyperplane
SVM: Maximum separating
margin
hyperplane
===========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a Support Vector Machines classifier with
linear kernel.
"""
import
numpy
as
np
...
...
@@ -29,9 +26,9 @@ yy = a*xx - (clf.intercept_[0])/w[1]
# plot the parallels to the separating hyperplane that pass through the
# support vectors
b
=
clf
.
support_
vectors_
[
0
]
b
=
clf
.
support_
[
0
]
yy_down
=
a
*
xx
+
(
b
[
1
]
-
a
*
b
[
0
])
b
=
clf
.
support_
vectors_
[
-
1
]
b
=
clf
.
support_
[
-
1
]
yy_up
=
a
*
xx
+
(
b
[
1
]
-
a
*
b
[
0
])
# plot the line, the points, and the nearest vectors to the plane
...
...
@@ -40,7 +37,7 @@ pl.plot(xx, yy, 'k-')
pl
.
plot
(
xx
,
yy_down
,
'
k--
'
)
pl
.
plot
(
xx
,
yy_up
,
'
k--
'
)
pl
.
scatter
(
X
[:,
0
],
X
[:,
1
],
c
=
Y
)
pl
.
scatter
(
clf
.
support_
vectors_
[:,
0
],
clf
.
support_
vectors_
[:,
1
],
c
=
'
white
'
)
pl
.
scatter
(
clf
.
support_
[:,
0
],
clf
.
support_
[:,
1
],
marker
=
'
+
'
)
pl
.
axis
(
'
tight
'
)
pl
.
show
()
...
...
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