Permalink
Browse files

BUG: no plotting in doctests

  • Loading branch information...
1 parent 7278dfe commit 6b1bc1744f220447cb1966e801bff8b044e6ae85 @GaelVaroquaux GaelVaroquaux committed Mar 25, 2012
@@ -3,7 +3,6 @@ Putting it all together
=========================
.. Imports
- >>> import pylab as pl
>>> import numpy as np
Pipelining
@@ -42,8 +42,8 @@ needs to be preprocessed to be used by the scikit.
>>> digits = datasets.load_digits()
>>> digits.images.shape
(1797, 8, 8)
- >>> import pylab as pl
- >>> pl.imshow(digits.images[-1], cmap=pl.cm.gray_r) #doctest: +ELLIPSIS
+ >>> import pylab as pl #doctest: +SKIP
+ >>> pl.imshow(digits.images[-1], cmap=pl.cm.gray_r) #doctest: +SKIP
<matplotlib.image.AxesImage object at ...>
To use this dataset with the scikit, we transform each 8x8 image in a
@@ -211,15 +211,15 @@ induces high variance:
>>> test = np.c_[ 0, 2].T
>>> regr = linear_model.LinearRegression()
- >>> import pylab as pl
+ >>> import pylab as pl # doctest: +SKIP
>>> pl.figure() # doctest: +SKIP
>>> np.random.seed(0)
>>> for _ in range(6): # doctest: +SKIP
... this_X = .1*np.random.normal(size=(2, 1)) + X
... regr.fit(X, y)
- ... pl.plot(test, regr.predict(test))
- ... pl.scatter(this_X, y, s=3)
+ ... pl.plot(test, regr.predict(test)) # doctest: +SKIP
+ ... pl.scatter(this_X, y, s=3) # doctest: +SKIP
@@ -243,8 +243,8 @@ regression:
>>> for _ in range(6): # doctest: +SKIP
... this_X = .1*np.random.normal(size=(2, 1)) + X
... regr.fit(this_X, y)
- ... pl.plot(test, regr.predict(test))
- ... pl.scatter(this_X, y, s=3)
+ ... pl.plot(test, regr.predict(test)) # doctest: +SKIP
+ ... pl.scatter(this_X, y, s=3) # doctest: +SKIP
This is an example of **bias/variance tradeoff**: the larger the ridge
`alpha` parameter, the higher the bias and the lower the variance.
@@ -16,8 +16,6 @@ Clustering: grouping observations together
>>> # Set the PRNG
>>> import numpy as np
>>> np.random.seed(1)
- >>> # Import pylab
- >>> import pylab as pl
K-means clustering

0 comments on commit 6b1bc17

Please sign in to comment.