Skip to content

Commit

Permalink
Added CV example link
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Beaumont committed Oct 31, 2013
1 parent b98677b commit ef8ea06
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lec_10_cross_val.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down Expand Up @@ -84,7 +91,7 @@
"x = make_x(20)\n",
"y = hidden_model(x)\n",
"\n",
"print x.shape"
"print(x.shape)"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -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": {},
Expand Down Expand Up @@ -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": {},
Expand Down Expand Up @@ -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": {},
Expand Down

0 comments on commit ef8ea06

Please sign in to comment.