diff --git a/lec_10_cross_val.ipynb b/lec_10_cross_val.ipynb index 50fa986..aa7176f 100644 --- a/lec_10_cross_val.ipynb +++ b/lec_10_cross_val.ipynb @@ -15,6 +15,13 @@ "Cross Validation: The Right and Wrong Way" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*For a real-world example that showcases the pitfalls of improper cross validation, see [this blog post.](http://followthedata.wordpress.com/2013/10/30/the-importance-of-proper-cross-validation-and-experimental-design/)*" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -84,7 +91,7 @@ "x = make_x(20)\n", "y = hidden_model(x)\n", "\n", - "print x.shape" + "print(x.shape)" ], "language": "python", "metadata": {}, @@ -112,7 +119,7 @@ "input": [ "selector = SelectKBest(f_regression, k=2).fit(x, y)\n", "best_features = np.where(selector.get_support())[0]\n", - "print best_features" + "print(best_features)" ], "language": "python", "metadata": {}, @@ -180,7 +187,7 @@ "input": [ "xt = x[:, best_features]\n", "clf = LinearRegression().fit(xt, y)\n", - "print \"Score is \", clf.score(xt, y)" + "print(\"Score is \", clf.score(xt, y))" ], "language": "python", "metadata": {}, @@ -385,7 +392,7 @@ "plt.xlabel(\"Predicted\")\n", "plt.ylabel(\"Observed\")\n", "\n", - "print \"CV Score is \", np.mean(scores)" + "print(\"CV Score is \", np.mean(scores))" ], "language": "python", "metadata": {},