-
from sklearn import datasets, svm, metrics, neighbors, model_selection, metrics import joblib import matplotlib.pyplot as plt digits = datasets.load_digits() x = digits.images y = digits.target x = x.reshape(-1,64) # Reshape() 관련 참고: https://infos.tistory.com/3577 trainX, testX, trainY, testY = model_selection.train_test_split(x,y, test_size=0.2) clf = svm.LinearSVC() clf.fit(trainX, trainY) predY = clf.predict(testX) print(f"accuracy: {metrics.accuracy_score(testY, predY)}") # 학습 상태 저장 #joblib.dump(clf, 'digits.pkl') # 학습 상태 읽기 #clf = joblib.load('digits.pkl')
학습내용 저장하여
불러와 테스트 : https://infos.tistory.com/3580
'Python' 카테고리의 다른 글
Opencv 윤곽 검출 (0) 2021.04.12 Opencv boundingRect (0) 2021.04.12 Python ScikitLearn 손글씨 숫자 인식 2 (0) 2021.04.12 Python Random 난수 생성기 (0) 2021.04.12 Python numpy.reshape (0) 2021.04.12 ScikitLearn 내장 손글씨 숫자 (0) 2021.04.12 OpenCv haarcascades 얼굴인식 (0) 2021.04.12 Python Scikit-Learn LinearSVC And학습 (0) 2021.04.12