From 2aaec4790013e4b8d1eecf62333bb3d6900c8301 Mon Sep 17 00:00:00 2001 From: "Shekwoyeyilo2.gado@live.uwe.ac.uk" <sarah.y.gado@gmail.com> Date: Thu, 13 Mar 2025 08:58:06 +0000 Subject: [PATCH] Randomized grids results --- models.ipynb | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/models.ipynb b/models.ipynb index 55980ec..1387698 100644 --- a/models.ipynb +++ b/models.ipynb @@ -867,7 +867,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -904,30 +904,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Running RandomizedSearchCV for DecisionTree...\n", - "Best parameters for DecisionTree: {'criterion': 'entropy', 'max_depth': 10, 'min_samples_leaf': 4, 'min_samples_split': 2}\n", - "\n", - "Running RandomizedSearchCV for RandomForest...\n", - "Best parameters for RandomForest: {'criterion': 'gini', 'max_depth': 50, 'min_samples_leaf': 2, 'min_samples_split': 8, 'n_estimators': 102}\n", - "\n", - "Running RandomizedSearchCV for svc...\n" - ] - } - ], + "outputs": [], "source": [ - "for name, model in models.items():\n", - " #print(name)\n", - " print(f\"Running RandomizedSearchCV for {name}...\")\n", - " random_search = RandomizedSearchCV(model, param_distributions=param_grids[name], cv =kf, n_iter =100, random_state=42, n_jobs=-1)\n", - " random_search.fit(X_train_scaled, y_train)\n", - " print(f\"Best parameters for {name}: {random_search.best_params_}\\n\")\n" + "# for name, model in models.items():\n", + "# #print(name)\n", + "# print(f\"Running RandomizedSearchCV for {name}...\")\n", + "# random_search = RandomizedSearchCV(model, param_distributions=param_grids[name], cv =kf, n_iter =100, random_state=42, n_jobs=-1)\n", + "# random_search.fit(X_train_scaled, y_train)\n", + "# print(f\"Best parameters for {name}: {random_search.best_params_}\\n\")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "search results: \n", + "search results: Running RandomizedSearchCV for DecisionTree...\n", + "Best parameters for DecisionTree: {'criterion': 'entropy', 'max_depth': 10, 'min_samples_leaf': 4, 'min_samples_split': 2}\n", + "\n", + "Running RandomizedSearchCV for RandomForest...\n", + "Best parameters for RandomForest: {'criterion': 'gini', 'max_depth': 50, 'min_samples_leaf': 2, 'min_samples_split': 8, 'n_estimators': 102}\n", + "\n", + "Running RandomizedSearchCV for svc...\n", + "Best parameters for svc: {'kernel': 'rbf', 'gamma': 'auto', 'C': 10}" ] } ], -- GitLab