당뇨병을 분류하는 모델을 만들거다.

컬럼 정보 :

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를 설정하고, 스케일러에 대입후 데이터 분리하고 모델링 후 예측한다.

+ Recent posts