====== scikit-learn Exemples ====== **{{tagpage>ia|Intelligence Artificielle}}** **[[http://translate.google.com/translate?hl=&sl=auto&tl=en&u=https%3A%2F%2Fressources.labomedia.org%2Fscikit-learn_exemples|English Version]]** **[[les_pages_intelligence_artificielle_en_details|Les Pages Intelligence Artificielle en détails]]** =====scikit-learn===== Initié et piloté en France par l'INRIA et Télécom ParisTech, le projet open source Scikit-learn est devenu une référence dans le monde de l'intelligence artificielle. * **[[https://scikit-learn.org/stable/index.html|scikit-learn.org]]** Scikit-learn est une bibliothèque libre Python destinée à l'apprentissage automatique. * **[[https://fr.wikipedia.org/wiki/Scikit-learn|Scikit-learn sur fr.wikipedia.org]]** * Simple and efficient tools for predictive data analysis * Accessible to everybody, and reusable in various contexts * Built on NumPy, SciPy, and matplotlib * Open source, commercially usable - BSD license * **[[https://scikit-learn.org/dev/user_guide.html|User Guide:]]** Toutes les possibilités =====Exemples de classification===== Les exemples sont construits sur les digits de **[[https://www.kaggle.com/vikramtiwari/mnist-numpy|mnist-numpy]]** This is classic MNIST dataset and pickled (in npz format). ====Classification==== * **[[https://fr.wikipedia.org/wiki/Classement_automatique|Classement automatique]]** sur Wikipedia. Le classement automatique ou classification supervisée est la catégorisation algorithmique d'objets. Elle consiste à attribuer une classe ou catégorie à chaque objet (ausens large) à classer, en se basant sur des données statistiques. Le jeu de données d'entrées comprend "x_train __et__ y_train". ==== Sources des fichiers ==== * **[[https://github.com/sergeLabo/scikit-learn|scikit-learn @ github.com/sergeLabo]]** ==== kneighborsclassifier.py ==== * [[https://towardsdatascience.com/understanding-and-using-k-nearest-neighbours-aka-knn-for-classification-of-digits-a55e00cc746f|understanding and using k-nearest-neighbours]] * [[https://github.com/sergeLabo/scikit-learn/blob/main/kneighborsclassifier.py|kneighborsclassifier.py]] {{ :media_14:kneighborsclassifier.png?400 |}} ==== MNIST classification using multinomial logistic + L1 ==== Here we fit a multinomial logistic regression with L1 penalty on a subset of the MNIST digits classification task. * [[https://github.com/sergeLabo/scikit-learn/blob/main/sparse_logistic_regression.py|sparse_logistic_regression.py]] * https://scikit-learn.org/stable/auto_examples/linear_model/plot_sparse_logistic_regression_mnist.html {{ :media_14:sparse_logistic_regression.png?400 |}} ====Recognizing hand-written digits==== An example showing how the scikit-learn can be used to recognize images of hand-written digits. * [[https://github.com/sergeLabo/scikit-learn/blob/main/digits_classification_svc.py|digits_classification_svc.py]] * https://scikit-learn.org/stable/auto_examples/classification/plot_digits_classification.html {{ :media_14:confusion_digits_classification.png?600 |}} {{ :media_14:predicted_digits_classification.png?800 |}} ====Classifier comparison==== A comparison of a several classifiers in scikit-learn on synthetic datasets. Ne marche pas avec MNIST ! * [[https://github.com/sergeLabo/scikit-learn/blob/main/classifier_comparison.py|classifier_comparison.py]] * https://scikit-learn.org/stable/auto_examples/classification/plot_classifier_comparison.html Résultat obtenu avec "synthetic datasets". {{ :media_14:classifier_comparison_synthetic.png?800 |}} =====Clustering===== C’est quoi ?\\ Regroupement(Clustering) = construire une collection d’objets: * Similaires au sein d’un même groupe * Dissimilaires quand ils appartiennent à des groupes différents Le Clustering est de la classification non supervisée: pas de classes prédéfinies. * **[[https://scikit-learn.org/stable/modules/clustering.html#clustering|Le module clustering de scikit-learn]]** ==== A demo of K-Means clustering on the handwritten digits data ==== In this example we compare the various initialization strategies for K-means in terms of runtime and quality of the results. * [[https://github.com/sergeLabo/scikit-learn/blob/main/kmeans_digits.py|kmeans_digits.py]] * https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_digits.html {{ :media_14:kmeans_digits.png?400 |}} {{tag>ia sb}}