.. raw:: html .. raw:: html Examples ======== .. _examples-index: .. _general_examples: General examples ---------------- General-purpose and introductory examples for the scikit. .. raw:: html
.. figure:: ./images/thumb/feature_selection_pipeline.png :target: ./feature_selection_pipeline.html :ref:`example_feature_selection_pipeline.py` .. raw:: html

Simple usage of Pipeline that runs successively a univariate feature selection with anova and t...

.. toctree:: :hidden: ./feature_selection_pipeline .. raw:: html
.. figure:: ./images/thumb/plot_rfe_digits.png :target: ./plot_rfe_digits.html :ref:`example_plot_rfe_digits.py` .. raw:: html

A recursive feature elimination example showing the relevance of pixels in a digit classificati...

.. toctree:: :hidden: ./plot_rfe_digits .. raw:: html
.. figure:: ./images/thumb/plot_rfe_with_cross_validation.png :target: ./plot_rfe_with_cross_validation.html :ref:`example_plot_rfe_with_cross_validation.py` .. raw:: html

A recursive feature elimination example with automatic tuning of the number of features selecte...

.. toctree:: :hidden: ./plot_rfe_with_cross_validation .. raw:: html
.. figure:: ./images/thumb/plot_confusion_matrix.png :target: ./plot_confusion_matrix.html :ref:`example_plot_confusion_matrix.py` .. raw:: html

Example of confusion matrix usage to evaluate the quality of the output of a classifier on the ...

.. toctree:: :hidden: ./plot_confusion_matrix .. raw:: html
.. figure:: ./images/thumb/plot_validation_curve.png :target: ./plot_validation_curve.html :ref:`example_plot_validation_curve.py` .. raw:: html

In this plot you can see the training scores and validation scores of an SVM for different valu...

.. toctree:: :hidden: ./plot_validation_curve .. raw:: html
.. figure:: ./images/thumb/plot_underfitting_overfitting.png :target: ./plot_underfitting_overfitting.html :ref:`example_plot_underfitting_overfitting.py` .. raw:: html

This example demonstrates the problems of underfitting and overfitting and how we can use linea...

.. toctree:: :hidden: ./plot_underfitting_overfitting .. raw:: html
.. figure:: ./images/thumb/feature_stacker.png :target: ./feature_stacker.html :ref:`example_feature_stacker.py` .. raw:: html

In many real-world examples, there are many ways to extract features from a dataset. Often it i...

.. toctree:: :hidden: ./feature_stacker .. raw:: html
.. figure:: ./images/thumb/plot_isotonic_regression.png :target: ./plot_isotonic_regression.html :ref:`example_plot_isotonic_regression.py` .. raw:: html

An illustration of the isotonic regression on generated data. The isotonic regression finds a n...

.. toctree:: :hidden: ./plot_isotonic_regression .. raw:: html
.. figure:: ./images/thumb/imputation.png :target: ./imputation.html :ref:`example_imputation.py` .. raw:: html

This example shows that imputing the missing values can give better results than discarding the...

.. toctree:: :hidden: ./imputation .. raw:: html
.. figure:: ./images/thumb/plot_digits_pipe.png :target: ./plot_digits_pipe.html :ref:`example_plot_digits_pipe.py` .. raw:: html

The PCA does an unsupervised dimensionality reduction, while the logistic regression does the p...

.. toctree:: :hidden: ./plot_digits_pipe .. raw:: html
.. figure:: ./images/thumb/plot_digits_classification.png :target: ./plot_digits_classification.html :ref:`example_plot_digits_classification.py` .. raw:: html

An example showing how the scikit-learn can be used to recognize images of hand-written digits.

.. toctree:: :hidden: ./plot_digits_classification .. raw:: html
.. figure:: ./images/thumb/plot_permutation_test_for_classification.png :target: ./plot_permutation_test_for_classification.html :ref:`example_plot_permutation_test_for_classification.py` .. raw:: html

In order to test if a classification score is significative a technique in repeating the classi...

.. toctree:: :hidden: ./plot_permutation_test_for_classification .. raw:: html
.. figure:: ./images/thumb/grid_search_digits.png :target: ./grid_search_digits.html :ref:`example_grid_search_digits.py` .. raw:: html

This examples shows how a classifier is optimized by cross-validation, which is done using the ...

.. toctree:: :hidden: ./grid_search_digits .. raw:: html
.. figure:: ./images/thumb/plot_roc_crossval.png :target: ./plot_roc_crossval.html :ref:`example_plot_roc_crossval.py` .. raw:: html

Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality...

.. toctree:: :hidden: ./plot_roc_crossval .. raw:: html
.. figure:: ./images/thumb/plot_train_error_vs_test_error.png :target: ./plot_train_error_vs_test_error.html :ref:`example_plot_train_error_vs_test_error.py` .. raw:: html

Illustration of how the performance of an estimator on unseen data (test data) is not the same ...

.. toctree:: :hidden: ./plot_train_error_vs_test_error .. raw:: html
.. figure:: ./images/thumb/plot_feature_selection.png :target: ./plot_feature_selection.html :ref:`example_plot_feature_selection.py` .. raw:: html

An example showing univariate feature selection.

.. toctree:: :hidden: ./plot_feature_selection .. raw:: html
.. figure:: ./images/thumb/plot_classification_probability.png :target: ./plot_classification_probability.html :ref:`example_plot_classification_probability.py` .. raw:: html

Plot the classification probability for different classifiers. We use a 3 class dataset, and we...

.. toctree:: :hidden: ./plot_classification_probability .. raw:: html
.. figure:: ./images/thumb/randomized_search.png :target: ./randomized_search.html :ref:`example_randomized_search.py` .. raw:: html

Compare randomized search and grid search for optimizing hyperparameters of a random forest. Al...

.. toctree:: :hidden: ./randomized_search .. raw:: html
.. figure:: ./images/thumb/plot_roc.png :target: ./plot_roc.html :ref:`example_plot_roc.py` .. raw:: html

Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality...

.. toctree:: :hidden: ./plot_roc .. raw:: html
.. figure:: ./images/thumb/plot_precision_recall.png :target: ./plot_precision_recall.html :ref:`example_plot_precision_recall.py` .. raw:: html

Example of Precision-Recall metric to evaluate classifier output quality.

.. toctree:: :hidden: ./plot_precision_recall .. raw:: html
.. figure:: ./images/thumb/plot_multilabel.png :target: ./plot_multilabel.html :ref:`example_plot_multilabel.py` .. raw:: html

This example simulates a multi-label document classification problem. The dataset is generated ...

.. toctree:: :hidden: ./plot_multilabel .. raw:: html
.. figure:: ./images/thumb/plot_multioutput_face_completion.png :target: ./plot_multioutput_face_completion.html :ref:`example_plot_multioutput_face_completion.py` .. raw:: html

This example shows the use of multi-output estimator to complete images. The goal is to predict...

.. toctree:: :hidden: ./plot_multioutput_face_completion .. raw:: html
.. figure:: ./images/thumb/grid_search_text_feature_extraction.png :target: ./grid_search_text_feature_extraction.html :ref:`example_grid_search_text_feature_extraction.py` .. raw:: html

The dataset used in this example is the 20 newsgroups dataset which will be automatically downl...

.. toctree:: :hidden: ./grid_search_text_feature_extraction .. raw:: html
.. figure:: ./images/thumb/plot_learning_curve.png :target: ./plot_learning_curve.html :ref:`example_plot_learning_curve.py` .. raw:: html

On the left side the learning curve of a naive Bayes classifier is shown for the digits dataset...

