Skip to content

Commit

Permalink
노트북 번역
Browse files Browse the repository at this point in the history
  • Loading branch information
rickiepark committed Jul 15, 2021
1 parent daf8071 commit 302c78b
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 78 deletions.
54 changes: 27 additions & 27 deletions notebooks/comparing_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Comparing models\n",
"# 모델 비교\n",
"\n",
"In this notebook, we will compare the three models we've trained using:\n",
"이 노트북에서 다음을 사용해 훈련한 세 개의 모델을 비교해 보겠습니다:\n",
"\n",
"- Aggregate metrics\n",
"- Performance visualizations\n",
"- Dataset visualization\n",
"- 요약 지표\n",
"- 성능 시각화\n",
"- 데이터셋 시각화\n",
"\n",
"First, we load data and the three existing models."
"먼저 데이터와 세 개의 모델을 로드합니다."
]
},
{
Expand Down Expand Up @@ -70,7 +70,7 @@
"clf_2 = joblib.load(Path(\"../models/model_2.pkl\"))\n",
"vectorizer_2 = joblib.load(Path(\"../models/vectorizer_2.pkl\")) \n",
"\n",
"# clf_3 does not vectorize text\n",
"# clf_3는 텍스트를 벡터로 변환하지 않습니다\n",
"clf_3 = joblib.load(Path(\"../models/model_3.pkl\")) "
]
},
Expand All @@ -87,7 +87,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We then score the test data using all three models."
"그다음 세 개의 모델을 사용해 테스트 세트의 점수를 얻습니다."
]
},
{
Expand Down Expand Up @@ -146,9 +146,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Comparing accuracy\n",
"## 정확도 비교\n",
"\n",
"First, we can compare aggregate scores"
"먼저 요약 지표를 비교할 수 있습니다."
]
},
{
Expand All @@ -168,32 +168,32 @@
],
"source": [
"def get_metrics(y_test, y_predicted): \n",
" # true positives / (true positives+false positives)\n",
" # 진짜 양성 / (진짜 양성 + 거짓 양성)\n",
" precision = precision_score(y_test, y_predicted, pos_label=True,\n",
" average='binary') \n",
" # true positives / (true positives + false negatives)\n",
" # 진짜 양성 / (진짜 양성 + 거짓 음성)\n",
" recall = recall_score(y_test, y_predicted, pos_label=True,\n",
" average='binary')\n",
" \n",
" # harmonic mean of precision and recall\n",
" # 정밀도와 재현율의 조화 평균\n",
" f1 = f1_score(y_test, y_predicted, pos_label=True, average='binary')\n",
" \n",
" # true positives + true negatives/ total\n",
" # (진짜 양성 + 진짜 음성)/ 전체\n",
" accuracy = accuracy_score(y_test, y_predicted)\n",
" return accuracy, precision, recall, f1\n",
"\n",
"for i, y_predicted in enumerate([clf1_predicted, clf2_predicted, clf3_predicted]):\n",
" accuracy, precision, recall, f1 = get_metrics(y_test, y_predicted)\n",
" print(\"Model %s: Validation accuracy = %.3f, precision = %.3f, recall = %.3f, f1 = %.3f\" % ((i+1), accuracy, precision, recall, f1))"
" print(\"모델 %s: 검증 정확도 = %.3f, 정밀도 = %.3f, 재현율 = %.3f, f1 = %.3f\" % ((i+1), accuracy, precision, recall, f1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Comparing feature importance\n",
"## 특성 중요도 비교하기\n",
"\n",
"Let's look at which features each model leverages next."
"각 모델이 어떤 특성을 활용하는지 알아 보죠."
]
},
{
Expand All @@ -203,10 +203,10 @@
"outputs": [],
"source": [
"def display_importance(clf, feature_names, k=10):\n",
" print(\"Top %s importances:\\n\" % k)\n",
" print(\"상위 %s개의 중요도:\\n\" % k)\n",
" print('\\n'.join([\"%s: %.2g\" % (tup[0], tup[1]) for tup in get_feature_importance(clf, feature_names)[:k]]))\n",
"\n",
" print(\"\\nBottom %s importances:\\n\" % k)\n",
" print(\"\\n하위 %s개의 중요도:\\n\" % k)\n",
" print('\\n'.join([\"%s: %.2g\" % (tup[0], tup[1]) for tup in get_feature_importance(clf, feature_names)[-k:]]))"
]
},
Expand Down Expand Up @@ -349,9 +349,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Comparing calibration\n",
"## 보정 곡선 비교\n",
"\n",
"Next, we'll look at calibration, which is very important in an application were we want to show users meaningful scores representing the quality of their questions."
"그다음 보정 곡선을 살펴 보겠습니다. 질문의 품질을 나타내어 의미가 있는 점수를 사용자에게 제시하려는 애플리케이션에서는 매우 중요합니다."
]
},
{
Expand All @@ -362,12 +362,12 @@
"source": [
"def get_multiple_calibration_plot(predicted_proba_arrays, true_y, figsize=(10, 8)):\n",
" \"\"\"\n",
" Inspired by sklearn example\n",
" 참고한 사이킷런 예제\n",
" https://scikit-learn.org/stable/auto_examples/calibration/plot_calibration_curve.html\n",
" :param figsize: size of the output figure\n",
" :param predicted_proba_y: the predicted probabilities of our model for each example\n",
" :param true_y: the true value of the label\n",
" :return: calibration plot\n",
" :param figsize: 출력 그래프 크기\n",
" :param predicted_proba_y: 각 샘플에 대해 모델의 예측 확률\n",
" :param true_y: 정답 값\n",
" :return: 보정 곡선\n",
" \"\"\"\n",
"\n",
" plt.figure(figsize=figsize)\n",
Expand Down Expand Up @@ -550,7 +550,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The third model is showing much better calibration, which is crucial to our application since we want the scores we show users to be as meaningful as possible. In addition, the third model is using the most interpretable features, which will allow us to make clear suggestions. We will use it for the ML Editor."
"세 번째 모델이 훨씬 나은 보정 곡선을 보여줍니다. 가능한 의미있는 점수를 보여주고 싶기 때문에 이 애플리케이션에는 매우 중요한 부분입니다. 또한 세 번째 모델은 가장 설명하기 좋은 특성을 사용하기 때문에 명확한 추전을 만들 수 있습니다. 머신러닝 에디터를 위해 이 모델을 사용하겠습니다."
]
}
],
Expand Down
Loading

0 comments on commit 302c78b

Please sign in to comment.