QDA2 Discriminant analysis(판별 분석) [Discriminant Analysis 이용 당뇨병 환자 예측] (4) 1. DatasetTrain Testx_train = train.drop(['Diabetes'], axis=1)y_train = train['Diabetes']x_test = test 2. LDA# LDAfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysisfrom sklearn.metrics import accuracy_scorecld = LinearDiscriminantAnalysis()cld.fit(x_train, y_train)y_train_pred = cld.predict(x_train)y_test_cld_pred = cld.predict(x_test)print(accuracy_score(y_train, y_train_pred).. 2024. 3. 31. Discriminant analysis(판별 분석) [Discriminant Analysis 이용 원자력발전소 상태 예측] (3) LDA# LDAfrom sklearn.discriminant_analysis import LinearDiscriminantAnalysisfrom sklearn.metrics import accuracy_score, confusion_matrixcld = LinearDiscriminantAnalysis()cld.fit(x_train, y_train)y_train_pred = cld.predict(x_train)y_test_cld_pred = cld.predict(x_test)print(accuracy_score(y_train,y_train_pred))QDA# QDAfrom sklearn.discriminant_analysis import QuadraticDiscriminantAnalysisfrom skle.. 2024. 3. 31. 이전 1 다음