def roc_curve_plot() 함수 코드
def roc_curve_plot(y_test, pred_proba_c1): fprs, tprs, thresholds = roc_curve(y_test, pred_proba_c1) plt.plot(fprs, tprs, label='ROC') plt.plot([0,1], [0,1], 'k--', label='Random') start, end = plt.xlim() plt.xticks(np.round(np.arange(start, end, 0.1), 2)) plt.xlim(0,1);plt.ylim(0,1) plt.xlabel('FPR( 1 - sensitivity )'); plt.ylabel('TPR( Recall )') plt.legend()
2022. 1. 17.
def get_clf_eval() 함수 코드
from sklearn.metrics import accuracy_score, precision_score, recall_score, confusion_matrix, f1_score, roc_auc_score from sklearn.metrics import roc_curve def get_clf_eval(y_test, pred=None, pred_proba=None): confusion = confusion_matrix(y_test, pred) accuracy= accuracy_socre(y_test, pred) precision = precision_score(y_test, pred) recall = recall_score(y_test, pred) f1 = f1_score(y_test, pred) r..
2022. 1. 17.
시계열 데이터 - 슬라이더로 살펴보기
전처리 과정에서, 시계열 데이터를 살펴볼때 아래와 같이 slider 를 사용하면 missing-data 를 찾거나, 경향성 파악에 크게 도움이 된다. 코드 df.reset_index(inplace=True) import plotly.express as px fig=px.line(df, x='Date', y='Tair_C', title='Tair_Cm with slider') fig.update_xaxes( rangeslider_visible=True, rangeselector=dict( buttons=list([ dict(count=1, label="1m", step="month", stepmode="backward"), dict(count=2, label="3m", step="month", stepmo..
2022. 1. 14.