.. toctree:: :hidden: ./plot_learning_curve .. raw:: html
.. figure:: ./images/thumb/hashing_vs_dict_vectorizer.png :target: ./hashing_vs_dict_vectorizer.html :ref:`example_hashing_vs_dict_vectorizer.py` .. raw:: html

Compares FeatureHasher and DictVectorizer by using both to vectorize text documents.

.. toctree:: :hidden: ./hashing_vs_dict_vectorizer .. raw:: html
.. figure:: ./images/thumb/plot_johnson_lindenstrauss_bound.png :target: ./plot_johnson_lindenstrauss_bound.html :ref:`example_plot_johnson_lindenstrauss_bound.py` .. raw:: html

The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly pr...

.. toctree:: :hidden: ./plot_johnson_lindenstrauss_bound .. raw:: html
.. figure:: ./images/thumb/plot_classifier_comparison.png :target: ./plot_classifier_comparison.html :ref:`example_plot_classifier_comparison.py` .. raw:: html

A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this ...

.. toctree:: :hidden: ./plot_classifier_comparison .. raw:: html
.. figure:: ./images/thumb/plot_rbm_logistic_classification.png :target: ./plot_rbm_logistic_classification.html :ref:`example_plot_rbm_logistic_classification.py` .. raw:: html

For greyscale image data where pixel values can be interpreted as degrees of blackness on a whi...

.. toctree:: :hidden: ./plot_rbm_logistic_classification .. raw:: html
.. figure:: ./images/thumb/plot_lda_qda.png :target: ./plot_lda_qda.html :ref:`example_plot_lda_qda.py` .. raw:: html

Plot the confidence ellipsoids of each class and decision boundary

.. toctree:: :hidden: ./plot_lda_qda .. raw:: html
.. figure:: ./images/thumb/document_clustering.png :target: ./document_clustering.html :ref:`example_document_clustering.py` .. raw:: html

This is an example showing how the scikit-learn can be used to cluster documents by topics usin...

.. toctree:: :hidden: ./document_clustering .. raw:: html
.. figure:: ./images/thumb/plot_kernel_approximation.png :target: ./plot_kernel_approximation.html :ref:`example_plot_kernel_approximation.py` .. raw:: html

An example illustrating the approximation of the feature map of an RBF kernel.

.. toctree:: :hidden: ./plot_kernel_approximation .. raw:: html
.. figure:: ./images/thumb/document_classification_20newsgroups.png :target: ./document_classification_20newsgroups.html :ref:`example_document_classification_20newsgroups.py` .. raw:: html

This is an example showing how scikit-learn can be used to classify documents by topics using a...

.. toctree:: :hidden: ./document_classification_20newsgroups .. raw:: html
.. _realworld_examples: Examples based on real world datasets ------------------------------------- Applications to real world problems with some medium sized datasets or interactive user interface. .. raw:: html
.. figure:: applications/images/thumb/topics_extraction_with_nmf.png :target: ./applications/topics_extraction_with_nmf.html :ref:`example_applications_topics_extraction_with_nmf.py` .. raw:: html

This is a proof of concept application of Non Negative Matrix Factorization of the term frequen...

.. toctree:: :hidden: applications/topics_extraction_with_nmf .. raw:: html
.. figure:: applications/images/thumb/plot_outlier_detection_housing.png :target: ./applications/plot_outlier_detection_housing.html :ref:`example_applications_plot_outlier_detection_housing.py` .. raw:: html

This example illustrates the need for robust covariance estimation on a real data set. It is us...

.. toctree:: :hidden: applications/plot_outlier_detection_housing .. raw:: html
.. figure:: applications/images/thumb/plot_tomography_l1_reconstruction.png :target: ./applications/plot_tomography_l1_reconstruction.html :ref:`example_applications_plot_tomography_l1_reconstruction.py` .. raw:: html

This example shows the reconstruction of an image from a set of parallel projections, acquired ...

.. toctree:: :hidden: applications/plot_tomography_l1_reconstruction .. raw:: html
.. figure:: applications/images/thumb/face_recognition.png :target: ./applications/face_recognition.html :ref:`example_applications_face_recognition.py` .. raw:: html

The dataset used in this example is a preprocessed excerpt of the "Labeled Faces in the Wild", ...

.. toctree:: :hidden: applications/face_recognition .. raw:: html
.. figure:: applications/images/thumb/plot_model_complexity_influence.png :target: ./applications/plot_model_complexity_influence.html :ref:`example_applications_plot_model_complexity_influence.py` .. raw:: html

Demonstrate how model complexity influences both prediction accuracy and computational performa...

.. toctree:: :hidden: applications/plot_model_complexity_influence .. raw:: html
.. figure:: applications/images/thumb/plot_species_distribution_modeling.png :target: ./applications/plot_species_distribution_modeling.html :ref:`example_applications_plot_species_distribution_modeling.py` .. raw:: html

Modeling species' geographic distributions is an important problem in conservation biology. In ...

.. toctree:: :hidden: applications/plot_species_distribution_modeling .. raw:: html
.. figure:: applications/images/thumb/plot_stock_market.png :target: ./applications/plot_stock_market.html :ref:`example_applications_plot_stock_market.py` .. raw:: html

This example employs several unsupervised learning techniques to extract the stock market struc...

.. toctree:: :hidden: applications/plot_stock_market .. raw:: html
.. figure:: applications/images/thumb/wikipedia_principal_eigenvector.png :target: ./applications/wikipedia_principal_eigenvector.html :ref:`example_applications_wikipedia_principal_eigenvector.py` .. raw:: html

A classical way to assert the relative importance of vertices in a graph is to compute the prin...

.. toctree:: :hidden: applications/wikipedia_principal_eigenvector .. raw:: html
.. figure:: applications/images/thumb/plot_prediction_latency.png :target: ./applications/plot_prediction_latency.html :ref:`example_applications_plot_prediction_latency.py` .. raw:: html

This is an example showing the prediction latency of various scikit-learn estimators.

.. toctree:: :hidden: applications/plot_prediction_latency .. raw:: html
.. figure:: applications/images/thumb/svm_gui.png :target: ./applications/svm_gui.html :ref:`example_applications_svm_gui.py` .. raw:: html

A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create da...

.. toctree:: :hidden: applications/svm_gui .. raw:: html
.. figure:: applications/images/thumb/plot_out_of_core_classification.png :target: ./applications/plot_out_of_core_classification.html :ref:`example_applications_plot_out_of_core_classification.py` .. raw:: html

This is an example showing how scikit-learn can be used for classification using an out-of-core...

.. toctree:: :hidden: applications/plot_out_of_core_classification .. raw:: html
.. _bicluster_examples: Biclustering ------------ Examples concerning the :mod:`sklearn.cluster.bicluster` package. .. raw:: html
.. figure:: bicluster/images/thumb/plot_spectral_coclustering.png :target: ./bicluster/plot_spectral_coclustering.html :ref:`example_bicluster_plot_spectral_coclustering.py` .. raw:: html

This example demonstrates how to generate a dataset and bicluster it using the the Spectral Co-...

.. toctree:: :hidden: bicluster/plot_spectral_coclustering .. raw:: html
.. figure:: bicluster/images/thumb/plot_spectral_biclustering.png :target: ./bicluster/plot_spectral_biclustering.html :ref:`example_bicluster_plot_spectral_biclustering.py` .. raw:: html

This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spe...

