diff --git a/01_the_machine_learning_landscape.ipynb b/01_the_machine_learning_landscape.ipynb index 510909a..9ef739f 100644 --- a/01_the_machine_learning_landscape.ipynb +++ b/01_the_machine_learning_landscape.ipynb @@ -750,57 +750,6 @@ "plt.show()" ] }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": {}, - "outputs": [], - "source": [ - "backup = oecd_bli, gdp_per_capita\n", - "\n", - "def prepare_country_stats(oecd_bli, gdp_per_capita):\n", - " return sample_data" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [], - "source": [ - "# Replace this linear model:\n", - "import sklearn.linear_model\n", - "model = sklearn.linear_model.LinearRegression()" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": {}, - "outputs": [], - "source": [ - "# with this k-neighbors regression model:\n", - "import sklearn.neighbors\n", - "model = sklearn.neighbors.KNeighborsRegressor(n_neighbors=3)" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [], - "source": [ - "X = np.c_[country_stats[\"GDP per capita\"]]\n", - "y = np.c_[country_stats[\"Life satisfaction\"]]\n", - "\n", - "# Train the model\n", - "model.fit(X, y)\n", - "\n", - "# Make a prediction for Cyprus\n", - "X_new = np.array([[22587.0]]) # Cyprus' GDP per capita\n", - "print(model.predict(X_new)) # outputs [[ 5.76666667]]" - ] - }, { "cell_type": "code", "execution_count": null,