당뇨병을 분류하는 모델을 만들거다.
컬럼 정보 :
Preg=no. of pregnancy
Plas=Plasma
Pres=blood pressure
skin=skin thickness
test=insulin test
mass=body mass
pedi=diabetes pedigree function
age=age
class=target(diabetes of not, 1:diabetic, 0:not diabetic)
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
그런데 몇몇 column에 0이 들어가는 것은 이상하다. 아마 nan값을 0으로 넣은 것 같다. 0을 replace함수로 nan값으로 바꾸고 처리하겠다.
NaN을 없애는 전략은 dropna함수로 Nan을 다른 값으로 채우는 전략은 fillna함수를 이용한다. 이예제에서는 평균값으로 채우겠다.
y를 설정하고, 스케일러에 대입후 데이터 분리하고 모델링 후 예측한다.
'인공지능 > 머신러닝' 카테고리의 다른 글
머신러닝 Support Vector Machine (0) | 2022.05.09 |
---|---|
머신러닝 K-Nearest Neighbor KNN (0) | 2022.05.09 |
머신러닝 Logistic Regression 과 Confusion Matrix (0) | 2022.05.06 |
머신러닝 Linear Regression fit_transform,transform 함수 , 신규데이터 예측하는 법 (0) | 2022.05.06 |
머신러닝 feature scaling 2가지 방법 StandardScaler, MinMaxScaler (0) | 2022.05.06 |