.. toctree:: :hidden: bicluster/plot_spectral_biclustering .. raw:: html
.. figure:: bicluster/images/thumb/bicluster_newsgroups.png :target: ./bicluster/bicluster_newsgroups.html :ref:`example_bicluster_bicluster_newsgroups.py` .. raw:: html

This example demonstrates the Spectral Co-clustering algorithm on the twenty newsgroups dataset...

.. toctree:: :hidden: bicluster/bicluster_newsgroups .. raw:: html
.. _cluster_examples: Clustering ---------- Examples concerning the :mod:`sklearn.cluster` package. .. raw:: html
.. figure:: cluster/images/thumb/plot_mean_shift.png :target: ./cluster/plot_mean_shift.html :ref:`example_cluster_plot_mean_shift.py` .. raw:: html

Reference:

.. toctree:: :hidden: cluster/plot_mean_shift .. raw:: html
.. figure:: cluster/images/thumb/plot_lena_ward_segmentation.png :target: ./cluster/plot_lena_ward_segmentation.html :ref:`example_cluster_plot_lena_ward_segmentation.py` .. raw:: html

Compute the segmentation of a 2D image with Ward hierarchical clustering. The clustering is spa...

.. toctree:: :hidden: cluster/plot_lena_ward_segmentation .. raw:: html
.. figure:: cluster/images/thumb/plot_digits_agglomeration.png :target: ./cluster/plot_digits_agglomeration.html :ref:`example_cluster_plot_digits_agglomeration.py` .. raw:: html

These images how similar features are merged together using feature agglomeration.

.. toctree:: :hidden: cluster/plot_digits_agglomeration .. raw:: html
.. figure:: cluster/images/thumb/plot_affinity_propagation.png :target: ./cluster/plot_affinity_propagation.html :ref:`example_cluster_plot_affinity_propagation.py` .. raw:: html

Reference: Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages Between Data Poin...

.. toctree:: :hidden: cluster/plot_affinity_propagation .. raw:: html
.. figure:: cluster/images/thumb/plot_agglomerative_clustering.png :target: ./cluster/plot_agglomerative_clustering.html :ref:`example_cluster_plot_agglomerative_clustering.py` .. raw:: html

This example shows the effect of imposing a connectivity graph to capture local structure in th...

.. toctree:: :hidden: cluster/plot_agglomerative_clustering .. raw:: html
.. figure:: cluster/images/thumb/plot_lena_segmentation.png :target: ./cluster/plot_lena_segmentation.html :ref:`example_cluster_plot_lena_segmentation.py` .. raw:: html

This example uses :ref:`spectral_clustering` on a graph created from voxel-to-voxel difference ...

.. toctree:: :hidden: cluster/plot_lena_segmentation .. raw:: html
.. figure:: cluster/images/thumb/plot_dbscan.png :target: ./cluster/plot_dbscan.html :ref:`example_cluster_plot_dbscan.py` .. raw:: html

Finds core samples of high density and expands clusters from them.

.. toctree:: :hidden: cluster/plot_dbscan .. raw:: html
.. figure:: cluster/images/thumb/plot_dict_face_patches.png :target: ./cluster/plot_dict_face_patches.html :ref:`example_cluster_plot_dict_face_patches.py` .. raw:: html

This example uses a large dataset of faces to learn a set of 20 x 20 images patches that consti...

.. toctree:: :hidden: cluster/plot_dict_face_patches .. raw:: html
.. figure:: cluster/images/thumb/plot_lena_compress.png :target: ./cluster/plot_lena_compress.html :ref:`example_cluster_plot_lena_compress.py` .. raw:: html

The classic image processing example, Lena, an 8-bit grayscale bit-depth, 512 x 512 sized image...

.. toctree:: :hidden: cluster/plot_lena_compress .. raw:: html
.. figure:: cluster/images/thumb/plot_ward_structured_vs_unstructured.png :target: ./cluster/plot_ward_structured_vs_unstructured.html :ref:`example_cluster_plot_ward_structured_vs_unstructured.py` .. raw:: html

Example builds a swiss roll dataset and runs hierarchical clustering on their position.

.. toctree:: :hidden: cluster/plot_ward_structured_vs_unstructured .. raw:: html
.. figure:: cluster/images/thumb/plot_segmentation_toy.png :target: ./cluster/plot_segmentation_toy.html :ref:`example_cluster_plot_segmentation_toy.py` .. raw:: html

In this example, an image with connected circles is generated and spectral clustering is used t...

.. toctree:: :hidden: cluster/plot_segmentation_toy .. raw:: html
.. figure:: cluster/images/thumb/plot_cluster_iris.png :target: ./cluster/plot_cluster_iris.html :ref:`example_cluster_plot_cluster_iris.py` .. raw:: html

The plots display firstly what a K-means algorithm would yield using three clusters. It is then...

.. toctree:: :hidden: cluster/plot_cluster_iris .. raw:: html

An illustration of various linkage option for agglomerative clustering on a 2D embedding of the...

.. toctree:: :hidden: cluster/plot_digits_linkage .. raw:: html
.. figure:: cluster/images/thumb/plot_color_quantization.png :target: ./cluster/plot_color_quantization.html :ref:`example_cluster_plot_color_quantization.py` .. raw:: html

Performs a pixel-wise Vector Quantization (VQ) of an image of the summer palace (China), reduci...

.. toctree:: :hidden: cluster/plot_color_quantization .. raw:: html
.. figure:: cluster/images/thumb/plot_feature_agglomeration_vs_univariate_selection.png :target: ./cluster/plot_feature_agglomeration_vs_univariate_selection.html :ref:`example_cluster_plot_feature_agglomeration_vs_univariate_selection.py` .. raw:: html

This example compares 2 dimensionality reduction strategies:

.. toctree:: :hidden: cluster/plot_feature_agglomeration_vs_univariate_selection .. raw:: html
.. figure:: cluster/images/thumb/plot_agglomerative_clustering_metrics.png :target: ./cluster/plot_agglomerative_clustering_metrics.html :ref:`example_cluster_plot_agglomerative_clustering_metrics.py` .. raw:: html

Demonstrates the effect of different metrics on the hierarchical clustering.

.. toctree:: :hidden: cluster/plot_agglomerative_clustering_metrics .. raw:: html
.. figure:: cluster/images/thumb/plot_kmeans_stability_low_dim_dense.png :target: ./cluster/plot_kmeans_stability_low_dim_dense.html :ref:`example_cluster_plot_kmeans_stability_low_dim_dense.py` .. raw:: html

Evaluate the ability of k-means initializations strategies to make the algorithm convergence ro...

.. toctree:: :hidden: cluster/plot_kmeans_stability_low_dim_dense .. raw:: html
.. figure:: cluster/images/thumb/plot_kmeans_digits.png :target: ./cluster/plot_kmeans_digits.html :ref:`example_cluster_plot_kmeans_digits.py` .. raw:: html

In this example we compare the various initialization strategies for K-means in terms of runtim...

.. toctree:: :hidden: cluster/plot_kmeans_digits .. raw:: html

The following plots demonstrate the impact of the number of clusters and number of samples on v...

.. toctree:: :hidden: cluster/plot_adjusted_for_chance_measures .. raw:: html
.. figure:: cluster/images/thumb/plot_cluster_comparison.png :target: ./cluster/plot_cluster_comparison.html :ref:`example_cluster_plot_cluster_comparison.py` .. raw:: html

This example aims at showing characteristics of different clustering algorithms on datasets tha...

.. toctree:: :hidden: cluster/plot_cluster_comparison .. raw:: html
.. figure:: cluster/images/thumb/plot_mini_batch_kmeans.png :target: ./cluster/plot_mini_batch_kmeans.html :ref:`example_cluster_plot_mini_batch_kmeans.py` .. raw:: html

