파이썬 머신러닝 선형회귀 및 평가 sklearn - LinearRegression
1. 데이터 분리 머신러닝을 위해서는 기본적으로 타겟 데이터와 변수들을 분리해야한다 x = data.drop(target, axis=1) y = data[target] 코드로 변수 x와 y에 각각 변수 데이터와 타겟 데이터를 넣어주었다 여기서 target은 데이터프레임에서 결과값의 인덱스명이다 다음으로 학습에 사용할 데이터를 분리한다 from sklearn.model_selection import train_test_split x_train, x_test, y_train, y_test = train_test_split(x,y,test_size=0.3 ,random_state=1 , stratify= ) train_test_split을 임포트하고 x,y 데이터와, 해당 데이터에서 이후 테스트에 사용할 데이..
2023. 9. 11.