SlideShare a Scribd company logo
1 of 52
© 2014 MapR Technologies 1© 2014 MapR Technologies
© 2014 MapR Technologies 2
What’s New in Apache Mahout:
A Preview of Mahout 1.0
21 May 2014 Boulder/Denver Big Data Meet-up #BDBDM
Ted Dunning, Chief Applications Architect MapR Technologies
Twitter @Ted_Dunning
Email tdunning@mapr.com tdunning@apache.org
© 2014 MapR Technologies 3
There was just an explosion
in Apache Mahout…
© 2014 MapR Technologies 4
Apache Mahout up to now…
• Open source Apache project http://mahout.apache.org/
• Mahout version is 0.9 released Feb 2014; included Scala
– Summary 0.9 blog at http://bit.ly/1rirUUL
• Library of scalable algorithms for machine learning
– Some run on Apache Hadoop distributions; others do not require Hadoop
– Some can be run at small scale
– Some are run in parallel; others are sequential
• Includes the following main areas:
– Clustering & related techniques
– Classification
– Recommendation
– Mahout Math Library
© 2014 MapR Technologies 5
Roadmap to Mahout 1.0
• Say good-bye to MapReduce
– New MR algorithms will not be accepted
– Support for existing ones will continue for now
• Support for Apache Spark
– Under construction; some features already available
• Support for h2o being explored
• Support for Apache Stratosphere possibly in future
© 2014 MapR Technologies 6
Roadmap: Apache Mahout 1.0
© 2014 MapR Technologies 7
Apache Spark
• Apache Spark http://spark.apache.org/
– Open source “fast and general engine for large scale data processing”
– Especially fast in-memory
– Made top level open Apache project
• Feb 2014
• http://spark.apache.org/
• over 100 committers
– Original developers have started company called Databricks (Berkeley CA)
http://databricks.com/
© 2014 MapR Technologies 8
Mahout and Scala
• Scala http://www.scala-lang.org/
– Open source; appeared in 2003
– Wiki describes as “object-functional programming and scripting
language”
• Scala provides functional style
– Makes lazy evaluation much safer
– Notationally compact
– Minor syntax extensions allowed
– Makes math much easier
© 2014 MapR Technologies 9
Here’s what DSL & Spark will mean for Mahout
• Scala DSL provides convenient notation for expressing parallel
machine learning
• Spark (and other engines) provide execution environment
• Overview of Scala and Apache Spark bindings in Mahout can be
found at
https://mahout.apache.org/users/sparkbindings/home.html
© 2014 MapR Technologies 10
What do clusters, Cap’n Crunch
and Coco Puffs have in common?
© 2014 MapR Technologies 11
They’re part of the data in the
new Mahout Spark shell tutorial…
© 2014 MapR Technologies 12
And you shouldn’t be eating them.
© 2014 MapR Technologies 13
Tutorial: Mahout- Spark Shell
• Find it here http://bit.ly/RSTeMr
• Early stage code - play with Mahout Scala’s DSL for linear
algebra and Mahout-Spark shell
– Uses publicly available breakfast cereal data set
– Challenge: Fit linear model that infers customer ratings from ingredients
– Toy data set but load with Mahout to mimic a huge data set
• Mahout's linear algebra DSL has an abstraction called
DistributedRowMatrix (DRM)
– models a matrix that is partitioned by rows and stored in the memory of
a cluster of machines
© 2014 MapR Technologies 14
Dissecting the Model
• Components
– Cereal ingredients are the features
– Ratings are the target variables
• Linear regression assumes that target variable y is generated by
linear combination of feature matrix X with parameter vector β
plus the noise ε
y = Xβ + ε
• Goal: Find estimate of parameter vector β that explains data
© 2014 MapR Technologies 15
What do you see in this matrix?
val drmData = drmParallelize(dense(
(2, 2, 10.5, 10, 29.509541), // Apple Cinnamon Cheerios
(1, 2, 12, 12, 18.042851), // Cap'n'Crunch
(1, 1, 12, 13, 22.736446), // Cocoa Puffs
(2, 1, 11, 13, 32.207582), // Froot Loops
(1, 2, 12, 11, 21.871292), // Honey Graham Ohs
(2, 1, 16, 8, 36.187559), // Wheaties Honey Gold
(6, 2, 17, 1, 50.764999), // Cheerios
(3, 2, 13, 7, 40.400208), // Clusters
(3, 3, 13, 4, 45.811716)), // Great Grains Pecan
numPartitions = 2);
© 2014 MapR Technologies 16
Add Bias Column
val drmX1 = drmX.mapBlock(ncol = drmX.ncol + 1) {
case(keys, block) =>
// create a new block with an additional column
val blockWithBiasColumn =
block.like(block.nrow, block.ncol + 1)
// copy data from current block into the new block
blockWithBiasColumn(::, 0 until block.ncol) := block
// last column consists of ones
blockWithBiasColumn(::, block.ncol) := 1
keys -> blockWithBiasColumn
}
© 2014 MapR Technologies 17
Solve Linear System, Compute Error
val XtX = (drmX1.t %*% drmX1).collect
val Xty = (drmX1.t %*% y).collect(::, 0)
beta = solve(XtX, Xty)
val fittedY = (drmX1 %*% beta).collect(::, 0)
error = (y - fittedY).norm(2)
© 2014 MapR Technologies 18
In R
all = matrix(
c(2, 2, 10.5, 10, 29.509541,
1, 2, 12, 12, 18.042851,
1, 1, 12, 13, 22.736446,
2, 1, 11, 13, 32.207582,
1, 2, 12, 11, 21.871292,
2, 1, 16, 8, 36.187559,
6, 2, 17, 1, 50.764999,
3, 2, 13, 7, 40.400208,
3, 3, 13, 4, 45.811716), byrow=T, ncol=5)
© 2014 MapR Technologies 19
More R
a1 = cbind(a, 1)
ata = t(a1) %*% a1
aty = t(a1) %*% y
x1 = solve(a=ata, b=aty)
© 2014 MapR Technologies 20
Well, Actually
all = data.frame(all)
m = lm(X5 ~ X1 + X2 + X3 + X4, df)
plot(df$X5, predict(m))
abline(lm(y ~ x,
data.frame(x=df$X5, y=predict(m))), col='red’)
© 2014 MapR Technologies 21
R Wins
© 2014 MapR Technologies 22
R Wins … For Now
© 2014 MapR Technologies 23
R Wins … For Now … at Small Scale
© 2014 MapR Technologies 24
Recommendation
Behavior of a crowd
helps us understand
what individuals will do
© 2014 MapR Technologies 25
Recommendation
Alice got an apple and
a puppyAlice
Charles got a bicycleCharles
Bob Bob got an apple
© 2014 MapR Technologies 26
Recommendation
Alice got an apple and
a puppyAlice
Charles got a bicycleCharles
Bob Bob got an apple. What else would Bob like?
© 2014 MapR Technologies 27
Recommendation
Alice got an apple and
a puppyAlice
Charles got a bicycleCharles
Bob A puppy!
© 2014 MapR Technologies 28
You get the idea of how
recommenders work…
© 2014 MapR Technologies 29
By the way, like me, Bob also
wants a pony…
© 2014 MapR Technologies 30
Recommendation
?
Alice
Bob
Charles
Amelia
What if everybody gets a
pony?
What else would you recommend
for new user Amelia?
© 2014 MapR Technologies 31
Recommendation
?
Alice
Bob
Charles
Amelia
If everybody gets a pony, it’s not a
very good indicator of what to else
predict...
What we want is anomalous co-occurrence
© 2014 MapR Technologies 32
Get Useful Indicators from Behaviors
• Use log files to build history matrix of users x items
– Remember: this history of interactions will be sparse compared to all
potential combinations
• Transform to a co-occurrence matrix of items x items
• Look for useful co-occurrence by looking for anomalous co-
occurrences to make an indicator matrix
– Log Likelihood Ratio (LLR) can be helpful to judge which co-
occurrences can with confidence be used as indicators of preference
– ItemSimilarityJob in Apache Mahout uses LLR
• (pony book said RowSimilarityJob,not as good )
© 2014 MapR Technologies 33
Model uses three matrices…
© 2014 MapR Technologies 34
History Matrix: Users x Items
Alice
Bob
Charles
✔ ✔ ✔
✔ ✔
✔ ✔
© 2014 MapR Technologies 35
Co-Occurrence Matrix: Items x Items
-
1 2
1 1
1
1
2 1
0
0
0 0
Use LLR test to turn co-
occurrence into indicators of
interesting co-occurrence
© 2014 MapR Technologies 36
Indicator Matrix: Anomalous Co-Occurrence
✔
✔
© 2014 MapR Technologies 37
Which one is the anomalous co-occurrence?
A not A
B 13 1000
not B 1000 100,000
A not A
B 1 0
not B 0 10,000
A not A
B 10 0
not B 0 100,000
A not A
B 1 0
not B 0 2
0.90 1.95
4.52 14.3
© 2014 MapR Technologies 38
Collection of Documents: Insert Meta-Data
Search
Technology
Item
meta-data
Document for
“puppy” id: t4
title: puppy
desc: The sweetest little puppy
ever.
keywords: puppy, dog, pet
Ingest easily via NFS
© 2014 MapR Technologies 39
A Quick Simplification
• Users who do h
• Also do
Ah
User-centric recommendations
Item-centric recommendations
AT
(Ah)
(AT
A)h
© 2014 MapR Technologies 40
val drmA = sampleDownAndBinarize(
drmARaw, randomSeed, maxNumInteractions).checkpoint()
val numUsers = drmA.nrow.toInt
// Compute number of interactions per thing in A
val csums = drmBroadcast(drmA.colSums)
// Compute co-occurrence matrix A'A
val drmAtA = drmA.t %*% drmA
© 2014 MapR Technologies 41
What’s New in Apache Mahout:
A Preview of Mahout 1.0
21 May 2014 Boulder/Denver Big Data Meet-up #BDBDM
Ted Dunning, Chief Applications Architect MapR Technologies
Twitter @Ted_Dunning
Email tdunning@mapr.com tdunning@apache.org
© 2014 MapR Technologies 42
© 2014 MapR Technologies 43
Sandbox
© 2014 MapR Technologies 44
Going Further: Multi-Modal Recommendation
© 2014 MapR Technologies 45
Going Further: Multi-Modal Recommendation
© 2014 MapR Technologies 46
Better Long-Term Recommendations
• Anti-flood
Avoid having too much of a good thing
• Dithering
“When making it worse makes it better”
© 2014 MapR Technologies 47
Why Use Dithering?
© 2014 MapR Technologies 48
What’s New in Apache Mahout?
A Preview of Mahout 1.0
21 May 2014 #BDBDM
Ted Dunning, Chief Applications Architect MapR Technologies
Twitter @Ted_Dunning
Email tdunning@mapr.com tdunning@apache.org
Apache Mahout https://mahout.apache.org/
Twitter @ApacheMahout
© 2014 MapR Technologies 49
Sample Music Log Files
13 START 10113 2182654281
23 BEACON 10113 2182654281
24 START 10113 79600611935028
34 BEACON 10113 79600611935028
44 BEACON 10113 79600611935028
54 BEACON 10113 79600611935028
64 BEACON 10113 79600611935028
74 BEACON 10113 79600611935028
84 BEACON 10113 79600611935028
94 BEACON 10113 79600611935028
104 BEACON 10113 79600611935028
109 FINISH10113 79600611935028
111 START 10113 58999912011972
121 BEACON 10113 58999912011972
Time
Event type
User ID
Artist ID
Track ID
© 2014 MapR Technologies 50
id 1710
mbid 592a3b6d-c42b-4567-99c9-ecf63bd66499
name Chuck Berry
area United States
gender Male
indicator_artists 386685,875994,637954,3418,1344,789739,1460, …
id 541902
mbid 983d4f8f-473e-4091-8394-415c105c4656
name Charlie Winston
area United Kingdom
gender None
indicator_artists 997727,815,830794,59588,900,2591,1344,696268, …
Documents for Music Recommendation
© 2014 MapR Technologies 51
Practical Machine Learning:
Innovations in Recommendation
28 April 2014 NoSQL Matters Conference #NoSQLMatters
Ted Dunning, Chief Applications Architect MapR Technologies
Twitter @Ted_Dunning
Email tdunning@mapr.com tdunning@apache.org
Apache Mahout https://mahout.apache.org/
Twitter @ApacheMahout
© 2014 MapR Technologies 52

More Related Content

What's hot

Dunning time-series-2015
Dunning time-series-2015Dunning time-series-2015
Dunning time-series-2015
Ted Dunning
 

What's hot (20)

Anomaly Detection - New York Machine Learning
Anomaly Detection - New York Machine LearningAnomaly Detection - New York Machine Learning
Anomaly Detection - New York Machine Learning
 
Strata 2014 Anomaly Detection
Strata 2014 Anomaly DetectionStrata 2014 Anomaly Detection
Strata 2014 Anomaly Detection
 
Real-time Puppies and Ponies - Evolving Indicator Recommendations in Real-time
Real-time Puppies and Ponies - Evolving Indicator Recommendations in Real-timeReal-time Puppies and Ponies - Evolving Indicator Recommendations in Real-time
Real-time Puppies and Ponies - Evolving Indicator Recommendations in Real-time
 
Dunning time-series-2015
Dunning time-series-2015Dunning time-series-2015
Dunning time-series-2015
 
Real time-hadoop
Real time-hadoopReal time-hadoop
Real time-hadoop
 
Where is Data Going? - RMDC Keynote
Where is Data Going? - RMDC KeynoteWhere is Data Going? - RMDC Keynote
Where is Data Going? - RMDC Keynote
 
Using Mahout and a Search Engine for Recommendation
Using Mahout and a Search Engine for RecommendationUsing Mahout and a Search Engine for Recommendation
Using Mahout and a Search Engine for Recommendation
 
Possible Visions for Mahout 1.0
Possible Visions for Mahout 1.0Possible Visions for Mahout 1.0
Possible Visions for Mahout 1.0
 
Mathematical bridges From Old to New
Mathematical bridges From Old to NewMathematical bridges From Old to New
Mathematical bridges From Old to New
 
Cheap learning-dunning-9-18-2015
Cheap learning-dunning-9-18-2015Cheap learning-dunning-9-18-2015
Cheap learning-dunning-9-18-2015
 
Polyvalent recommendations
Polyvalent recommendationsPolyvalent recommendations
Polyvalent recommendations
 
Mahout and Recommendations
Mahout and RecommendationsMahout and Recommendations
Mahout and Recommendations
 
Buzz words-dunning-real-time-learning
Buzz words-dunning-real-time-learningBuzz words-dunning-real-time-learning
Buzz words-dunning-real-time-learning
 
Finding Changes in Real Data
Finding Changes in Real DataFinding Changes in Real Data
Finding Changes in Real Data
 
Fast Cars, Big Data How Streaming can help Formula 1
Fast Cars, Big Data How Streaming can help Formula 1Fast Cars, Big Data How Streaming can help Formula 1
Fast Cars, Big Data How Streaming can help Formula 1
 
Big Data Paris
Big Data ParisBig Data Paris
Big Data Paris
 
R + Storm Moneyball - Realtime Advanced Statistics - Hadoop Summit - San Jose
R + Storm Moneyball - Realtime Advanced Statistics - Hadoop Summit - San JoseR + Storm Moneyball - Realtime Advanced Statistics - Hadoop Summit - San Jose
R + Storm Moneyball - Realtime Advanced Statistics - Hadoop Summit - San Jose
 
Deep Learning for Fraud Detection
Deep Learning for Fraud DetectionDeep Learning for Fraud Detection
Deep Learning for Fraud Detection
 
T digest-update
T digest-updateT digest-update
T digest-update
 
Storm users group real time hadoop
Storm users group real time hadoopStorm users group real time hadoop
Storm users group real time hadoop
 

Similar to What's new in Apache Mahout

Big Data Analytics-Open Source Toolkits
Big Data Analytics-Open Source ToolkitsBig Data Analytics-Open Source Toolkits
Big Data Analytics-Open Source Toolkits
DataWorks Summit
 
How the Internet of Things are Turning the Internet Upside Down
How the Internet of Things are Turning the Internet Upside DownHow the Internet of Things are Turning the Internet Upside Down
How the Internet of Things are Turning the Internet Upside Down
DataWorks Summit
 
Analyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache DrillAnalyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache Drill
Tomer Shiran
 

Similar to What's new in Apache Mahout (20)

Big Data Everywhere Chicago: SQL on Hadoop
Big Data Everywhere Chicago: SQL on Hadoop Big Data Everywhere Chicago: SQL on Hadoop
Big Data Everywhere Chicago: SQL on Hadoop
 
Practical Machine Learning: Innovations in Recommendation Workshop
Practical Machine Learning:  Innovations in Recommendation WorkshopPractical Machine Learning:  Innovations in Recommendation Workshop
Practical Machine Learning: Innovations in Recommendation Workshop
 
Intro to Apache Spark by Marco Vasquez
Intro to Apache Spark by Marco VasquezIntro to Apache Spark by Marco Vasquez
Intro to Apache Spark by Marco Vasquez
 
Benefits of Hadoop as Platform as a Service
Benefits of Hadoop as Platform as a ServiceBenefits of Hadoop as Platform as a Service
Benefits of Hadoop as Platform as a Service
 
Real-World Machine Learning - Leverage the Features of MapR Converged Data Pl...
Real-World Machine Learning - Leverage the Features of MapR Converged Data Pl...Real-World Machine Learning - Leverage the Features of MapR Converged Data Pl...
Real-World Machine Learning - Leverage the Features of MapR Converged Data Pl...
 
Big Data Everywhere Chicago: Getting Real with the MapR Platform (MapR)
Big Data Everywhere Chicago: Getting Real with the MapR Platform (MapR)Big Data Everywhere Chicago: Getting Real with the MapR Platform (MapR)
Big Data Everywhere Chicago: Getting Real with the MapR Platform (MapR)
 
Apache Kylin – Cubes on Hadoop
Apache Kylin – Cubes on HadoopApache Kylin – Cubes on Hadoop
Apache Kylin – Cubes on Hadoop
 
Apache Kylin - OLAP Cubes for SQL on Hadoop
Apache Kylin - OLAP Cubes for SQL on HadoopApache Kylin - OLAP Cubes for SQL on Hadoop
Apache Kylin - OLAP Cubes for SQL on Hadoop
 
Free Code Friday - Machine Learning with Apache Spark
Free Code Friday - Machine Learning with Apache SparkFree Code Friday - Machine Learning with Apache Spark
Free Code Friday - Machine Learning with Apache Spark
 
Anomaly Detection in Telecom with Spark - Tugdual Grall - Codemotion Amsterda...
Anomaly Detection in Telecom with Spark - Tugdual Grall - Codemotion Amsterda...Anomaly Detection in Telecom with Spark - Tugdual Grall - Codemotion Amsterda...
Anomaly Detection in Telecom with Spark - Tugdual Grall - Codemotion Amsterda...
 
Is Spark Replacing Hadoop
Is Spark Replacing HadoopIs Spark Replacing Hadoop
Is Spark Replacing Hadoop
 
Apache Spark Overview
Apache Spark OverviewApache Spark Overview
Apache Spark Overview
 
Apache Spark Machine Learning Decision Trees
Apache Spark Machine Learning Decision TreesApache Spark Machine Learning Decision Trees
Apache Spark Machine Learning Decision Trees
 
Big Data Analytics-Open Source Toolkits
Big Data Analytics-Open Source ToolkitsBig Data Analytics-Open Source Toolkits
Big Data Analytics-Open Source Toolkits
 
Cleveland Hadoop Users Group - Spark
Cleveland Hadoop Users Group - SparkCleveland Hadoop Users Group - Spark
Cleveland Hadoop Users Group - Spark
 
Dealing with an Upside Down Internet
Dealing with an Upside Down InternetDealing with an Upside Down Internet
Dealing with an Upside Down Internet
 
How the Internet of Things are Turning the Internet Upside Down
How the Internet of Things are Turning the Internet Upside DownHow the Internet of Things are Turning the Internet Upside Down
How the Internet of Things are Turning the Internet Upside Down
 
Ted Dunning, Chief Application Architect, MapR at MLconf SF
Ted Dunning, Chief Application Architect, MapR at MLconf SFTed Dunning, Chief Application Architect, MapR at MLconf SF
Ted Dunning, Chief Application Architect, MapR at MLconf SF
 
Introduction to Spark
Introduction to SparkIntroduction to Spark
Introduction to Spark
 
Analyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache DrillAnalyzing Real-World Data with Apache Drill
Analyzing Real-World Data with Apache Drill
 

More from Ted Dunning

Progress for big data in Kubernetes
Progress for big data in KubernetesProgress for big data in Kubernetes
Progress for big data in Kubernetes
Ted Dunning
 

More from Ted Dunning (10)

Dunning - SIGMOD - Data Economy.pptx
Dunning - SIGMOD - Data Economy.pptxDunning - SIGMOD - Data Economy.pptx
Dunning - SIGMOD - Data Economy.pptx
 
How to Get Going with Kubernetes
How to Get Going with KubernetesHow to Get Going with Kubernetes
How to Get Going with Kubernetes
 
Progress for big data in Kubernetes
Progress for big data in KubernetesProgress for big data in Kubernetes
Progress for big data in Kubernetes
 
Anomaly Detection: How to find what you didn’t know to look for
Anomaly Detection: How to find what you didn’t know to look forAnomaly Detection: How to find what you didn’t know to look for
Anomaly Detection: How to find what you didn’t know to look for
 
Streaming Architecture including Rendezvous for Machine Learning
Streaming Architecture including Rendezvous for Machine LearningStreaming Architecture including Rendezvous for Machine Learning
Streaming Architecture including Rendezvous for Machine Learning
 
Machine Learning Logistics
Machine Learning LogisticsMachine Learning Logistics
Machine Learning Logistics
 
Tensor Abuse - how to reuse machine learning frameworks
Tensor Abuse - how to reuse machine learning frameworksTensor Abuse - how to reuse machine learning frameworks
Tensor Abuse - how to reuse machine learning frameworks
 
Machine Learning logistics
Machine Learning logisticsMachine Learning logistics
Machine Learning logistics
 
How the Internet of Things is Turning the Internet Upside Down
How the Internet of Things is Turning the Internet Upside DownHow the Internet of Things is Turning the Internet Upside Down
How the Internet of Things is Turning the Internet Upside Down
 
Inside MapR's M7
Inside MapR's M7Inside MapR's M7
Inside MapR's M7
 

Recently uploaded

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

What's new in Apache Mahout

  • 1. © 2014 MapR Technologies 1© 2014 MapR Technologies
  • 2. © 2014 MapR Technologies 2 What’s New in Apache Mahout: A Preview of Mahout 1.0 21 May 2014 Boulder/Denver Big Data Meet-up #BDBDM Ted Dunning, Chief Applications Architect MapR Technologies Twitter @Ted_Dunning Email tdunning@mapr.com tdunning@apache.org
  • 3. © 2014 MapR Technologies 3 There was just an explosion in Apache Mahout…
  • 4. © 2014 MapR Technologies 4 Apache Mahout up to now… • Open source Apache project http://mahout.apache.org/ • Mahout version is 0.9 released Feb 2014; included Scala – Summary 0.9 blog at http://bit.ly/1rirUUL • Library of scalable algorithms for machine learning – Some run on Apache Hadoop distributions; others do not require Hadoop – Some can be run at small scale – Some are run in parallel; others are sequential • Includes the following main areas: – Clustering & related techniques – Classification – Recommendation – Mahout Math Library
  • 5. © 2014 MapR Technologies 5 Roadmap to Mahout 1.0 • Say good-bye to MapReduce – New MR algorithms will not be accepted – Support for existing ones will continue for now • Support for Apache Spark – Under construction; some features already available • Support for h2o being explored • Support for Apache Stratosphere possibly in future
  • 6. © 2014 MapR Technologies 6 Roadmap: Apache Mahout 1.0
  • 7. © 2014 MapR Technologies 7 Apache Spark • Apache Spark http://spark.apache.org/ – Open source “fast and general engine for large scale data processing” – Especially fast in-memory – Made top level open Apache project • Feb 2014 • http://spark.apache.org/ • over 100 committers – Original developers have started company called Databricks (Berkeley CA) http://databricks.com/
  • 8. © 2014 MapR Technologies 8 Mahout and Scala • Scala http://www.scala-lang.org/ – Open source; appeared in 2003 – Wiki describes as “object-functional programming and scripting language” • Scala provides functional style – Makes lazy evaluation much safer – Notationally compact – Minor syntax extensions allowed – Makes math much easier
  • 9. © 2014 MapR Technologies 9 Here’s what DSL & Spark will mean for Mahout • Scala DSL provides convenient notation for expressing parallel machine learning • Spark (and other engines) provide execution environment • Overview of Scala and Apache Spark bindings in Mahout can be found at https://mahout.apache.org/users/sparkbindings/home.html
  • 10. © 2014 MapR Technologies 10 What do clusters, Cap’n Crunch and Coco Puffs have in common?
  • 11. © 2014 MapR Technologies 11 They’re part of the data in the new Mahout Spark shell tutorial…
  • 12. © 2014 MapR Technologies 12 And you shouldn’t be eating them.
  • 13. © 2014 MapR Technologies 13 Tutorial: Mahout- Spark Shell • Find it here http://bit.ly/RSTeMr • Early stage code - play with Mahout Scala’s DSL for linear algebra and Mahout-Spark shell – Uses publicly available breakfast cereal data set – Challenge: Fit linear model that infers customer ratings from ingredients – Toy data set but load with Mahout to mimic a huge data set • Mahout's linear algebra DSL has an abstraction called DistributedRowMatrix (DRM) – models a matrix that is partitioned by rows and stored in the memory of a cluster of machines
  • 14. © 2014 MapR Technologies 14 Dissecting the Model • Components – Cereal ingredients are the features – Ratings are the target variables • Linear regression assumes that target variable y is generated by linear combination of feature matrix X with parameter vector β plus the noise ε y = Xβ + ε • Goal: Find estimate of parameter vector β that explains data
  • 15. © 2014 MapR Technologies 15 What do you see in this matrix? val drmData = drmParallelize(dense( (2, 2, 10.5, 10, 29.509541), // Apple Cinnamon Cheerios (1, 2, 12, 12, 18.042851), // Cap'n'Crunch (1, 1, 12, 13, 22.736446), // Cocoa Puffs (2, 1, 11, 13, 32.207582), // Froot Loops (1, 2, 12, 11, 21.871292), // Honey Graham Ohs (2, 1, 16, 8, 36.187559), // Wheaties Honey Gold (6, 2, 17, 1, 50.764999), // Cheerios (3, 2, 13, 7, 40.400208), // Clusters (3, 3, 13, 4, 45.811716)), // Great Grains Pecan numPartitions = 2);
  • 16. © 2014 MapR Technologies 16 Add Bias Column val drmX1 = drmX.mapBlock(ncol = drmX.ncol + 1) { case(keys, block) => // create a new block with an additional column val blockWithBiasColumn = block.like(block.nrow, block.ncol + 1) // copy data from current block into the new block blockWithBiasColumn(::, 0 until block.ncol) := block // last column consists of ones blockWithBiasColumn(::, block.ncol) := 1 keys -> blockWithBiasColumn }
  • 17. © 2014 MapR Technologies 17 Solve Linear System, Compute Error val XtX = (drmX1.t %*% drmX1).collect val Xty = (drmX1.t %*% y).collect(::, 0) beta = solve(XtX, Xty) val fittedY = (drmX1 %*% beta).collect(::, 0) error = (y - fittedY).norm(2)
  • 18. © 2014 MapR Technologies 18 In R all = matrix( c(2, 2, 10.5, 10, 29.509541, 1, 2, 12, 12, 18.042851, 1, 1, 12, 13, 22.736446, 2, 1, 11, 13, 32.207582, 1, 2, 12, 11, 21.871292, 2, 1, 16, 8, 36.187559, 6, 2, 17, 1, 50.764999, 3, 2, 13, 7, 40.400208, 3, 3, 13, 4, 45.811716), byrow=T, ncol=5)
  • 19. © 2014 MapR Technologies 19 More R a1 = cbind(a, 1) ata = t(a1) %*% a1 aty = t(a1) %*% y x1 = solve(a=ata, b=aty)
  • 20. © 2014 MapR Technologies 20 Well, Actually all = data.frame(all) m = lm(X5 ~ X1 + X2 + X3 + X4, df) plot(df$X5, predict(m)) abline(lm(y ~ x, data.frame(x=df$X5, y=predict(m))), col='red’)
  • 21. © 2014 MapR Technologies 21 R Wins
  • 22. © 2014 MapR Technologies 22 R Wins … For Now
  • 23. © 2014 MapR Technologies 23 R Wins … For Now … at Small Scale
  • 24. © 2014 MapR Technologies 24 Recommendation Behavior of a crowd helps us understand what individuals will do
  • 25. © 2014 MapR Technologies 25 Recommendation Alice got an apple and a puppyAlice Charles got a bicycleCharles Bob Bob got an apple
  • 26. © 2014 MapR Technologies 26 Recommendation Alice got an apple and a puppyAlice Charles got a bicycleCharles Bob Bob got an apple. What else would Bob like?
  • 27. © 2014 MapR Technologies 27 Recommendation Alice got an apple and a puppyAlice Charles got a bicycleCharles Bob A puppy!
  • 28. © 2014 MapR Technologies 28 You get the idea of how recommenders work…
  • 29. © 2014 MapR Technologies 29 By the way, like me, Bob also wants a pony…
  • 30. © 2014 MapR Technologies 30 Recommendation ? Alice Bob Charles Amelia What if everybody gets a pony? What else would you recommend for new user Amelia?
  • 31. © 2014 MapR Technologies 31 Recommendation ? Alice Bob Charles Amelia If everybody gets a pony, it’s not a very good indicator of what to else predict... What we want is anomalous co-occurrence
  • 32. © 2014 MapR Technologies 32 Get Useful Indicators from Behaviors • Use log files to build history matrix of users x items – Remember: this history of interactions will be sparse compared to all potential combinations • Transform to a co-occurrence matrix of items x items • Look for useful co-occurrence by looking for anomalous co- occurrences to make an indicator matrix – Log Likelihood Ratio (LLR) can be helpful to judge which co- occurrences can with confidence be used as indicators of preference – ItemSimilarityJob in Apache Mahout uses LLR • (pony book said RowSimilarityJob,not as good )
  • 33. © 2014 MapR Technologies 33 Model uses three matrices…
  • 34. © 2014 MapR Technologies 34 History Matrix: Users x Items Alice Bob Charles ✔ ✔ ✔ ✔ ✔ ✔ ✔
  • 35. © 2014 MapR Technologies 35 Co-Occurrence Matrix: Items x Items - 1 2 1 1 1 1 2 1 0 0 0 0 Use LLR test to turn co- occurrence into indicators of interesting co-occurrence
  • 36. © 2014 MapR Technologies 36 Indicator Matrix: Anomalous Co-Occurrence ✔ ✔
  • 37. © 2014 MapR Technologies 37 Which one is the anomalous co-occurrence? A not A B 13 1000 not B 1000 100,000 A not A B 1 0 not B 0 10,000 A not A B 10 0 not B 0 100,000 A not A B 1 0 not B 0 2 0.90 1.95 4.52 14.3
  • 38. © 2014 MapR Technologies 38 Collection of Documents: Insert Meta-Data Search Technology Item meta-data Document for “puppy” id: t4 title: puppy desc: The sweetest little puppy ever. keywords: puppy, dog, pet Ingest easily via NFS
  • 39. © 2014 MapR Technologies 39 A Quick Simplification • Users who do h • Also do Ah User-centric recommendations Item-centric recommendations AT (Ah) (AT A)h
  • 40. © 2014 MapR Technologies 40 val drmA = sampleDownAndBinarize( drmARaw, randomSeed, maxNumInteractions).checkpoint() val numUsers = drmA.nrow.toInt // Compute number of interactions per thing in A val csums = drmBroadcast(drmA.colSums) // Compute co-occurrence matrix A'A val drmAtA = drmA.t %*% drmA
  • 41. © 2014 MapR Technologies 41 What’s New in Apache Mahout: A Preview of Mahout 1.0 21 May 2014 Boulder/Denver Big Data Meet-up #BDBDM Ted Dunning, Chief Applications Architect MapR Technologies Twitter @Ted_Dunning Email tdunning@mapr.com tdunning@apache.org
  • 42. © 2014 MapR Technologies 42
  • 43. © 2014 MapR Technologies 43 Sandbox
  • 44. © 2014 MapR Technologies 44 Going Further: Multi-Modal Recommendation
  • 45. © 2014 MapR Technologies 45 Going Further: Multi-Modal Recommendation
  • 46. © 2014 MapR Technologies 46 Better Long-Term Recommendations • Anti-flood Avoid having too much of a good thing • Dithering “When making it worse makes it better”
  • 47. © 2014 MapR Technologies 47 Why Use Dithering?
  • 48. © 2014 MapR Technologies 48 What’s New in Apache Mahout? A Preview of Mahout 1.0 21 May 2014 #BDBDM Ted Dunning, Chief Applications Architect MapR Technologies Twitter @Ted_Dunning Email tdunning@mapr.com tdunning@apache.org Apache Mahout https://mahout.apache.org/ Twitter @ApacheMahout
  • 49. © 2014 MapR Technologies 49 Sample Music Log Files 13 START 10113 2182654281 23 BEACON 10113 2182654281 24 START 10113 79600611935028 34 BEACON 10113 79600611935028 44 BEACON 10113 79600611935028 54 BEACON 10113 79600611935028 64 BEACON 10113 79600611935028 74 BEACON 10113 79600611935028 84 BEACON 10113 79600611935028 94 BEACON 10113 79600611935028 104 BEACON 10113 79600611935028 109 FINISH10113 79600611935028 111 START 10113 58999912011972 121 BEACON 10113 58999912011972 Time Event type User ID Artist ID Track ID
  • 50. © 2014 MapR Technologies 50 id 1710 mbid 592a3b6d-c42b-4567-99c9-ecf63bd66499 name Chuck Berry area United States gender Male indicator_artists 386685,875994,637954,3418,1344,789739,1460, … id 541902 mbid 983d4f8f-473e-4091-8394-415c105c4656 name Charlie Winston area United Kingdom gender None indicator_artists 997727,815,830794,59588,900,2591,1344,696268, … Documents for Music Recommendation
  • 51. © 2014 MapR Technologies 51 Practical Machine Learning: Innovations in Recommendation 28 April 2014 NoSQL Matters Conference #NoSQLMatters Ted Dunning, Chief Applications Architect MapR Technologies Twitter @Ted_Dunning Email tdunning@mapr.com tdunning@apache.org Apache Mahout https://mahout.apache.org/ Twitter @ApacheMahout
  • 52. © 2014 MapR Technologies 52

Editor's Notes

  1. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  2. Talk track: Apache Mahout is an open-source project with international contributors and a vibrant community of users and developers. A new version – 0.8 – was recently released. Mahout is a library of scalable algorithms used for clustering, classification and recommendation. Mahout also includes a math library that is low level, flexible, scalable and makes certain functions very easy to carry out. Talk track: First let’s make a quick comparison of the three main areas of Mahout machine learning…
  3. Ted: I included this as intro slide to set up the content, but I think save details for each following slide
  4. TED: NO Idea???
  5. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  6. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  7. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  8. The first four columns represent the ingredients (our features) and the last column (the rating) is the target variable for our regression. Linear regression assumes that the target variable y is generated by the linear combination of the feature matrix X with the parameter vector β plus the noise ε, summarized in the formula y = Xβ + ε. Our goal is to find an estimate of the parameter vector β that explains the data very well.
  9. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  10. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  11. Ted: Is “Revolution” a better word? Want to imply exciting change but not discension
  12. TED: consider using the word “interesting” instead of “anomalous”… people may think you are talking about anomaly detection…
  13. TED: Likely this can be skipped
  14. Notes to trainer: A lot of work to do a grid. Represent by math A is history matrix Ah finds users who do the same things as in h H is vector of items for one (new current) user A transpose times Ah gives you the things That computes what these users do Shape of matrix multiplications and many of the same properties. Sometimes have weights etc. Had they been exactly the same, we could just move the parentheses. Our recommender does the item-centric version General relationships in data don’t change fast (what is related to what; nothing happens to change mozart related to Hayden overnight. ) What does change fast is what the user did in the last five minutes. //in first case, we have to compute Ah first. Inputs to that compution (h) only available now, in RT so nothing can be computed ahead of time Second case (Atranspose A) only involves things that change slowly. So pre-compute. Makes it possible to do this offline. Significant because we move a lot of computation for all users into an overnight process. So each RT recommendation involves only a small part, only 1 big matrix multiply in RT. Result: you get a fast response for the recommendations Second form runs on one machine for one user (the RT part)
  15. Talk track: Here are documents for two different artists with indicator IDs that are part of the recommendation model. When recommendations are needed, the web-site uses recent visitor behavior to query against the indicators in these documents.