We want to compare the performance of the MiniBatchKMeans and KMeans: the MiniBatchKMeans is fa...

.. toctree:: :hidden: cluster/plot_mini_batch_kmeans .. raw:: html
.. _covariance_examples: Covariance estimation --------------------- Examples concerning the :mod:`sklearn.covariance` package. .. raw:: html
.. figure:: covariance/images/thumb/plot_lw_vs_oas.png :target: ./covariance/plot_lw_vs_oas.html :ref:`example_covariance_plot_lw_vs_oas.py` .. raw:: html

The usual covariance maximum likelihood estimate can be regularized using shrinkage. Ledoit and...

.. toctree:: :hidden: covariance/plot_lw_vs_oas .. raw:: html
.. figure:: covariance/images/thumb/plot_outlier_detection.png :target: ./covariance/plot_outlier_detection.html :ref:`example_covariance_plot_outlier_detection.py` .. raw:: html

When the amount of contamination is known, this example illustrates two different ways of perfo...

.. toctree:: :hidden: covariance/plot_outlier_detection .. raw:: html
.. figure:: covariance/images/thumb/plot_sparse_cov.png :target: ./covariance/plot_sparse_cov.html :ref:`example_covariance_plot_sparse_cov.py` .. raw:: html

Using the GraphLasso estimator to learn a covariance and sparse precision from a small number o...

.. toctree:: :hidden: covariance/plot_sparse_cov .. raw:: html
.. figure:: covariance/images/thumb/plot_covariance_estimation.png :target: ./covariance/plot_covariance_estimation.html :ref:`example_covariance_plot_covariance_estimation.py` .. raw:: html

When working with covariance estimation, the usual approach is to use a maximum likelihood esti...

.. toctree:: :hidden: covariance/plot_covariance_estimation .. raw:: html
.. figure:: covariance/images/thumb/plot_mahalanobis_distances.png :target: ./covariance/plot_mahalanobis_distances.html :ref:`example_covariance_plot_mahalanobis_distances.py` .. raw:: html

An example to show covariance estimation with the Mahalanobis distances on Gaussian distributed...

.. toctree:: :hidden: covariance/plot_mahalanobis_distances .. raw:: html
.. figure:: covariance/images/thumb/plot_robust_vs_empirical_covariance.png :target: ./covariance/plot_robust_vs_empirical_covariance.html :ref:`example_covariance_plot_robust_vs_empirical_covariance.py` .. raw:: html

The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers ...

.. toctree:: :hidden: covariance/plot_robust_vs_empirical_covariance .. raw:: html
.. _cross_decomposition_examples: Cross decomposition ------------------- Examples concerning the :mod:`sklearn.cross_decomposition` package. .. raw:: html
.. figure:: cross_decomposition/images/thumb/plot_compare_cross_decomposition.png :target: ./cross_decomposition/plot_compare_cross_decomposition.html :ref:`example_cross_decomposition_plot_compare_cross_decomposition.py` .. raw:: html

Simple usage of various cross decomposition algorithms: - PLSCanonical - PLSRegression, with mu...

.. toctree:: :hidden: cross_decomposition/plot_compare_cross_decomposition .. raw:: html
.. _dataset_examples: Dataset examples ----------------------- Examples concerning the :mod:`sklearn.datasets` package. .. raw:: html
.. figure:: datasets/images/thumb/plot_digits_last_image.png :target: ./datasets/plot_digits_last_image.html :ref:`example_datasets_plot_digits_last_image.py` .. raw:: html

This dataset is made up of 1797 8x8 images. Each image, like the one shown below, is of a hand-...

.. toctree:: :hidden: datasets/plot_digits_last_image .. raw:: html
.. figure:: datasets/images/thumb/plot_random_dataset.png :target: ./datasets/plot_random_dataset.html :ref:`example_datasets_plot_random_dataset.py` .. raw:: html

