Skip to content

Latest commit

 

History

History
183 lines (142 loc) · 6.2 KB

slides.md

File metadata and controls

183 lines (142 loc) · 6.2 KB

% Systèmes de recommandation % Louis Abraham % 29 novembre 2017

lang: french babel-lang: french handout: true

Recommandation d'articles

\includegraphics[width=\linewidth]{figures/amazon.jpg}

Recommandation d'articles (fenêtre privée)

\includegraphics[width=\linewidth]{figures/amazon2.jpg}

Recommandation d'articles (fenêtre privée)

\includegraphics[width=\linewidth]{figures/amazon3.jpg}

Filtrage collaboratif

\begin{tabular}{ccccc} & \includegraphics[height=2.5cm]{figures/1.jpg} & \includegraphics[height=2.5cm]{figures/2.jpg} & \includegraphics[height=2.5cm]{figures/3.jpg} & \includegraphics[height=2.5cm]{figures/4.jpg}\ Sacha & ? & 5 & 2 & ?\ Ondine & 4 & 1 & ? & 5\ Pierre & 3 & 3 & 1 & 4\ Joëlle & 5 & ? & 2 & ? \end{tabular}

Filtrage collaboratif

\begin{tabular}{ccccc} & \includegraphics[height=2.5cm]{figures/1.jpg} & \includegraphics[height=2.5cm]{figures/2.jpg} & \includegraphics[height=2.5cm]{figures/3.jpg} & \includegraphics[height=2.5cm]{figures/4.jpg}\ Sacha & \alert{3} & 5 & 2 & \alert{2}\ Ondine & 4 & 1 & \alert{4} & 5\ Pierre & 3 & 3 & 1 & 4\ Joëlle & 5 & \alert{2} & 2 & \alert{5} \end{tabular}

Algorithme des plus proches voisins

Pour recommander des films à quelqu'un :

  • On introduit un \alert{score de similarité} entre personnes
  • On détermine les 10 personnes \alert{les plus proches} de lui
  • On lui recommande ce qu'ils ont aimé qu'il n'a pas vu

Nos données

\begin{tabular}{c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c} & \footnotesize{007} & \footnotesize{Batman 1} & \footnotesize{Shrek 2} & \footnotesize{Toy Story 3} & \footnotesize{Star Wars 4} & \footnotesize{Twilight 5}\ Alice & $+$ & $-$ & $0$ & $+$ & $0$ & $-$\ Bob & $-$ & $0$ & $+$ & $-$ & $+$ & $+$\ Charles & $+$ & $+$ & $+$ & $+$ & $-$ & $-$\ Daisy & $+$ & $+$ & $0$ & $0$ & $+$ & $-$\ Everett & $+$ & $-$ & $+$ & $+$ & $-$ & $0$\ \end{tabular}

\begin{center} Quel score de similarité entre utilisateurs choisir ? \end{center}

Calcul du score

\begin{tabular}{c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c} & \footnotesize{007} & \footnotesize{Batman 1} & \footnotesize{Shrek 2} & \footnotesize{Toy Story 3} & \footnotesize{Star Wars 4} & \footnotesize{Twilight 5}\ Alice & $+$ & $-$ & $0$ & $+$ & $0$ & $-$\ Charles & $+$ & $+$ & $+$ & $+$ & $-$ & $-$\ Score & $+1$ & $-1$ & & $+1$ & & +1\ \end{tabular} \vspace{-1mm} \begin{center} $score(\textnormal{Alice}, \textnormal{Charles}) = 3 + (-1) = \alert{2}$
\end{center} \vspace{2mm}

\begin{tabular}{c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c} & \footnotesize{007} & \footnotesize{Batman 1} & \footnotesize{Shrek 2} & \footnotesize{Toy Story 3} & \footnotesize{Star Wars 4} & \footnotesize{Twilight 5}\ Alice & $+$ & $-$ & $0$ & $+$ & $0$ & $-$\ Bob & $-$ & $0$ & $+$ & $-$ & $+$ & $+$\ Score & $-1$ & & & $-1$ & & -1\ \end{tabular} \vspace{-1mm} \begin{center} $score(\textnormal{Alice}, \textnormal{Bob}) = \alert{-3}$\bigskip \vspace{2mm}

