update solution for assignment 5
This commit is contained in:
parent
ce418b7856
commit
2f5e0e76bb
@ -230,8 +230,20 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 1,
|
||||||
"outputs": [],
|
"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": [
|
"source": [
|
||||||
"# Non-linear feature transformation\n",
|
"# Non-linear feature transformation\n",
|
||||||
"import pandas as pd\n",
|
"import pandas as pd\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user