mahout, machine learning pour hadoop par bertrand dechoux

33
Mahout machine learning pour Hadoop Bertrand Dechoux Mercredi 11 Decembre 2013

Upload: hadoop-user-group-france

Post on 14-Jun-2015

1.232 views

Category:

Technology


1 download

DESCRIPTION

Un introduction à Mahout, la première librairie de Machine Learning pour Hadoop.

TRANSCRIPT

Page 1: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Mahoutmachine learning pour Hadoop

Bertrand DechouxMercredi

11 Decembre2013

Page 2: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

2

Bertrand Dechoux@BertrandDechoux

Certified trainer

Réseaux Bayésiens

Page 3: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

L’écosystème : une menagerie

3

PIGZooKeeper

Impala

Page 4: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Machine learning ? Pour Hadoop?

4

Page 5: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Le programme

5

Recommendation filtrage collaborative user/item-based recommender

Clustering kmeans

Classification naive bayes network

Page 6: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Pas juste un algo

6

DevOps TDD A/B Testing Data cleansing Anonymisation Sécurité

Page 7: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Bachotage -> overfitting

7

Page 8: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

1 : Recommendation

8

Page 9: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Marketing 1.0

9

http://www.flickr.com/photos/mpk/4310357482/

Page 10: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Marketing 2.0

10

Page 11: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Collaborative filtering

11

Item 1 item 2 item 2 item 3 item 4 item 5 ...user 1 4 2user 2 1 ? 3 1 4user 3 4user 4 1user 5 5 4user 6 1 5

...

Page 12: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

item-based / user-based

12

▶ calculer la similarité entre tous

▶ trouver le voisinage▶ calculer les prediction

Page 13: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Aperçu de l’API

13

DataModel dataModel =new FileDataModel(dataFile);

UserSimilarity userSimilarity =new PearsonCorrelationSimilarity(dataModel);

UserNeighborhood neighborhood =

new NearestNUserNeighborhood(n, userSimilarity, dataModel);

UserBasedRecommender recommender =

new GenericUserBasedRecommender(dataModel, neighborhood, userSimilarity);

List<RecommendedItem> recommendedItems =

recommender.recommend(1, 100);

Page 14: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Evaluation et Optimisation

14

différence entre prédiction et observation

comme un moteur de recherche precision, recall ...

Page 15: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Hadoop, realité et matrices

15

recommendation : solution contre trop de choix il faut calculer O(n2) similaritées ???

Page 16: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Hadoop, realité et matrices

16

s11 s12

s21 s22

p1

p2

s11 x p1 + s12 x p2

s21 x p1 + s22 x p2X =

Page 17: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Hadoop, realité et matrices

17

I1 I2 I3I1I2I3

- 1 31 - 23 2 -

User5?3

Score

(1x5+2x3)/3 => 3.7X ->

Page 18: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

MAHOUT-1288 : recommendation = recherche

18

Page 19: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

2 : Clustering

19

Page 20: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Clustering : un regroupement

20

detection de caractères aperçu de news ...

Page 21: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Un monde en n dimensions

21

OLAP fichier excel, csv modèle entité-association (ERD) filtrage collaboratif ...

Page 22: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

la base : k-means (Lloyd’s)

22

http://en.wikipedia.org/wiki/K-means_clustering

Page 23: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

preclustering : canopy

23

https://cwiki.apache.org/confluence/display/MAHOUT/Canopy+Clustering

Page 24: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

mahout 0.8 : kmeans amélioré

24

“Fast and Accurate k-means for Large Data Sets” http://books.nips.cc/papers/files/nips24/NIPS2011_1271.pdf

Scalable K-Means++ http://theory.stanford.edu/~sergei/papers/vldb12-kmpar.pdf

https://issues.apache.org/jira/browse/MAHOUT-1154

http://blog.cloudera.com/blog/2013/03/cloudera_ml_data_science_tools/

Page 25: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

3 : Classification

25

Page 26: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Classificationle cousin ‘supervisé’ du Clustering

26

associer une lettre à un groupe de pixels filtre anti-spam detection de fraudes classification de tumeurs ...

Page 27: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Prenons du recul

les modèles probabilistes

27

On veut connaitre : P( Monde )

Pour demander : P( interet | observation)

Page 28: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Réseau Bayésien : un framework

28

Page 29: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Naive Bayes Classifier

29

Page 30: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Evaluation : Matrice de confusion

30

prediction :TRUE

prediction :FALSE

réalité :TRUE

réalité :FALSE

truepositive

false negative

falsepositive

truenegative

Page 31: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Le tour est fini!

31

=

+ Machine Learning

Recommendation Clustering Classification

=

Page 32: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Merci !

32

Page 33: Mahout, Machine Learning pour Hadoop par Bertrand Dechoux

Et pour (vraiment) finir

33