diff --git a/doc/tutorial/statistical_inference/diabetes_cv_exercise.rst b/doc/tutorial/statistical_inference/diabetes_cv_exercise.rst deleted file mode 100644 index deb7ace7899..00000000000 --- a/doc/tutorial/statistical_inference/diabetes_cv_exercise.rst +++ /dev/null @@ -1,10 +0,0 @@ - -Exercise: setting sparsity on diabetes -======================================== - -.. literalinclude:: ../../auto_examples/exercises/plot_cv_diabetes.py - :lines: 1-13 - -Solution: :download:`../../auto_examples/exercises/plot_cv_diabetes.py` - - diff --git a/doc/tutorial/statistical_inference/digits_classification_exercise.rst b/doc/tutorial/statistical_inference/digits_classification_exercise.rst deleted file mode 100644 index b928682e179..00000000000 --- a/doc/tutorial/statistical_inference/digits_classification_exercise.rst +++ /dev/null @@ -1,9 +0,0 @@ - -Excercice: classification of digits -==================================== - -.. literalinclude:: ../../auto_examples/exercises/plot_digits_classification_exercise.py - :lines: 1-5 - -Solution: :download:`../../auto_examples/exercises/plot_digits_classification_exercise.py` - diff --git a/doc/tutorial/statistical_inference/digits_cv_exercise.rst b/doc/tutorial/statistical_inference/digits_cv_exercise.rst deleted file mode 100644 index 42a5927f829..00000000000 --- a/doc/tutorial/statistical_inference/digits_cv_exercise.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. _digits_cv_ex: - -Exercise: model selection on digits -===================================== - -.. literalinclude:: ../../auto_examples/exercises/plot_cv_digits.py - :lines: 1-9 - -Solution: :download:`../../auto_examples/exercises/plot_cv_digits.py` - - diff --git a/doc/tutorial/statistical_inference/index.rst b/doc/tutorial/statistical_inference/index.rst index b3d8a6f2964..63ae773db89 100644 --- a/doc/tutorial/statistical_inference/index.rst +++ b/doc/tutorial/statistical_inference/index.rst @@ -26,8 +26,6 @@ Statistical-learning for scientific data processing tutorial .. include:: ../../includes/big_toc_css.rst -.. note:: This document is meant to be used with **scikit-learn version 0.7+**. - .. warning:: In scikit-learn release 0.9, the import path has changed from diff --git a/doc/tutorial/statistical_inference/iris_classification_exercise.rst b/doc/tutorial/statistical_inference/iris_classification_exercise.rst deleted file mode 100644 index 1a1a5fda8af..00000000000 --- a/doc/tutorial/statistical_inference/iris_classification_exercise.rst +++ /dev/null @@ -1,8 +0,0 @@ -Exercise: classification of iris -==================================== - -.. literalinclude:: ../../auto_examples/exercises/plot_iris_exercise.py - :lines: 1-10 - -Solution: :download:`../../auto_examples/exercises/plot_iris_exercise.py` - diff --git a/doc/tutorial/statistical_inference/model_selection.rst b/doc/tutorial/statistical_inference/model_selection.rst index 281b02a972b..4266dca2672 100644 --- a/doc/tutorial/statistical_inference/model_selection.rst +++ b/doc/tutorial/statistical_inference/model_selection.rst @@ -105,12 +105,12 @@ of the computer. - Takes a label array to group observations +.. currentmodule:: sklearn.svm + .. image:: ../../auto_examples/exercises/images/plot_cv_digits_1.png :target: ../../tutorial/statistical_inference/digits_cv_exercise.html :align: right - :scale: 75 - -.. currentmodule:: sklearn.svm + :scale: 100 .. topic:: **Exercise** :class: green @@ -119,9 +119,12 @@ of the computer. estimator with an RBF kernel as a function of parameter `C` (use a logarithmic grid of points, from `1` to `10`). - .. toctree:: + .. literalinclude:: ../../auto_examples/exercises/plot_cv_digits.py + :lines: 13-23 + + Solution: :download:`../../auto_examples/exercises/plot_cv_digits.py` + - digits_cv_exercise.rst Grid-search and cross-validated estimators ============================================ @@ -209,6 +212,9 @@ appended to their name. **Bonus**: How much can you trust the selection of alpha? - .. toctree:: + .. literalinclude:: ../../auto_examples/exercises/plot_cv_diabetes.py + :lines: 11-23 + + Solution: :download:`../../auto_examples/exercises/plot_cv_diabetes.py` + - diabetes_cv_exercise diff --git a/doc/tutorial/statistical_inference/supervised_learning.rst b/doc/tutorial/statistical_inference/supervised_learning.rst index 78c4a1bd266..7d1face4a23 100644 --- a/doc/tutorial/statistical_inference/supervised_learning.rst +++ b/doc/tutorial/statistical_inference/supervised_learning.rst @@ -401,9 +401,11 @@ This is known as :class:`LogisticRegression`. model. Leave out the last 10% and test prediction performance on these observations. - .. toctree:: + .. literalinclude:: ../../auto_examples/exercises/plot_digits_classification_exercise.py + :lines: 12-17 + + Solution: :download:`../../auto_examples/exercises/plot_digits_classification_exercise.py` - digits_classification_exercise Support vector machines (SVMs) ================================ @@ -551,27 +553,23 @@ creating an decision energy by positioning *kernels* on observations: :align: right :scale: 70 -.. topic:: **Excercise** +.. topic:: **Exercise** :class: green Try classifying classes 1 and 2 from the iris dataset with SVMs, with the 2 first features. Leave out 10% of each class and test prediction performance on these observations. - The solution is available below: - - .. toctree:: - - iris_classification_exercise.rst - **Warning**: the classes are ordered, do not leave out the last 10%, you would be testing on only one class. **Hint**: You can use the `decision_function` method on a grid to get intuitions. -.. - Gaussian process: introducing the notion of posterior estimate - =============================================================== + .. literalinclude:: ../../auto_examples/exercises/plot_iris_exercise.py + :lines: 15-22 + + Solution: :download:`../../auto_examples/exercises/plot_iris_exercise.py` + diff --git a/examples/cluster/plot_lena_compress.py b/examples/cluster/plot_lena_compress.py index 5bee36c476a..ef01ceb1997 100644 --- a/examples/cluster/plot_lena_compress.py +++ b/examples/cluster/plot_lena_compress.py @@ -26,7 +26,12 @@ from sklearn import cluster n_clusters = 5 np.random.seed(0) -lena = sp.lena() +try: + lena = sp.lena() +except AttributeError: + # Newer versions of scipy have lena in misc + from scipy import misc + lena = misc.lena() X = lena.reshape((-1, 1)) # We need an (n_sample, n_feature) array k_means = cluster.KMeans(k=n_clusters, n_init=4) k_means.fit(X) diff --git a/examples/exercises/plot_cv_diabetes.py b/examples/exercises/plot_cv_diabetes.py index 5b4b0401fb8..6a0182afaa1 100644 --- a/examples/exercises/plot_cv_diabetes.py +++ b/examples/exercises/plot_cv_diabetes.py @@ -3,12 +3,11 @@ Cross-validation on diabetes Dataset Exercise =============================================== -This exercise is used in the -:ref:`cv_estimators_tut` part of the -:ref:`model_selection_tut` section of the -:ref:`stat_learn_tut_index`. +This exercise is used in the :ref:`cv_estimators_tut` part of the +:ref:`model_selection_tut` section of the :ref:`stat_learn_tut_index`. """ print __doc__ + import numpy as np import pylab as pl diff --git a/examples/exercises/plot_digits_classification_exercise.py b/examples/exercises/plot_digits_classification_exercise.py index f5e82b10425..bfb6da46361 100644 --- a/examples/exercises/plot_digits_classification_exercise.py +++ b/examples/exercises/plot_digits_classification_exercise.py @@ -3,8 +3,7 @@ Digits Classification Exercise ================================ -This exercise is used in the -:ref:`clf_tut` part of the +This exercise is used in the :ref:`clf_tut` part of the :ref:`supervised_learning_tut` section of the :ref:`stat_learn_tut_index`. """