Plot several randomly generated 2D classification datasets. This example illustrates the `datas...

.. toctree:: :hidden: datasets/plot_random_dataset .. raw:: html
.. figure:: datasets/images/thumb/plot_iris_dataset.png :target: ./datasets/plot_iris_dataset.html :ref:`example_datasets_plot_iris_dataset.py` .. raw:: html

The rows being the samples and the columns being: Sepal Length, Sepal Width, Petal Length and P...

.. toctree:: :hidden: datasets/plot_iris_dataset .. raw:: html
.. _decomposition_examples: Decomposition ------------- Examples concerning the :mod:`sklearn.decomposition` package. .. raw:: html
.. figure:: decomposition/images/thumb/plot_pca_vs_lda.png :target: ./decomposition/plot_pca_vs_lda.html :ref:`example_decomposition_plot_pca_vs_lda.py` .. raw:: html

The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 a...

.. toctree:: :hidden: decomposition/plot_pca_vs_lda .. raw:: html
.. figure:: decomposition/images/thumb/plot_pca_iris.png :target: ./decomposition/plot_pca_iris.html :ref:`example_decomposition_plot_pca_iris.py` .. raw:: html

Principal Component Analysis applied to the Iris dataset.

.. toctree:: :hidden: decomposition/plot_pca_iris .. raw:: html
.. figure:: decomposition/images/thumb/plot_ica_blind_source_separation.png :target: ./decomposition/plot_ica_blind_source_separation.html :ref:`example_decomposition_plot_ica_blind_source_separation.py` .. raw:: html

An example of estimating sources from noisy data.

.. toctree:: :hidden: decomposition/plot_ica_blind_source_separation .. raw:: html
.. figure:: decomposition/images/thumb/plot_kernel_pca.png :target: ./decomposition/plot_kernel_pca.html :ref:`example_decomposition_plot_kernel_pca.py` .. raw:: html

This example shows that Kernel PCA is able to find a projection of the data that makes data lin...

.. toctree:: :hidden: decomposition/plot_kernel_pca .. raw:: html
.. figure:: decomposition/images/thumb/plot_ica_vs_pca.png :target: ./decomposition/plot_ica_vs_pca.html :ref:`example_decomposition_plot_ica_vs_pca.py` .. raw:: html

This example illustrates visually in the feature space a comparison by results using two differ...

.. toctree:: :hidden: decomposition/plot_ica_vs_pca .. raw:: html
.. figure:: decomposition/images/thumb/plot_sparse_coding.png :target: ./decomposition/plot_sparse_coding.html :ref:`example_decomposition_plot_sparse_coding.py` .. raw:: html

Transform a signal as a sparse combination of Ricker wavelets. This example visually compares d...

.. toctree:: :hidden: decomposition/plot_sparse_coding .. raw:: html
.. figure:: decomposition/images/thumb/plot_pca_3d.png :target: ./decomposition/plot_pca_3d.html :ref:`example_decomposition_plot_pca_3d.py` .. raw:: html

These figures aid in illustrating how a point cloud can be very flat in one direction--which is...

.. toctree:: :hidden: decomposition/plot_pca_3d .. raw:: html
.. figure:: decomposition/images/thumb/plot_pca_vs_fa_model_selection.png :target: ./decomposition/plot_pca_vs_fa_model_selection.html :ref:`example_decomposition_plot_pca_vs_fa_model_selection.py` .. raw:: html

Probabilistic PCA and Factor Analysis are probabilistic models. The consequence is that the lik...

.. toctree:: :hidden: decomposition/plot_pca_vs_fa_model_selection .. raw:: html
.. figure:: decomposition/images/thumb/plot_faces_decomposition.png :target: ./decomposition/plot_faces_decomposition.html :ref:`example_decomposition_plot_faces_decomposition.py` .. raw:: html

This example applies to :ref:`olivetti_faces` different unsupervised matrix decomposition (dime...

.. toctree:: :hidden: decomposition/plot_faces_decomposition .. raw:: html
.. figure:: decomposition/images/thumb/plot_image_denoising.png :target: ./decomposition/plot_image_denoising.html :ref:`example_decomposition_plot_image_denoising.py` .. raw:: html

An example comparing the effect of reconstructing noisy fragments of the Lena image using first...

.. toctree:: :hidden: decomposition/plot_image_denoising .. raw:: html
.. _ensemble_examples: Ensemble methods ---------------- Examples concerning the :mod:`sklearn.ensemble` package. .. raw:: html
.. figure:: ensemble/images/thumb/plot_forest_importances_faces.png :target: ./ensemble/plot_forest_importances_faces.html :ref:`example_ensemble_plot_forest_importances_faces.py` .. raw:: html

This example shows the use of forests of trees to evaluate the importance of the pixels in an i...

.. toctree:: :hidden: ensemble/plot_forest_importances_faces .. raw:: html

A decision tree is boosted using the AdaBoost.R2 [1] algorithm on a 1D sinusoidal dataset with ...

.. toctree:: :hidden: ensemble/plot_adaboost_regression .. raw:: html
.. figure:: ensemble/images/thumb/plot_forest_importances.png :target: ./ensemble/plot_forest_importances.html :ref:`example_ensemble_plot_forest_importances.py` .. raw:: html

This examples shows the use of forests of trees to evaluate the importance of features on an ar...

.. toctree:: :hidden: ensemble/plot_forest_importances .. raw:: html

Illustration of the effect of different regularization strategies for Gradient Boosting. The ex...

.. toctree:: :hidden: ensemble/plot_gradient_boosting_regularization .. raw:: html
.. figure:: ensemble/images/thumb/plot_partial_dependence.png :target: ./ensemble/plot_partial_dependence.html :ref:`example_ensemble_plot_partial_dependence.py` .. raw:: html

Partial dependence plots show the dependence between the target function [1]_ and a set of 'tar...

.. toctree:: :hidden: ensemble/plot_partial_dependence .. raw:: html

Demonstrate Gradient Boosting on the boston housing dataset.

.. toctree:: :hidden: ensemble/plot_gradient_boosting_regression .. raw:: html

This example shows how quantile regression can be used to create prediction intervals.

.. toctree:: :hidden: ensemble/plot_gradient_boosting_quantile .. raw:: html

This example fits an AdaBoosted decision stump on a non-linearly separable classification datas...

.. toctree:: :hidden: ensemble/plot_adaboost_twoclass .. raw:: html
.. figure:: ensemble/images/thumb/plot_random_forest_embedding.png :target: ./ensemble/plot_random_forest_embedding.html :ref:`example_ensemble_plot_random_forest_embedding.py` .. raw:: html

RandomTreesEmbedding provides a way to map data to a very high-dimensional, sparse representati...

.. toctree:: :hidden: ensemble/plot_random_forest_embedding .. raw:: html

This example is based on Figure 10.2 from Hastie et al 2009 [1] and illustrates the difference ...

.. toctree:: :hidden: ensemble/plot_adaboost_hastie_10_2 .. raw:: html

This example reproduces Figure 1 of Zhu et al [1] and shows how boosting can improve prediction...

.. toctree:: :hidden: ensemble/plot_adaboost_multiclass .. raw:: html

Out-of-bag (OOB) estimates can be a useful heuristic to estimate the "optimal" number of boosti...

.. toctree:: :hidden: ensemble/plot_gradient_boosting_oob .. raw:: html
.. figure:: ensemble/images/thumb/plot_forest_iris.png :target: ./ensemble/plot_forest_iris.html :ref:`example_ensemble_plot_forest_iris.py` .. raw:: html

Plot the decision surfaces of forests of randomized trees trained on pairs of features of the i...

.. toctree:: :hidden: ensemble/plot_forest_iris .. raw:: html
.. figure:: ensemble/images/thumb/plot_bias_variance.png :target: ./ensemble/plot_bias_variance.html :ref:`example_ensemble_plot_bias_variance.py` .. raw:: html

This example illustrates and compares the bias-variance decomposition of the expected mean squa...

.. toctree:: :hidden: ensemble/plot_bias_variance .. raw:: html
Tutorial exercises ------------------ Exercises for the tutorials .. raw:: html
.. figure:: exercises/images/thumb/digits_classification_exercise.png :target: ./exercises/digits_classification_exercise.html :ref:`example_exercises_digits_classification_exercise.py` .. raw:: html

A tutorial exercise regarding the use of classification techniques on the Digits dataset.

.. toctree:: :hidden: exercises/digits_classification_exercise .. raw:: html
.. figure:: exercises/images/thumb/plot_cv_digits.png :target: ./exercises/plot_cv_digits.html :ref:`example_exercises_plot_cv_digits.py` .. raw:: html

A tutorial excercise using Cross-validation with an SVM on the Digits dataset.

.. toctree:: :hidden: exercises/plot_cv_digits .. raw:: html
.. figure:: exercises/images/thumb/plot_iris_exercise.png :target: ./exercises/plot_iris_exercise.html :ref:`example_exercises_plot_iris_exercise.py` .. raw:: html

A tutorial exercise for using different SVM kernels.

.. toctree:: :hidden: exercises/plot_iris_exercise .. raw:: html
.. figure:: exercises/images/thumb/plot_cv_diabetes.png :target: ./exercises/plot_cv_diabetes.html :ref:`example_exercises_plot_cv_diabetes.py` .. raw:: html

A tutorial excercise which uses cross-validation with linear models.

.. toctree:: :hidden: exercises/plot_cv_diabetes .. raw:: html
.. _gaussian_process_examples: Gaussian Process for Machine Learning ------------------------------------- Examples concerning the :mod:`sklearn.gaussian_process` package. .. raw:: html
.. figure:: gaussian_process/images/thumb/gp_diabetes_dataset.png :target: ./gaussian_process/gp_diabetes_dataset.html :ref:`example_gaussian_process_gp_diabetes_dataset.py` .. raw:: html

This example consists in fitting a Gaussian Process model onto the diabetes dataset.

.. toctree:: :hidden: gaussian_process/gp_diabetes_dataset .. raw:: html
.. figure:: gaussian_process/images/thumb/plot_gp_probabilistic_classification_after_regression.png :target: ./gaussian_process/plot_gp_probabilistic_classification_after_regression.html :ref:`example_gaussian_process_plot_gp_probabilistic_classification_after_regression.py` .. raw:: html

A two-dimensional regression exercise with a post-processing allowing for probabilistic classif...

.. toctree:: :hidden: gaussian_process/plot_gp_probabilistic_classification_after_regression .. raw:: html
.. figure:: gaussian_process/images/thumb/plot_gp_regression.png :target: ./gaussian_process/plot_gp_regression.html :ref:`example_gaussian_process_plot_gp_regression.py` .. raw:: html

A simple one-dimensional regression exercise computed in two different ways:

.. toctree:: :hidden: gaussian_process/plot_gp_regression .. raw:: html
.. _linear_examples: Generalized Linear Models ------------------------- Examples concerning the :mod:`sklearn.linear_model` package. .. raw:: html
.. figure:: linear_model/images/thumb/plot_lasso_lars.png :target: ./linear_model/plot_lasso_lars.html :ref:`example_linear_model_plot_lasso_lars.py` .. raw:: html

Computes Lasso Path along the regularization parameter using the LARS algorithm on the diabetes...

.. toctree:: :hidden: linear_model/plot_lasso_lars .. raw:: html
.. figure:: linear_model/images/thumb/plot_sgd_loss_functions.png :target: ./linear_model/plot_sgd_loss_functions.html :ref:`example_linear_model_plot_sgd_loss_functions.py` .. raw:: html

A plot that compares the various convex loss functions supported by :class:`sklearn.linear_mode...

