GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pythonForMachineLearning/SVM1.py at master · daacheng/pythonForMachineLearning

Expand file tree

/

SVM1.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
10 lines (10 loc) · 375 Bytes
/

SVM1.py

Copy path

File metadata and controls

10 lines (10 loc) · 375 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
from sklearn import svm
x=[[2,0],[1,1],[2,3]]#特征向量
y=[0,0,1]#特征对应的label
clf=svm.SVC(kernel='linear')
clf.fit(x,y)
print(clf)
print(clf.support_vectors_)#支持向量
print(clf.support_)#支持向量在x中的索引
print(clf.n_support_)#针对每个标签label找到了几个支持向量
print(clf.predict([[2,0]]))#预测这个点属于哪一类标签label
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.