Ever given a thought on how machine intelligent the softwares are getting nowadays? Lets imagine a situation when you surf a video on youtube and you are not given any recommendations for similar videos, Or a situation when none of the irritating mails we get automatically go to our spam folder? Life would not be as easy as it currently is.
Machine learning is getting in trend and so we thought about Integrating Apache Mahout with AEM to simply make our AEM applications smarter and interesting!
Mahout helps us in 3 different ways:
1. Recommendations
2. Classification
3. Clustering
We will focus on a typical use case of developing E-commerce applications in AEM and providing product recommendations on the basis of user search history.
6. Whatis Apache Mahout?
adaptTo()2016 6
Project of the Apache Software
Foundation.
Producing free implementations of
scalablemachine learning algorithms,
written in Java.
7. History
adaptTo()2016 7
Started as a Lucenesub-project.
Became Apache TLPin April 2010.
Latest version – 0.12.2 – Released on 13th June 2016.
8. Why ApacheMahout?
adaptTo()2016 8
Increasing volume of data!
Traditional Data miningalgorithms struggle to process very
large datasets.
Apache Mahoutto therescue!
13. Machine Learning
adaptTo()2016 13
Programmingcomputers to optimize a Performance Criterion
usingExample Data or PastExperience
Branch of ArtificialIntelligence.
Computers evolve behavior based on Empirical data.
14. Techniques
adaptTo()2016 14
Supervised Learning
Use Labelled training data to create a classifier that can predict
output for unseen inputs.
Unsupervised Learning
Use Unlabeled training data to create a function that can predict
output.
20. ApacheMahout RecommendationEngine
adaptTo()2016 20
Helps users find items they mightlike based on historical
behavior and preferences.
Mahoutprovides a rich set of componentsfrom which a
customizedrecommender system can be constructed usinga
selection ofAlgorithms.
23. Checklist
adaptTo()2016 23
AEM 6.2
Mahout as a Maven Dependency
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-mr</artifactId>
<version>0.10.0</version>
</dependency>
24. JCRDataModel
adaptTo()2016 24
DataModel
Implementations representing a repository of information about
users and their associated preferences.
AbstractDataModel, JDBCDataModel, FileDataModel,
GenericBooleanPrefDataModel, GenericDataModel.
AEM - JCRDataModel.
25. Code(1/2)
adaptTo()2016 25
Using The AEM JCRDataModel
public JSONArray getUserBasedRecommendations(ResourceResolver
resourceResolver, String userId, int numberOfRecommendations) {
//Creating JCRDataModel to fetch information from JCR
DataModel model = JCRDataModel.createDataModel(resourceResolver);
}
27. AEMProduct Recommendation
adaptTo()2016 27
User Based Recommendation
Takesuser ratingsinto consideration
Based on PearsonCorrelationSimilarity
Uses NearestNUserNeighborhood
28. ConfiguringJCRDataModel
adaptTo()2016 28
Configurations
User Generated Content Path
/content/usergenerated/asi/jcr
Product Path
/etc/commerce/products/geometrixx-outdoors
Rating Resource Type
Defaults to social/tally/components/response