[동계인턴십] 암 예측 2
features=['STOMA','COLON','LIVER','LUNG','PROST','THROI','BREAC','RECTM'] y_df =df['LUNG'] X_df =df.drop(features, axis=1) from sklearn.model_selection import train_test_split X_train,X_test,y_train,y_test = train_test_split(X_df,y_df,test_size=0.2) from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegress..
2022. 1. 11.
[#3]데이터 전처리
데이터 인코딩 from sklearn.preprocessing import LabelEncoder items=['TV','냉장고','전자레인지','컴퓨터','선풍기','선풍기','믹서','믹서'] #LabelEncoder를 객체로 생성한 후, fit()과 transform()으로 레이블 인코딩 수행 encoder=LabelEncoder() encoder.fit(items) labels=encoder.transform(items) print('인코딩 변환값:',labels) print('인코딩 클래스:',encoder.classes_) print('디코딩 원본값:',encoder.inverse_transform([4,5,2,0,1,1,3,3])) 원-핫 인코딩(One-Hot Encoding) 각 속성을 분..
2022. 1. 1.