Machine Learning/선형 분류

[머신러닝] 선형분류 실습 _ <손글씨 데이터 예측(1)>

숭어싸만코 2022. 9. 21. 16:57

필요한 라이브러리 불러오기

import numpy as np
import pandas as pd 
import matplotlib.pyplot as plt 
from sklearn.model_selection import train_test_split   
from sklearn.linear_model import LogisticRegression     # 로지스틱 모델
from sklearn.svm import LinearSVC                       # 선형 SVM모델
from sklearn.metrics import classification_report       # 종합평가 함수

 


kaggle 홈페이지에서 받아온 데이터 (Digit Recognizer) 로딩 및 탐색

 

- data를

문제 (X ) 와 정답 ( y ) 으로 분리하기

 

 

 

 

데이터의 분포 확인과 시각화 하기


모델 생성과 교차검증 하기

 

LogisticRegression() 과 LinearSVC() 생성

 

두개의 모델 모두 교차검증 진행

LogisticRegression 검증값

LinearSVC 검증값


데이터 학습 후 kaggle 양식 불러오기


결과