You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
549 B

4 years ago
# Example<6C><65>
from sklearn import datasets
import numpy
from numpy import *
from sklearn import svm
print ('''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>''')
digits = datasets.load_digits()
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>digits<74><73><EFBFBD>ݼ<EFBFBD><DDBC>У<EFBFBD>digits.data<74>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
print(digits.data,"type(digits.data)=%s"%type(digits.data))
print("shape(digits.data)=%s,%s"%shape(digits.data))
print (digits.target)
print ('''ѵ<><D1B5><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4>''')
#ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
clf = svm.SVC(gamma=0.0001,C=100)
# <20><><EFBFBD><EFBFBD>ѵ<EFBFBD><D1B5>
clf.fit(digits.data[:-1],digits.target[:-1])
# <20><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4>
print (clf.predict(digits.data[:-1]))