본문 바로가기
반응형

Python46

[python] regression model의 성능 지표로 쓰일 수 있는 bland altman plot 그리기 bland altman plot을 이용해서 regression model의 성능을 확인해 볼 수 있다. bland altman 참고 : en.wikipedia.org/wiki/Bland%E2%80%93Altman_plot Bland–Altman plot - Wikipedia Bland–Altman plot example A Bland–Altman plot (difference plot) in analytical chemistry or biomedicine is a method of data plotting used in analyzing the agreement between two different assays. It is identical to a Tukey mean-difference plot,[1.. 2021. 1. 15.
[python][sklearn] scikit-learn Classification_report를 이용하여 머신 러닝 분류 모델 평가 지표 한번에 보기 sklearn 에서 classification_report module을 사용하여 평가 지표를 한번에 볼 수 있음 #1. classification_report from sklearn.metrics import classification_report y_pred = model.predict(X_test_features) print(classification_report(y_test, y_pred, target_names=['normal', 'abnormal'])) 참고 : scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html sklearn.metrics.classification_report — scikit.. 2021. 1. 15.
[python][seaborn] Grouped Boxplot, Multiple Boxplot, 그룹별 boxplot #1. source data print(df_age_error.info()) #2. seaborn import seaborn as sns sns.boxplot(y='pred-true', x='age_gp', data=df_age_error) reference : https://cmdlinetips.com/2019/03/how-to-make-grouped-boxplots-in-python-with-seaborn/ How To Make Grouped Boxplots in Python with Seaborn? - Python and R Tips Boxplots are one of the most common ways to visualize data distributions from multiple groups.. 2021. 1. 8.
[python]연속형 변수의 범주화 : Categorization 참고 : https://rfriend.tistory.com/521 #1. pd.cut()을 이용해서 continuous -> categorical 변환. #2. pd.cut(X, bins, labels) #2.1 X : dataframe, bins : bins=[미포함,포함], labels=['a'] #2.2 source data print(df_age_error) #2.3 age categorization age_cate = [18,29,39,49,59,69,80] age_cate_name = ['20','30','40','50','60','70'] df_age_error['age_gp'] = pd.cut(df_age_error['age'], bins=age_cate, labels=age_cate_na.. 2021. 1. 8.
[python][scikit-learn] KBinsDiscretizer 이용해서 Discretization 하기 scikit-learn.preprocessing 에서 KBinsDiscretizer 를 이용해서 Discretization 하기 continuous variable을 grouping 할 때 유용함 continuous 단일 column을 이용해서 grouping bins=2일때 세가지 방법 쉽게 이해하기 #1. strategy = 'uniform' #2. strategy = 'quantile' #3. strategy = 'kmeans' purpose : y_train_pd 라는 데이터프레임의 pred-true라는 column으로 grouping #0. data train_pt = pd.DataFrame(y_train_pd['pred-true']) #1. strategy = 'uniform' : mean 기.. 2020. 12. 31.
[python][matplotlib] 에러바 그리기matplotlib.pyplot.errorbar #0. 소스데이터 #1. 에러바 그리기 #plot errorbar plt.rcParams['figure.figsize']=(15,7) plt.errorbar(x=y_train_gb.index, y=y_train_gb['pred-true_mean'], yerr=y_train_gb['pred-true_std']) plt.title('mean error(pred_eGFR - true_eGFR) in trainset') plt.xlabel('round_eGFR') plt.ylabel('mean error') plt.show() 2020. 12. 30.

TOP

Designed by 티스토리