From 995dc7f3738eca8a53673ebe2ec5a3ec543c72ef Mon Sep 17 00:00:00 2001 From: samalki Date: Mon, 3 Mar 2025 18:04:14 +0300 Subject: [PATCH] Add files via upload --- lab-logistic-regression-with-python.ipynb | 40 +++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/lab-logistic-regression-with-python.ipynb b/lab-logistic-regression-with-python.ipynb index 05ead5e..b1c9539 100644 --- a/lab-logistic-regression-with-python.ipynb +++ b/lab-logistic-regression-with-python.ipynb @@ -123,9 +123,21 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'piplite'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpiplite\u001b[39;00m\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m piplite\u001b[38;5;241m.\u001b[39minstall([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpandas\u001b[39m\u001b[38;5;124m'\u001b[39m])\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m piplite\u001b[38;5;241m.\u001b[39minstall([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmatplotlib\u001b[39m\u001b[38;5;124m'\u001b[39m])\n", + "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'piplite'" + ] + } + ], "source": [ "import piplite\n", "await piplite.install(['pandas'])\n", @@ -339,7 +351,14 @@ }, "outputs": [], "source": [ - "# write your code here\n" + "\n", + "rows, cols = churn_df.shape\n", + "print(f\"Number of rows: {rows}\")\n", + "print(f\"Number of columns: {cols}\")\n", + "\n", + "\n", + "print(\"Column names:\")\n", + "print(churn_df.columns.tolist())" ] }, { @@ -665,7 +684,16 @@ "metadata": {}, "outputs": [], "source": [ - "# write your code here\n", + "from sklearn.linear_model import LogisticRegression\n", + "from sklearn.metrics import log_loss\n", + "\n", + "LR_new = LogisticRegression(C=0.1, solver='saga').fit(X_train, y_train)\n", + "\n", + "yhat_prob_new = LR_new.predict_proba(X_test)\n", + "\n", + "log_loss_value = log_loss(y_test, yhat_prob_new)\n", + "\n", + "print(f\"New Log Loss value: {log_loss_value:.4f}\")\n", "\n" ] }, @@ -709,7 +737,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.11" }, "widgets": { "state": {},