.. toctree:: :hidden: linear_model/plot_sgd_loss_functions .. raw:: html
.. figure:: linear_model/images/thumb/plot_sgd_separating_hyperplane.png :target: ./linear_model/plot_sgd_separating_hyperplane.html :ref:`example_linear_model_plot_sgd_separating_hyperplane.py` .. raw:: html

Plot the maximum margin separating hyperplane within a two-class separable dataset using a line...

.. toctree:: :hidden: linear_model/plot_sgd_separating_hyperplane .. raw:: html
.. figure:: linear_model/images/thumb/plot_sgd_weighted_samples.png :target: ./linear_model/plot_sgd_weighted_samples.html :ref:`example_linear_model_plot_sgd_weighted_samples.py` .. raw:: html

Plot decision function of a weighted dataset, where the size of points is proportional to its w...

.. toctree:: :hidden: linear_model/plot_sgd_weighted_samples .. raw:: html
.. figure:: linear_model/images/thumb/plot_ridge_path.png :target: ./linear_model/plot_ridge_path.html :ref:`example_linear_model_plot_ridge_path.py` .. raw:: html

Shows the effect of collinearity in the coefficients of an estimator.

.. toctree:: :hidden: linear_model/plot_ridge_path .. raw:: html
.. figure:: linear_model/images/thumb/plot_sgd_comparison.png :target: ./linear_model/plot_sgd_comparison.html :ref:`example_linear_model_plot_sgd_comparison.py` .. raw:: html

An example showing how different online solvers perform on the hand-written digits dataset.

.. toctree:: :hidden: linear_model/plot_sgd_comparison .. raw:: html
.. figure:: linear_model/images/thumb/plot_ransac.png :target: ./linear_model/plot_ransac.html :ref:`example_linear_model_plot_ransac.py` .. raw:: html

In this example we see how to robustly fit a linear model to faulty data using the RANSAC algor...

.. toctree:: :hidden: linear_model/plot_ransac .. raw:: html
.. figure:: linear_model/images/thumb/plot_polynomial_interpolation.png :target: ./linear_model/plot_polynomial_interpolation.html :ref:`example_linear_model_plot_polynomial_interpolation.py` .. raw:: html

This example demonstrates how to approximate a function with a polynomial of degree n_degree by...

.. toctree:: :hidden: linear_model/plot_polynomial_interpolation .. raw:: html
.. figure:: linear_model/images/thumb/plot_iris_logistic.png :target: ./linear_model/plot_iris_logistic.html :ref:`example_linear_model_plot_iris_logistic.py` .. raw:: html