Alice est \alert{plus proche} de Charles que de Bob \end{center}

Score de similarité entre personnes

\begin{center} \begin{tabular}{c@{\hspace{2mm}}|c@{\hspace{2mm}}c@{\hspace{2mm}}c@{\hspace{2mm}}c@{\hspace{2mm}}c} & Alice & Bob & Charles & Daisy & JJ\ \hline Alice & $4$ & $-3$ & $2$ & $1$ & $3$\ Bob & $-3$ & $5$ & $-3$ & $-1$ & $-2$\ Charles & $2$ & $-3$ & $6$ & $2$ & $3$\ Daisy & $1$ & $-1$ & $2$ & $4$ & $-1$\ Everett & $3$ & $-2$ & $3$ & $-1$ & $5$\ \end{tabular} \end{center}

\begin{center} Qui sont les 2 plus proches voisins d'Alice ? \end{center}

Calcul des prédictions

\begin{tabular}{c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c} & \footnotesize{007} & \footnotesize{Batman 1} & \footnotesize{Shrek 2} & \footnotesize{Toy Story 3} & \footnotesize{Star Wars 4} & \footnotesize{Twilight 5}\ Alice & $+$ & $-$ & \alert{?} & $+$ & \alert{?} & $-$\ Charles & $+$ & $+$ & $+$ & $+$ & $-$ & $-$\ Daisy & $+$ & $+$ & $0$ & $0$ & $+$ & $-$\ Everett & $+$ & $-$ & $+$ & $+$ & $-$ & $0$\ \end{tabular}

\begin{center} Connaissant ses voisins, quelles sont les chances d'Alice d'apprécier ces films ? \end{center}

Calcul des prédictions

\begin{tabular}{c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c@{\hspace{3mm}}c} & \footnotesize{007} & \footnotesize{Batman 1} & \footnotesize{Shrek 2} & \footnotesize{Toy Story 3} & \footnotesize{Star Wars 4} & \footnotesize{Twilight 5}\ Alice & $+$ & $-$ & \alert{$+$} & $+$ & \alert{$-$} & $-$\ Charles & $+$ & $+$ & $+$ & $+$ & $-$ & $-$\ Daisy & $+$ & $+$ & $0$ & $0$ & $+$ & $-$\ Everett & $+$ & $-$ & $+$ & $+$ & $-$ & $0$\ \end{tabular}

\begin{center} On peut calculer la moyenne :\ $prediction(\textnormal{Alice}, \textnormal{Star Wars 4}) =$ 0,333… \end{center}

Place au code !

  • \texttt{calculer_score}$(i, j)$
  • \texttt{calculer_tous_scores}$()$
  • \texttt{plus_proches_voisins}$(i)$
  • \texttt{calculer_prediction}$(i, i_{film})$
  • \texttt{calculer_toutes_predictions}$(i)$

Points importants

Écrire du code générique

  • Le même code pour le petit exemple et pour la grosse base de données

Ne calculer que lorsque c'est nécessaire

  • Calculer tous les scores, c'est long, j'ai juste besoin de connaître les voisins d'Alice
  • Recalculer les voisins à chaque fois, c'est idiot

Petites subtilités

  • Division par zéro lorsqu'aucun voisin n'a vu le film

Un grand merci à Jill-Jênn Vie

\begin{columns} \begin{column}{0.33\textwidth} \includegraphics[width=\linewidth]{figures/prologin.png} \end{column} \begin{column}{0.33\textwidth} \includegraphics[width=\linewidth]{figures/vie-duerr.jpg} \end{column} \begin{column}{0.33\textwidth} \includegraphics[width=\linewidth]{figures/trioelm.png}\hfill \includegraphics[width=\linewidth]{figures/mangaki.png}\hfill \end{column} \end{columns}