context-aware recommendation: a quick view
TRANSCRIPT
Context-aware Recommendation:A Quick View
Yong ZhengCenter for Web Intelligence
DePaul University, ChicagoFeb 23, 2016
Outline
• Background
Recommender Systems
Evaluation
Matrix Factorization
• Context-aware RecommendationContext
Contextual PreFiltering
Contextual Modeling
• CARSKit: A Context-aware Recommendation Library
2
Background
Recommender System (RS)
• RS: item recommendations tailored to user tastes
4
How it works
5
How it works
6
How it works
7
How it works
8
Binary FeedbackRatings Reviews Behaviors
• User Preferences
Explicit Implicit
9
Task and Eval: Rating Prediction
User Item Rating
U1 T1 4
U1 T2 3
U1 T3 3
U2 T2 4
U2 T3 5
U2 T4 5
U3 T4 4
U1 T4 3
U2 T1 2
U3 T1 3
U3 T2 3
U3 T3 4
Train
Test
Task: P(U, T) in testing set
Assume a simple model: P(U, T) = Avg (T)
P(U1, T4) = Avg(T4) = (5+4)/2 = 4.5P(U2, T1) = Avg(T1) = 4/1 = 4P(U3, T1) = Avg(T1) = 4/1 = 4P(U3, T2) = Avg(T2) = (3+4)/2 = 3.5P(U3, T3) = Avg(T3) = (3+5)/2 = 4
Mean Absolute Error (MAE) =
ei = R(U, T) – P(U, T)
MAE = (|3 – 4.5| + |2 - 4| + |3 - 4| +|3 – 3.5| + |4 - 4|) / 5 = 1
10
Task and Eval: Top-N Recommendation
User Item Rating
U1 T1 4
U1 T2 3
U1 T3 3
U2 T2 4
U2 T3 5
U2 T4 5
U3 T4 4
U1 T4 3
U2 T1 2
U3 T1 3
U3 T2 3
U3 T3 4
Train
Test
Task: Top-N Items to user U3
Assume a simple model: P(U, T) = Avg (T)
P(U3, T1) = Avg(T1) = 4/1 = 4P(U3, T2) = Avg(T2) = (3+4)/2 = 3.5P(U3, T3) = Avg(T3) = (3+5)/2 = 4P(U3, T4) = Avg(T4) = (4+5)/2 = 3.5
Predicted Rank: T3, T1, T4, T2Real Rank: T3, T2, T1
Precision@N = # of hits/NPrecision@1 = 1/1Precision@2 = 2/2Precision@3 = 2/3
11
More Evaluation Metrics
• There are many more evaluation metrics
Task: Rating Prediction
MAE, RMSE, MSE, MPE, etc
Task: Top-N Recommendation
Relevance: Precision, Recall, F-Measure, AUC, etc
Ranking: MAP, NDCG, MRR, etc
Business Metrics
Retention rate, response rate, purchases, etc
12
Matrix Factorization (MF)
User HarryPotter Batman Spiderman
U1 5 3 4
U2 ? 2 4
U3 4 2 ?
R P Q
13
Matrix Factorization (MF)
R P Q
R = Rating Matrix, m users, n movies;P = User Matrix, m users, f latent factors/features;Q = Item Matrix, n movies, f latent factors/features;
Interpretation:pu indicates how much user likes f latent factors;qi means how much one item obtains f latent factors;The dot product indicates how much user likes item;
14
Matrix Factorization (MF)
minq,p S (u,i) e R ( rui - qti pu )2 + l (|qi|
2 + |pu|2 )
Goal: Try to learn P and Q by minimizing the squared error
goodness of fit regularization
Goodness of fit: to reduce the prediction errors;Regularization term: to alleviate the overfitting;
15
Matrix Factorization (MF)
Optimization using stochastic gradient descent (SGD)
Parameter updates based on SGD
16
MovieLens-100K, http://grouplens.org/datasets/movielens/
100K ratings given by 943 users on 1,682 movies
0.006
0.007
0.008
0.009
0.01
0.011
0.012
0.013
0.014
0.015
0.016
0.7
0.72
0.74
0.76
0.78
0.8
0.82
ItemAvg ItemKNN MF
Precisio
nMA
E
MAE Precision@10
Matrix Factorization (MF)
Context-aware
Recommendation
Non-context vs Context
18
Companion
• Decision Making = Rational + Contextual
• Examples: Travel destination: in winter vs in summer
Movie watching: with children vs with partner
Restaurant: quick lunch vs business dinner
What is Context?
19
• “Context is any information that can be used to characterize the situation of an entity” by Anind K. Dey, 2001
• Observed Context:
Contexts are those variables which may change when a same
activity is performed again and again.
• Examples:
Watching a movie: time, location, companion, etc
Listening to a music: time, location, emotions, occasions, etc
Context-aware RS (CARS)
20
• Traditional RS: Users × Items Ratings
• Contextual RS: Users × Items × Contexts Ratings
Example of Multi-dimensional Context-aware Data set
User Item Rating Time Location Companion
U1 T1 3 Weekend Home Kids
U1 T2 5 Weekday Home Partner
U2 T2 2 Weekend Cinema Partner
U2 T3 3 Weekday Cinema Family
U1 T3 ? Weekend Cinema Kids
21
• There are three ways to build algorithms for CARS
Context-aware RS (CARS)
Contextual PreFiltering
23
• List of Contextual PreFiltering Algorithms
Reduction-based approach, 2005
Exact and Generalized PreFiltering, 2009
Item Splitting, 2009
User Splitting, 2011
Dimension as Virtual Items, 2011
User-Item Splitting, 2014
Contextual PreFiltering
24
The underlying idea in item splitting is that the nature of an item, from the user's point of view, may change in different contextual conditions, hence it may be useful to consider it as two different items. (L. Baltrunas, F. Ricci, RecSys'09) – In short, contexts are dependent with items.
Contextual PreFiltering (Item Splitting)
At Cinema At Home At Swimming Pool
25
Contextual PreFiltering (Item Splitting)
User Item Location Rating
U1 M1 Pool 5
U2 M1 Pool 5
U3 M1 Pool 5
U1 M1 Home 2
U4 M1 Home 3
U2 M1 Home 2
High Rating
Low Rating
Significant difference?
Let’s split it !!!
M11: being seen at Pool
M12: being seen at Home
M1
Same movie,
different IDs.
26
Contextual PreFiltering (Item Splitting)
User Item Loc Rating
U1 M1 Pool 5
U2 M1 Pool 5
U3 M1 Pool 5
U1 M1 Home 2
U4 M1 Home 3
U2 M1 Cinema 2
User Item Rating
U1 M11 5
U2 M11 5
U3 M11 5
U1 M12 2
U4 M12 3
U2 M12 2
Transformation
If there is qualified split,one item will be split to
two new ones.
A binary contextual condition for splitting:
“Pool” vs. “Non-Pool”
After transformation, we obtain a 2D User-Item rating matrix, so that any traditional recommendation algorithms can be applied to.
27
Contextual PreFiltering (Item Splitting)
User Item Loc Rating
U1 M1 Pool 5
U2 M1 Pool 5
U3 M1 Pool 5
U1 M1 Home 2
U4 M1 Home 3
U2 M1 Cinema 2
User Item Rating
U1 M11 5
U2 M11 5
U3 M11 5
U1 M12 2
U4 M12 3
U2 M12 2
Transformation
Question: How to find such a split? Pool and Non-pool, or Home and Non-home?
We employ a t-test on two pieces of ratings,the best choice should help obtain thelargest t value and a small p-value (e.g., < 0.05)
28
Contextual PreFiltering (Other Splitting)
29
Example of Splitting Approaches
0.76
0.78
0.8
0.82
0.84
0.86
0.88
0.9
0.92
0.94
0.96
MF ItemSplitting UserSplitting UISplitting
MAE
Restaurant data: 2309 ratings given by 50 users on 40 restaurants in context Time and Location
Contextual Modeling
31
• List of Contextual Modeling Algorithms
Tensor Factorization, 2010
Factorization Machines, 2011
Deviation-Based Context-aware Matrix Factorization, 2011
Deviation-Based Contextual Sparse Linear Method, 2014
Similarity-Based Context-aware Matrix Factorization, 2015
Similarity-Based Contextual Sparse Linear Method, 2015
Contextual Modeling
32
• Deviation-Based Context-aware MF (CAMF)
Contextual Rating Deviation (CRD): how user’s rating is deviated?
CRD(1) = 0.5 Users’ rating in Weekday is generally higher than users’ rating at Weekend by 0.5
CRD(2) = -0.1 Users’ rating in Cinema is generally lower than users’ rating at Home by 0.1
Deviation-Based Context-aware MF
Context D1: Time D2: Location
c1 Weekend Home
c2 Weekday Cinema
CRD(i) 0.5 -0.1
33
Deviation-Based Context-aware MF: CAMF_C
Deviation-Based Context-aware MF
BiasedMF in Traditional RS:
CAMF_C Approach:
Global Average Rating User bias Item Bias User-Item interaction
Contextual Rating Deviation
34
Deviation-Based Context-aware MF: CAMF_CU & CAMF_CI
Deviation-Based Context-aware MF
BiasedMF in Traditional RS:
CAMF_C Approach:
Global Average Rating User bias Item Bias User-Item interaction
CAMF_CU Approach:
CAMF_CI Approach:
35
Example: CAMF
Restaurant data: 2309 ratings given by 50 users on 40 restaurants in context Time and Location
0.6
0.65
0.7
0.75
0.8
0.85
0.9
0.95
1
MF ItemSplitting UserSplitting UISplitting CAMF_C CAMF_CI CAMF_CU
MAE
CARSKit: A Library
37
CARSKit: A Java-based Open-sourceContext-aware Recommendation Library
There are many recommendation library for traditional recommendation.Users × Items Ratings
38
CARSKit: A Java-based Open-sourceContext-aware Recommendation Library
CARSKit: https://github.com/irecsys/CARSKitUsers × Items × Contexts Ratings
Yong ZhengCenter for Web Intelligence
DePaul University, ChicagoFeb 23, 2016
Context-aware Recommendation:A Quick View