Show below is a logistic-regression classifiers decision boundaries on the `iris

.. toctree:: :hidden: linear_model/plot_iris_logistic .. raw:: html
.. figure:: linear_model/images/thumb/plot_logistic_path.png :target: ./linear_model/plot_logistic_path.html :ref:`example_linear_model_plot_logistic_path.py` .. raw:: html

Computes path on IRIS dataset.

.. toctree:: :hidden: linear_model/plot_logistic_path .. raw:: html
.. figure:: linear_model/images/thumb/plot_ols_ridge_variance.png :target: ./linear_model/plot_ols_ridge_variance.html :ref:`example_linear_model_plot_ols_ridge_variance.py` .. raw:: html

Ridge regression is basically minimizing a penalised version of the least-squared function. The...

.. toctree:: :hidden: linear_model/plot_ols_ridge_variance .. raw:: html
.. figure:: linear_model/images/thumb/plot_ols.png :target: ./linear_model/plot_ols.html :ref:`example_linear_model_plot_ols.py` .. raw:: html

The coefficients, the residual sum of squares and the variance score are also calculated.

.. toctree:: :hidden: linear_model/plot_ols .. raw:: html
.. figure:: linear_model/images/thumb/plot_logistic.png :target: ./linear_model/plot_logistic.html :ref:`example_linear_model_plot_logistic.py` .. raw:: html

Show in the plot is how the logistic regression would, in this synthetic dataset, classify valu...

.. toctree:: :hidden: linear_model/plot_logistic .. raw:: html

The multi-task lasso allows to fit multiple regression problems jointly enforcing the selected ...

.. toctree:: :hidden: linear_model/plot_multi_task_lasso_support .. raw:: html
.. figure:: linear_model/images/thumb/plot_sgd_penalties.png :target: ./linear_model/plot_sgd_penalties.html :ref:`example_linear_model_plot_sgd_penalties.py` .. raw:: html

Plot the contours of the three penalties.

.. toctree:: :hidden: linear_model/plot_sgd_penalties .. raw:: html
.. figure:: linear_model/images/thumb/lasso_dense_vs_sparse_data.png :target: ./linear_model/lasso_dense_vs_sparse_data.html :ref:`example_linear_model_lasso_dense_vs_sparse_data.py` .. raw:: html

We show that linear_model.Lasso provides the same results for dense and sparse data and that in...

.. toctree:: :hidden: linear_model/lasso_dense_vs_sparse_data .. raw:: html
.. figure:: linear_model/images/thumb/plot_lasso_and_elasticnet.png :target: ./linear_model/plot_lasso_and_elasticnet.html :ref:`example_linear_model_plot_lasso_and_elasticnet.py` .. raw:: html

Estimates Lasso and Elastic-Net regression models on a manually generated sparse signal corrupt...

.. toctree:: :hidden: linear_model/plot_lasso_and_elasticnet .. raw:: html
.. figure:: linear_model/images/thumb/plot_bayesian_ridge.png :target: ./linear_model/plot_bayesian_ridge.html :ref:`example_linear_model_plot_bayesian_ridge.py` .. raw:: html

Computes a Bayesian Ridge Regression on a synthetic dataset.

.. toctree:: :hidden: linear_model/plot_bayesian_ridge .. raw:: html
.. figure:: linear_model/images/thumb/plot_ols_3d.png :target: ./linear_model/plot_ols_3d.html :ref:`example_linear_model_plot_ols_3d.py` .. raw:: html

Features 1 and 2 of the diabetes-dataset are fitted and plotted below. It illustrates that alth...

.. toctree:: :hidden: linear_model/plot_ols_3d .. raw:: html
.. figure:: linear_model/images/thumb/plot_ard.png :target: ./linear_model/plot_ard.html :ref:`example_linear_model_plot_ard.py` .. raw:: html

Fit regression model with Bayesian Ridge Regression.

.. toctree:: :hidden: linear_model/plot_ard .. raw:: html
.. figure:: linear_model/images/thumb/plot_logistic_l1_l2_sparsity.png :target: ./linear_model/plot_logistic_l1_l2_sparsity.html :ref:`example_linear_model_plot_logistic_l1_l2_sparsity.py` .. raw:: html

Comparison of the sparsity (percentage of zero coefficients) of solutions when L1 and L2 penalt...

.. toctree:: :hidden: linear_model/plot_logistic_l1_l2_sparsity .. raw:: html
.. figure:: linear_model/images/thumb/plot_sgd_iris.png :target: ./linear_model/plot_sgd_iris.html :ref:`example_linear_model_plot_sgd_iris.py` .. raw:: html

Plot decision surface of multi-class SGD on iris dataset. The hyperplanes corresponding to the ...

.. toctree:: :hidden: linear_model/plot_sgd_iris .. raw:: html
.. figure:: linear_model/images/thumb/plot_omp.png :target: ./linear_model/plot_omp.html :ref:`example_linear_model_plot_omp.py` .. raw:: html

Using orthogonal matching pursuit for recovering a sparse signal from a noisy measurement encod...

.. toctree:: :hidden: linear_model/plot_omp .. raw:: html
.. figure:: linear_model/images/thumb/plot_lasso_coordinate_descent_path.png :target: ./linear_model/plot_lasso_coordinate_descent_path.html :ref:`example_linear_model_plot_lasso_coordinate_descent_path.py` .. raw:: html

Lasso and elastic net (L1 and L2 penalisation) implemented using a coordinate descent.

.. toctree:: :hidden: linear_model/plot_lasso_coordinate_descent_path .. raw:: html
.. figure:: linear_model/images/thumb/plot_lasso_model_selection.png :target: ./linear_model/plot_lasso_model_selection.html :ref:`example_linear_model_plot_lasso_model_selection.py` .. raw:: html

Use the Akaike information criterion (AIC), the Bayes Information criterion (BIC) and cross-val...

.. toctree:: :hidden: linear_model/plot_lasso_model_selection .. raw:: html
.. figure:: linear_model/images/thumb/plot_sparse_recovery.png :target: ./linear_model/plot_sparse_recovery.html :ref:`example_linear_model_plot_sparse_recovery.py` .. raw:: html

Given a small number of observations, we want to recover which features of X are relevant to ex...

.. toctree:: :hidden: linear_model/plot_sparse_recovery .. raw:: html
.. _manifold_examples: Manifold learning ----------------------- Examples concerning the :mod:`sklearn.manifold` package. .. raw:: html
.. figure:: manifold/images/thumb/plot_swissroll.png :target: ./manifold/plot_swissroll.html :ref:`example_manifold_plot_swissroll.py` .. raw:: html

An illustration of Swiss Roll reduction with locally linear embedding

.. toctree:: :hidden: manifold/plot_swissroll .. raw:: html
.. figure:: manifold/images/thumb/plot_mds.png :target: ./manifold/plot_mds.html :ref:`example_manifold_plot_mds.py` .. raw:: html

An illustration of the metric and non-metric MDS on generated noisy data.

.. toctree:: :hidden: manifold/plot_mds .. raw:: html
.. figure:: manifold/images/thumb/plot_compare_methods.png :target: ./manifold/plot_compare_methods.html :ref:`example_manifold_plot_compare_methods.py` .. raw:: html

An illustration of dimensionality reduction on the S-curve dataset with various manifold learni...

.. toctree:: :hidden: manifold/plot_compare_methods .. raw:: html
.. figure:: manifold/images/thumb/plot_manifold_sphere.png :target: ./manifold/plot_manifold_sphere.html :ref:`example_manifold_plot_manifold_sphere.py` .. raw:: html

An application of the different :ref:`manifold` techniques on a spherical data-set. Here one ca...

.. toctree:: :hidden: manifold/plot_manifold_sphere .. raw:: html
.. figure:: manifold/images/thumb/plot_lle_digits.png :target: ./manifold/plot_lle_digits.html :ref:`example_manifold_plot_lle_digits.py` .. raw:: html

An illustration of various embeddings on the digits dataset.

.. toctree:: :hidden: manifold/plot_lle_digits .. raw:: html
.. _mixture_examples: Gaussian Mixture Models ----------------------- Examples concerning the :mod:`sklearn.mixture` package. .. raw:: html
.. figure:: mixture/images/thumb/plot_gmm_pdf.png :target: ./mixture/plot_gmm_pdf.html :ref:`example_mixture_plot_gmm_pdf.py` .. raw:: html

Plot the density estimation of a mixture of two Gaussians. Data is generated from two Gaussians...

.. toctree:: :hidden: mixture/plot_gmm_pdf .. raw:: html
.. figure:: mixture/images/thumb/plot_gmm.png :target: ./mixture/plot_gmm.html :ref:`example_mixture_plot_gmm.py` .. raw:: html

Plot the confidence ellipsoids of a mixture of two Gaussians with EM and variational Dirichlet ...

.. toctree:: :hidden: mixture/plot_gmm .. raw:: html
.. figure:: mixture/images/thumb/plot_gmm_sin.png :target: ./mixture/plot_gmm_sin.html :ref:`example_mixture_plot_gmm_sin.py` .. raw:: html

This example highlights the advantages of the Dirichlet Process: complexity control and dealing...

.. toctree:: :hidden: mixture/plot_gmm_sin .. raw:: html
.. figure:: mixture/images/thumb/plot_gmm_selection.png :target: ./mixture/plot_gmm_selection.html :ref:`example_mixture_plot_gmm_selection.py` .. raw:: html

This example shows that model selection can be performed with Gaussian Mixture Models using inf...

.. toctree:: :hidden: mixture/plot_gmm_selection .. raw:: html
.. figure:: mixture/images/thumb/plot_gmm_classifier.png :target: ./mixture/plot_gmm_classifier.html :ref:`example_mixture_plot_gmm_classifier.py` .. raw:: html

Demonstration of Gaussian mixture models for classification.

.. toctree:: :hidden: mixture/plot_gmm_classifier .. raw:: html
.. _neighbors_examples: Nearest Neighbors ----------------------- Examples concerning the :mod:`sklearn.neighbors` package. .. raw:: html
.. figure:: neighbors/images/thumb/plot_regression.png :target: ./neighbors/plot_regression.html :ref:`example_neighbors_plot_regression.py` .. raw:: html

Demonstrate the resolution of a regression problem using a k-Nearest Neighbor and the interpola...

.. toctree:: :hidden: neighbors/plot_regression .. raw:: html
.. figure:: neighbors/images/thumb/plot_classification.png :target: ./neighbors/plot_classification.html :ref:`example_neighbors_plot_classification.py` .. raw:: html

Sample usage of Nearest Neighbors classification. It will plot the decision boundaries for each...

.. toctree:: :hidden: neighbors/plot_classification .. raw:: html
.. figure:: neighbors/images/thumb/plot_nearest_centroid.png :target: ./neighbors/plot_nearest_centroid.html :ref:`example_neighbors_plot_nearest_centroid.py` .. raw:: html

Sample usage of Nearest Centroid classification. It will plot the decision boundaries for each ...

.. toctree:: :hidden: neighbors/plot_nearest_centroid .. raw:: html
.. figure:: neighbors/images/thumb/plot_digits_kde_sampling.png :target: ./neighbors/plot_digits_kde_sampling.html :ref:`example_neighbors_plot_digits_kde_sampling.py` .. raw:: html

This example shows how kernel density estimation (KDE), a powerful non-parametric density estim...

.. toctree:: :hidden: neighbors/plot_digits_kde_sampling .. raw:: html
.. figure:: neighbors/images/thumb/plot_species_kde.png :target: ./neighbors/plot_species_kde.html :ref:`example_neighbors_plot_species_kde.py` .. raw:: html

This example does not perform any learning over the data (see :ref:`example_applications_plot_s...

.. toctree:: :hidden: neighbors/plot_species_kde .. raw:: html
.. figure:: neighbors/images/thumb/plot_kde_1d.png :target: ./neighbors/plot_kde_1d.html :ref:`example_neighbors_plot_kde_1d.py` .. raw:: html

