|
@@ -4,7 +4,7 @@
|
|
|
"cell_type": "markdown",
|
|
|
"metadata": {},
|
|
|
"source": [
|
|
|
- "## Introduction To The Data Set"
|
|
|
+ "## Introduction To The Dataset"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
@@ -762,7 +762,7 @@
|
|
|
}
|
|
|
],
|
|
|
"source": [
|
|
|
- "# Confirm that there's no more missing values!\n",
|
|
|
+ "# Confirm that there are no more missing values!\n",
|
|
|
"numeric_cars.isnull().sum()"
|
|
|
]
|
|
|
},
|
|
@@ -827,15 +827,15 @@
|
|
|
" knn = KNeighborsRegressor()\n",
|
|
|
" np.random.seed(1)\n",
|
|
|
" \n",
|
|
|
- " # Randomize order of rows in data frame.\n",
|
|
|
+ " # Randomize order of rows in DataFrame.\n",
|
|
|
" shuffled_index = np.random.permutation(df.index)\n",
|
|
|
" rand_df = df.reindex(shuffled_index)\n",
|
|
|
"\n",
|
|
|
" # Divide number of rows in half and round.\n",
|
|
|
" last_train_row = int(len(rand_df) / 2)\n",
|
|
|
" \n",
|
|
|
- " # Select the first half and set as training set.\n",
|
|
|
- " # Select the second half and set as test set.\n",
|
|
|
+ " # Select the first half, and set as training set.\n",
|
|
|
+ " # Select the second half, and set as test set.\n",
|
|
|
" train_df = rand_df.iloc[0:last_train_row]\n",
|
|
|
" test_df = rand_df.iloc[last_train_row:]\n",
|
|
|
" \n",
|
|
@@ -956,15 +956,15 @@
|
|
|
"def knn_train_test(train_col, target_col, df):\n",
|
|
|
" np.random.seed(1)\n",
|
|
|
" \n",
|
|
|
- " # Randomize order of rows in data frame.\n",
|
|
|
+ " # Randomize order of rows in DataFrame.\n",
|
|
|
" shuffled_index = np.random.permutation(df.index)\n",
|
|
|
" rand_df = df.reindex(shuffled_index)\n",
|
|
|
"\n",
|
|
|
" # Divide number of rows in half and round.\n",
|
|
|
" last_train_row = int(len(rand_df) / 2)\n",
|
|
|
" \n",
|
|
|
- " # Select the first half and set as training set.\n",
|
|
|
- " # Select the second half and set as test set.\n",
|
|
|
+ " # Select the first half, and set as training set.\n",
|
|
|
+ " # Select the second half, and set as test set.\n",
|
|
|
" train_df = rand_df.iloc[0:last_train_row]\n",
|
|
|
" test_df = rand_df.iloc[last_train_row:]\n",
|
|
|
" \n",
|
|
@@ -1100,15 +1100,15 @@
|
|
|
"def knn_train_test(train_cols, target_col, df):\n",
|
|
|
" np.random.seed(1)\n",
|
|
|
" \n",
|
|
|
- " # Randomize order of rows in data frame.\n",
|
|
|
+ " # Randomize order of rows in DataFrame.\n",
|
|
|
" shuffled_index = np.random.permutation(df.index)\n",
|
|
|
" rand_df = df.reindex(shuffled_index)\n",
|
|
|
"\n",
|
|
|
" # Divide number of rows in half and round.\n",
|
|
|
" last_train_row = int(len(rand_df) / 2)\n",
|
|
|
" \n",
|
|
|
- " # Select the first half and set as training set.\n",
|
|
|
- " # Select the second half and set as test set.\n",
|
|
|
+ " # Select the first half, and set as training set.\n",
|
|
|
+ " # Select the second half, and set as test set.\n",
|
|
|
" train_df = rand_df.iloc[0:last_train_row]\n",
|
|
|
" test_df = rand_df.iloc[last_train_row:]\n",
|
|
|
" \n",
|
|
@@ -1266,15 +1266,15 @@
|
|
|
"def knn_train_test(train_cols, target_col, df):\n",
|
|
|
" np.random.seed(1)\n",
|
|
|
" \n",
|
|
|
- " # Randomize order of rows in data frame.\n",
|
|
|
+ " # Randomize order of rows in DataFrame.\n",
|
|
|
" shuffled_index = np.random.permutation(df.index)\n",
|
|
|
" rand_df = df.reindex(shuffled_index)\n",
|
|
|
"\n",
|
|
|
" # Divide number of rows in half and round.\n",
|
|
|
" last_train_row = int(len(rand_df) / 2)\n",
|
|
|
" \n",
|
|
|
- " # Select the first half and set as training set.\n",
|
|
|
- " # Select the second half and set as test set.\n",
|
|
|
+ " # Select the first half, and set as training set.\n",
|
|
|
+ " # Select the second half, and set as test set.\n",
|
|
|
" train_df = rand_df.iloc[0:last_train_row]\n",
|
|
|
" test_df = rand_df.iloc[last_train_row:]\n",
|
|
|
" \n",
|
|
@@ -1364,7 +1364,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.7.6"
|
|
|
+ "version": "3.8.5"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|