File:Naive Bayes Classifier.gif

Une page de Wikimedia Commons, la médiathèque libre.
Aller à la navigation Aller à la recherche

Naive_Bayes_Classifier.gif(451 × 359 pixels, taille du fichier : 1,02 Mio, type MIME : image/gif, en boucle, 60 trames, 30 s)

Légendes

Légendes

Ajoutez en une ligne la description de ce que représente ce fichier
A Naive Bayes Classifier updating its estimate while more data is fed to it.

Description

[modifier]
Description
English: A "Naive Bayes Classifier" is a simple and computationally inexpensive way to estimate how likely it is that a certain combination of features can be attributed to a given class. As more measurements are fed to the classifier, the estimate is updated.
Date
Source https://twitter.com/j_bertolotti/status/1123268194758811648
Auteur Jacopo Bertolotti
Autorisation
(Réutilisation de ce fichier)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 11.0 code

[modifier]
n = 20;
red[z_] := {Opacity[z], Red};
purple[z_] := {Opacity[z], Purple};
cyan[z_] := {Opacity[z], Cyan}
pop1 = RandomVariate[MultinormalDistribution[{3, 4}, {{1, 1}, {1, 2}}], n];
pop2 = RandomVariate[MultinormalDistribution[{6, 4}, {{0.5, 0}, {0, 1}}], n];
pop3 = RandomVariate[MultinormalDistribution[{6, 8}, {{2, 0}, {0, 0.5}}], n];

meas = RandomSample[Join[pop1, pop2, pop3]];
meascol = Table[Which[MemberQ[pop1, meas[[j]]], 1, MemberQ[pop2, meas[[j]]], 2, MemberQ[pop3, meas[[j]]], 3], {j, 1, Dimensions[meas][[1]]}]
plots = Table[
   p1 = Count[meascol[[1 ;; j]], 1]/j;
   \[Mu]x1 = Mean@Extract[meas, Position[meascol[[1 ;; j]], 1]][[All, 1]];
   \[Mu]y1 = Mean@Extract[meas, Position[meascol[[1 ;; j]], 1]][[All, 2]];
   \[Sigma]x1 = Sqrt[Total[(Extract[meas, Position[meascol[[1 ;; j]], 1]][[All, 1]] - \[Mu]x1)^2]/(p1*j)];
   \[Sigma]y1 = Sqrt[Total[(Extract[meas, Position[meascol[[1 ;; j]], 1]][[All, 2]] - \[Mu]y1)^2]/(p1*j)];
   p1x = If[\[Sigma]x1 == 0, 0, PDF[NormalDistribution[\[Mu]x1, \[Sigma]x1], x]];
   p1y = If[\[Sigma]y1 == 0, 0, PDF[NormalDistribution[\[Mu]y1, \[Sigma]y1], y]];
   p2 = Count[meascol[[1 ;; j]], 2]/j;
   \[Mu]x2 = Mean@Extract[meas, Position[meascol[[1 ;; j]], 2]][[All, 1]];
   \[Mu]y2 = Mean@Extract[meas, Position[meascol[[1 ;; j]], 2]][[All, 2]];
   \[Sigma]x2 = Sqrt[Total[(Extract[meas, Position[meascol[[1 ;; j]], 2]][[All, 1]] - \[Mu]x2)^2]/(p2*j)];
   \[Sigma]y2 = Sqrt[Total[(Extract[meas, Position[meascol[[1 ;; j]], 2]][[All, 2]] - \[Mu]y2)^2]/(p2*j)];
   p2x = If[\[Sigma]x2 == 0, 0, PDF[NormalDistribution[\[Mu]x2, \[Sigma]x2], x]];
   p2y = If[\[Sigma]y2 == 0, 0, PDF[NormalDistribution[\[Mu]y2, \[Sigma]y2], y]];
   p3 = Count[meascol[[1 ;; j]], 3]/j;
   \[Mu]x3 = Mean@Extract[meas, Position[meascol[[1 ;; j]], 3]][[All, 1]];
   \[Mu]y3 = Mean@Extract[meas, Position[meascol[[1 ;; j]], 3]][[All, 2]];
   \[Sigma]x3 = Sqrt[Total[(Extract[meas, Position[meascol[[1 ;; j]], 3]][[All, 1]] - \[Mu]x3)^2]/(p3*j)];
   \[Sigma]y3 = Sqrt[Total[(Extract[meas, Position[meascol[[1 ;; j]], 3]][[All, 2]] - \[Mu]y3)^2]/(p3*j)];
   p3x = If[\[Sigma]x3 == 0, 0, PDF[NormalDistribution[\[Mu]x3, \[Sigma]x3], x]];
   p3y = If[\[Sigma]y3 == 0, 0, PDF[NormalDistribution[\[Mu]y3, \[Sigma]y3], y]];
   Legended[Show[
   ContourPlot[p1*p1x*p1y, {x, 0, 10}, {y, 0, 10}, ColorFunction -> red, PlotRange -> All, PlotPoints -> 50] ,
     ContourPlot[p2*p2x*p2y, {x, 0, 10}, {y, 0, 10}, ColorFunction -> purple, PlotRange -> All, PlotPoints -> 50] ,
     ContourPlot[p3*p3x*p3y, {x, 0, 10}, {y, 0, 10}, ColorFunction -> cyan, PlotRange -> All, PlotPoints -> 50]
     ,
     Graphics[{PointSize[0.02], Black, Point[Join[Extract[meas, Position[meascol[[1 ;; j]], 1]], Extract[meas, Position[meascol[[1 ;; j]], 2]], Extract[meas, Position[meascol[[1 ;; j]], 3]]]], 
       PointSize[0.015], Red, Point[Extract[meas, Position[meascol[[1 ;; j]], 1]]], Purple, Point[Extract[meas, Position[meascol[[1 ;; j]], 2]]], Cyan, Point[Extract[meas, Position[meascol[[1 ;; j]], 3]]]}]
     , PlotRange -> All, FrameLabel -> {"Feature 1", "Feature 2"}, LabelStyle -> {Bold, Black}
     ], SwatchLegend[{Red, Purple, Cyan}, {"Class Lucas", "Class B", "Class C"}] ]
   , {j, 1, n*3}];

Conditions d’utilisation

[modifier]
Moi, en tant que détenteur des droits d’auteur sur cette œuvre, je la publie sous la licence suivante :
Creative Commons CC-Zero Ce fichier est disponible selon les termes de la licence Creative Commons CC0 Don universel au domaine public.
La personne qui a associé une œuvre avec cet acte l’a placée dans le domaine public en renonçant mondialement à tous ses droits sur cette œuvre en vertu des lois relatives au droit d’auteur, ainsi qu’à tous les droits juridiques connexes et voisins qu’elle possédait sur l’œuvre, sans autre limite que celles imposées par la loi. Vous pouvez copier, modifier, distribuer et utiliser cette œuvre, y compris à des fins commerciales, sans qu’il soit nécessaire d’en demander la permission.

Historique du fichier

Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.

Date et heureVignetteDimensionsUtilisateurCommentaire
actuel1 mai 2019 à 08:46Vignette pour la version du 1 mai 2019 à 08:46451 × 359 (1,02 Mio)Berto (d | contributions)User created page with UploadWizard

Aucune page n’utilise ce fichier.

Utilisations du fichier sur d’autres wikis

Les autres wikis suivants utilisent ce fichier :

Métadonnées