The first plot shows one of the problems with using histograms to visualize the density of poin...

.. toctree:: :hidden: neighbors/plot_kde_1d .. raw:: html
.. raw:: html
.. _semi_supervised_examples: Semi Supervised Classification ------------------------------ Examples concerning the :mod:`sklearn.semi_supervised` package. .. raw:: html
.. figure:: semi_supervised/images/thumb/plot_label_propagation_structure.png :target: ./semi_supervised/plot_label_propagation_structure.html :ref:`example_semi_supervised_plot_label_propagation_structure.py` .. raw:: html

Example of LabelPropagation learning a complex internal structure to demonstrate "manifold lear...

.. toctree:: :hidden: semi_supervised/plot_label_propagation_structure .. raw:: html
.. figure:: semi_supervised/images/thumb/plot_label_propagation_versus_svm_iris.png :target: ./semi_supervised/plot_label_propagation_versus_svm_iris.html :ref:`example_semi_supervised_plot_label_propagation_versus_svm_iris.py` .. raw:: html

Comparison for decision boundary generated on iris dataset between Label Propagation and SVM.

.. toctree:: :hidden: semi_supervised/plot_label_propagation_versus_svm_iris .. raw:: html
.. figure:: semi_supervised/images/thumb/plot_label_propagation_digits.png :target: ./semi_supervised/plot_label_propagation_digits.html :ref:`example_semi_supervised_plot_label_propagation_digits.py` .. raw:: html

This example demonstrates the power of semisupervised learning by training a Label Spreading mo...

.. toctree:: :hidden: semi_supervised/plot_label_propagation_digits .. raw:: html
.. figure:: semi_supervised/images/thumb/plot_label_propagation_digits_active_learning.png :target: ./semi_supervised/plot_label_propagation_digits_active_learning.html :ref:`example_semi_supervised_plot_label_propagation_digits_active_learning.py` .. raw:: html

Demonstrates an active learning technique to learn handwritten digits using label propagation.

.. toctree:: :hidden: semi_supervised/plot_label_propagation_digits_active_learning .. raw:: html
.. _svm_examples: Support Vector Machines ----------------------- Examples concerning the :mod:`sklearn.svm` package. .. raw:: html
.. figure:: svm/images/thumb/plot_svm_nonlinear.png :target: ./svm/plot_svm_nonlinear.html :ref:`example_svm_plot_svm_nonlinear.py` .. raw:: html

Perform binary classification using non-linear SVC with RBF kernel. The target to predict is a ...

.. toctree:: :hidden: svm/plot_svm_nonlinear .. raw:: html
.. figure:: svm/images/thumb/plot_svm_regression.png :target: ./svm/plot_svm_regression.html :ref:`example_svm_plot_svm_regression.py` .. raw:: html

Toy example of 1D regression using linear, polynomial and RBF kernels.

.. toctree:: :hidden: svm/plot_svm_regression .. raw:: html
.. figure:: svm/images/thumb/plot_separating_hyperplane.png :target: ./svm/plot_separating_hyperplane.html :ref:`example_svm_plot_separating_hyperplane.py` .. raw:: html

Plot the maximum margin separating hyperplane within a two-class separable dataset using a Supp...

.. toctree:: :hidden: svm/plot_separating_hyperplane .. raw:: html
.. figure:: svm/images/thumb/plot_separating_hyperplane_unbalanced.png :target: ./svm/plot_separating_hyperplane_unbalanced.html :ref:`example_svm_plot_separating_hyperplane_unbalanced.py` .. raw:: html

Find the optimal separating hyperplane using an SVC for classes that are unbalanced.

.. toctree:: :hidden: svm/plot_separating_hyperplane_unbalanced .. raw:: html
.. figure:: svm/images/thumb/plot_custom_kernel.png :target: ./svm/plot_custom_kernel.html :ref:`example_svm_plot_custom_kernel.py` .. raw:: html

Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface...

.. toctree:: :hidden: svm/plot_custom_kernel .. raw:: html
.. figure:: svm/images/thumb/plot_svm_anova.png :target: ./svm/plot_svm_anova.html :ref:`example_svm_plot_svm_anova.py` .. raw:: html

This example shows how to perform univariate feature before running a SVC (support vector class...

.. toctree:: :hidden: svm/plot_svm_anova .. raw:: html
.. figure:: svm/images/thumb/plot_weighted_samples.png :target: ./svm/plot_weighted_samples.html :ref:`example_svm_plot_weighted_samples.py` .. raw:: html

Plot decision function of a weighted dataset, where the size of points is proportional to its w...

.. toctree:: :hidden: svm/plot_weighted_samples .. raw:: html
.. figure:: svm/images/thumb/plot_oneclass.png :target: ./svm/plot_oneclass.html :ref:`example_svm_plot_oneclass.py` .. raw:: html

An example using a one-class SVM for novelty detection.

.. toctree:: :hidden: svm/plot_oneclass .. raw:: html
.. figure:: svm/images/thumb/plot_iris.png :target: ./svm/plot_iris.html :ref:`example_svm_plot_iris.py` .. raw:: html

Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only ...

.. toctree:: :hidden: svm/plot_iris .. raw:: html
.. figure:: svm/images/thumb/plot_svm_kernels.png :target: ./svm/plot_svm_kernels.html :ref:`example_svm_plot_svm_kernels.py` .. raw:: html

Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially...

.. toctree:: :hidden: svm/plot_svm_kernels .. raw:: html
.. figure:: svm/images/thumb/plot_svm_margin.png :target: ./svm/plot_svm_margin.html :ref:`example_svm_plot_svm_margin.py` .. raw:: html

A small value of `C` includes more/all the observations, allowing the margins to be calculated ...

.. toctree:: :hidden: svm/plot_svm_margin .. raw:: html
.. figure:: svm/images/thumb/plot_svm_scale_c.png :target: ./svm/plot_svm_scale_c.html :ref:`example_svm_plot_svm_scale_c.py` .. raw:: html

The following example illustrates the effect of scaling the regularization parameter when using...

.. toctree:: :hidden: svm/plot_svm_scale_c .. raw:: html
.. figure:: svm/images/thumb/plot_rbf_parameters.png :target: ./svm/plot_rbf_parameters.html :ref:`example_svm_plot_rbf_parameters.py` .. raw:: html

This example illustrates the effect of the parameters `gamma` and `C` of the rbf kernel SVM.

.. toctree:: :hidden: svm/plot_rbf_parameters .. raw:: html
.. _tree_examples: Decision Trees -------------- Examples concerning the :mod:`sklearn.tree` package. .. raw:: html
.. figure:: tree/images/thumb/plot_tree_regression.png :target: ./tree/plot_tree_regression.html :ref:`example_tree_plot_tree_regression.py` .. raw:: html

A 1D regression with decision tree.

.. toctree:: :hidden: tree/plot_tree_regression .. raw:: html
.. figure:: tree/images/thumb/plot_tree_regression_multioutput.png :target: ./tree/plot_tree_regression_multioutput.html :ref:`example_tree_plot_tree_regression_multioutput.py` .. raw:: html

An example to illustrate multi-output regression with decision tree.

.. toctree:: :hidden: tree/plot_tree_regression_multioutput .. raw:: html
.. figure:: tree/images/thumb/plot_iris.png :target: ./tree/plot_iris.html :ref:`example_tree_plot_iris.py` .. raw:: html

Plot the decision surface of a decision tree trained on pairs of features of the iris dataset.

.. toctree:: :hidden: tree/plot_iris .. raw:: html