From 2f5e0e76bb0278bfa4cd0185ccc915a21b5f01c3 Mon Sep 17 00:00:00 2001 From: ligerfotis Date: Fri, 26 May 2023 16:23:55 +0200 Subject: [PATCH] update solution for assignment 5 --- assignment 5/iml_assignmnet5_solved.ipynb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/assignment 5/iml_assignmnet5_solved.ipynb b/assignment 5/iml_assignmnet5_solved.ipynb index c4ae8f8..3bae93d 100644 --- a/assignment 5/iml_assignmnet5_solved.ipynb +++ b/assignment 5/iml_assignmnet5_solved.ipynb @@ -230,8 +230,20 @@ }, { "cell_type": "code", - "execution_count": 7, - "outputs": [], + "execution_count": 1, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'train_test_split' is not defined", + "output_type": "error", + "traceback": [ + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mNameError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[0;32mIn[1], line 11\u001B[0m\n\u001B[1;32m 9\u001B[0m X \u001B[38;5;241m=\u001B[39m df\u001B[38;5;241m.\u001B[39mdrop([\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mConcrete compressive strength(MPa, megapascals) \u001B[39m\u001B[38;5;124m'\u001B[39m], axis\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m1\u001B[39m)\n\u001B[1;32m 10\u001B[0m y \u001B[38;5;241m=\u001B[39m df[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mConcrete compressive strength(MPa, megapascals) \u001B[39m\u001B[38;5;124m'\u001B[39m]\n\u001B[0;32m---> 11\u001B[0m X_train, X_test, y_train, y_test \u001B[38;5;241m=\u001B[39m \u001B[43mtrain_test_split\u001B[49m(X, y, test_size\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m0.2\u001B[39m, random_state\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m42\u001B[39m)\n\u001B[1;32m 13\u001B[0m \u001B[38;5;66;03m# transform the features into second degree polynomial features\u001B[39;00m\n\u001B[1;32m 14\u001B[0m X_train_poly_custom \u001B[38;5;241m=\u001B[39m polynomial_features(X_train\u001B[38;5;241m.\u001B[39mvalues, degree\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m2\u001B[39m)\n", + "\u001B[0;31mNameError\u001B[0m: name 'train_test_split' is not defined" + ] + } + ], "source": [ "# Non-linear feature transformation\n", "import pandas as pd\n",