From 2f89518bbf1ce661fc504f41fecb4ad80b65749e Mon Sep 17 00:00:00 2001 From: Felix Mucha <3016498@stud.hs-mannheim.de> Date: Wed, 12 Jun 2024 17:19:27 +0200 Subject: [PATCH] added f1 score --- notebooks/ml_grad_boost_tree.ipynb | 74 +++++++++++++++++++----------- notebooks/ml_xgboost.ipynb | 63 +++++++++++++++---------- 2 files changed, 85 insertions(+), 52 deletions(-) diff --git a/notebooks/ml_grad_boost_tree.ipynb b/notebooks/ml_grad_boost_tree.ipynb index 341b439..fcddf8f 100644 --- a/notebooks/ml_grad_boost_tree.ipynb +++ b/notebooks/ml_grad_boost_tree.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -21,7 +21,7 @@ "import matplotlib.pyplot as plt\n", "import xgboost as xgb\n", "from sklearn.model_selection import GridSearchCV\n", - "from sklearn.metrics import confusion_matrix\n", + "from sklearn.metrics import confusion_matrix, f1_score\n", "from sklearn.ensemble import GradientBoostingClassifier\n", "from sklearn.impute import SimpleImputer\n", "from sklearn.metrics import accuracy_score\n", @@ -39,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -63,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -138,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -151,7 +151,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -171,29 +171,29 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "CPU times: total: 3min 28s\n", - "Wall time: 4min 16s\n" + "CPU times: total: 2min 49s\n", + "Wall time: 4min 28s\n" ] }, { "data": { "text/html": [ - "
GridSearchCV(cv=3, estimator=GradientBoostingClassifier(),\n", + "GridSearchCV(cv=3, estimator=GradientBoostingClassifier(),\n", " param_grid={'learning_rate': [0.1, 0.2, 0.3],\n", " 'max_depth': [1, 3, 5],\n", " 'n_estimators': [100, 200, 300]},\n", - " scoring='accuracy')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org." + " scoring='accuracy')GridSearchCV(cv=3, estimator=GradientBoostingClassifier(),\n", + " scoring='accuracy')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.GridSearchCV(cv=3, estimator=GradientBoostingClassifier(),\n", " param_grid={'learning_rate': [0.1, 0.2, 0.3],\n", " 'max_depth': [1, 3, 5],\n", " 'n_estimators': [100, 200, 300]},\n", - " scoring='accuracy')GradientBoostingClassifier()GradientBoostingClassifier()GradientBoostingClassifier()GradientBoostingClassifier()
GradientBoostingClassifier()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
GradientBoostingClassifier()
GradientBoostingClassifier()In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
GradientBoostingClassifier()