SlideShare a Scribd company logo
1 of 20
INTRODUCTION TO
    MATRIX FACTORIZATION




                              proprietary material
    METHODS COLLABORATIVE
    FILTERING
    USER RATINGS PREDICTION


1   Alex Lin
    Senior Architect
    Intelligent Mining
Outline
  Factoranalysis
  Matrix decomposition




                                    proprietary material
  Matrix Factorization Model

  Minimizing Cost Function
  Common Implementation




                                2
Factor Analysis
  Aprocedure can help identify the factors that
   might be used to explain the interrelationships
   among the variables




                                                         proprietary material
  Model based approach




                                                     3
Refresher: Matrix Decomposition
                 r                                   q                           p
            5 x 6 matrix                       5 x 3 matrix                 3 x 6 matrix

X11   X12     X13    X14   X15   X16                                    x




                                                                                               proprietary material
X21   X22     X12    X24   X25   X26                                    y

X31   X32     X33    X34   X35   X36         a     b      c             z

X41   X42     X43    X44   X45   X46

X51   X52     X53    X54   X55   X56




X32 = (a, b, c) . (x, y, z) = a * x + b * y + c * z

      Rating Prediction                rui = qT pu
                                       ˆ      i
                                                         User Preference Factor Vector
                                                                                           4


                                             Movie Preference Factor Vector
Making Prediction as Filling Missing
Value
                                     users
              1   2   3     4    5    6   7   8   9   10   …   n




                                                                                                 proprietary material
          1   5       4               4               3
          2                               3       ?
  items




          3   3   ?         5    ?            2
          4       3              3            4   3

                      4                   4
          …




          m




                                              rui = qT pu
                                              ˆ      i
                                                                   User Preference Factor Vector

                                                                                             5
                          Rating Prediction           Movie Preference Factor Vector




                           €
Learn Factor Vectors
                                  users
             1   2   3    4   5    6   7    8    9   10   …      n

         1   5       4             4                 3




                                                                             proprietary material
         2                             3         ?
 items




         3   3   ?        5   ?             2
         4       3            3             4    3

                     4                 4
         …




     4 = U3-1 * I1-1 + U3-2 * I1-2 + U3-3 * I1-3 + U3-4 * I1-4
       m
     3 = U7-1 * I2-1 + U7-2 * I2-2 + U7-3 * I2-3 + U7-4 * I2-4
     …..

     3 = U86-1 * I12-1 + U86-2 * I12-2 + U86-3 * I12-3 + U86-4 * I12-4

                               Note: only train on known entries
    2X + 3Y = 5          2X + 3Y = 5                                     6
    4X - 2Y = 2          4X - 2Y = 2
                         3X - 2Y = 2
Why not use standard SVD?
  Standard   SVD assumes all missing entries are
   zero. This leads to bad prediction accuracy,
   especially when dataset is extremely sparse. (98%




                                                           proprietary material
   - 99.9%)
  See Appendix for SVD

  In some published literatures, they call Matrix
   Factorization as SVD, but note it’s NOT the same
   kind of classical low-rank SVD produced by
   svdlibc.


                                                       7
How to Learn Factor Vectors
  How do we learn preference factor vectors (a, b, c) and
   (x, y, z)?




                                                                                                proprietary material
  Minimize errors on the known ratings

                                                        To learn the factor
                    min
                    q*. p*
                                ∑ (rui − x ui )   2
                                                        vectors (pu and qi)
                             (u,i)∈k

     Minimizing Cost Function
     (Least Squares Problem)


                                              rui : actual rating for user u on item I
     €                                        xui : predicted rating for user u on item I


                                                                                            8
Data Normalization
  Remove         Global mean
                                            users




                                                                                      proprietary material
              1     2     3     4     5      6    7     8     9     10    …   n

          1   1.5         -.9               -.2                     .49

          2                                       .79         ?
  items




          3   0.6   ?           .46   ?                 -.4

          4         .39               .82               .76   .69
          …




                          .52                     .8

          m




                                                                                  9
Factorization Model
      Only     Preference factors

      min        ∑ (rui − µ − qT pu ) 2




                                                                                                     proprietary material
                               i
       q*. p*
                (u,i)∈k
                                        To learn the factor vectors (pu and qi)




                          Rating = 4
€
                 Global        Preference
                 Mean            Factor

                                                               rui : actual rating of user u on item I
                                                               u : training rating average
                                                               bu : user u user bias                10
                                                               bi : item i item bias
                                                               qi : latent factor array of item i
                                                               pu : later factor array of user u
Adding Item Bias and User Bias
      Add     Item bias and User bias as parameters

      min       ∑ (rui − µ − bi − bu − qT pu ) 2




                                                                                                         proprietary material
                                        i
      q*. p*
               (u,i)∈k
                                         To learn Item bias and User bias




                          Rating = 4
€
                 Global     Preference
                 Mean         Factor



                                                              rui : actual rating of user u on item I
                                                              u : training rating average
                                  Item Bias     User Bias
                                                              bu : user u user bias                     11
                                                              bi : item i item bias
                                                              qi : latent factor array of item i
                                                              pu : later factor array of user u
Regularization
    To      prevent model overfitting
                                                                    2            2
          ∑




                                                                                                       proprietary material
min         (rui − µ − bi − bu − q pu ) + λ ( qi + pu + bi2 + bu )
                                                T
                                                i
                                                        2      2
q*. p*
         (u,i)∈k
                                                            Regularization to prevent overfitting



                            Rating = 4


                   Global     Preference
                   Mean         Factor

                                                            rui : actual rating of user u on item I
                                                            u : training rating average
                                                            bu : user u user bias
                                    Item Bias   User Bias   bi : item i item bias
                                                                                                      12
                                                            qi : latent factor array of item i
                                                            pu : later factor array of user u
                                                            λ : regularization Parameters


                                                        €
Optimize Factor Vectors
  Find optimal factor vectors - minimizing cost
   function




                                                    proprietary material
  Algorithms:
      Stochastic gradient descent
      Others: Alternating least squares etc..
  Most   frequently use:
      Stochastic gradient descent




                                                   13
Matrix Factorization Tuning
  Number  of Factors in the Preference vectors
  Learning Rate of Gradient Descent




                                                                    proprietary material
      Best result usually coming from different learning rate
       for different parameter. Especially user/item bias terms.
  Parameters     in Factorization Model
      Time dependent parameters
      Seasonality dependent parameters
  Many    other considerations !



                                                                   14
High-Level Implementation Steps
  Construct  User-Item Matrix (sparse data structure!)
  Define factorization model - Cost function




                                                           proprietary material
  Take out global mean

  Decide what parameters in the model. (bias,
   preference factor, anything else? SVD++)
  Minimizing cost function - model fitting
      Stochastic gradient descent
      Alternating least squares
  Assemble the predictions
  Evaluate predictions (RMSE, MAE etc..)

  Continue to tune the model
                                                          15
Thank you
  Any   question or comment?




                                 proprietary material
                                16
Appendix
  Stochastic Gradient Descent
  Batch Gradient Descent




                                         proprietary material
  Singular Value Decomposition (SVD)




                                        17
Stochastic Gradient Descent
    Repeat Until Convergence {
       for i=1 to m in random order {




                                                                         proprietary material
            θ j := θ j + α (y (i) − hθ (x ( i) ))x (ji) (for every j)
        }                      partial derivative term
    }


€   Your code Here:




                                                                        18
Batch Gradient Descent
    Repeat Until Convergence {
                         m
        θ j := θ j + α ∑ (y (i) − hθ (x ( i) ))x (ji)   (for every j)




                                                                         proprietary material
                        i=1   partial derivative term
    }


€   Your code Here:




                                                                        19
Singular Value Decomposition
            (SVD)
            A = U × S ×VT
                 A                     U                S             VT
                                   m x r matrix    r x r matrix   r x n matrix




                                                                                  proprietary material
            m x n matrix




€
    items




                           items



                                                  rank = k
                                                  k<r


              users                                                 users

            Ak = U k × Sk × VkT

                                                                                 20

€

More Related Content

What's hot

Matrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsMatrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsYONG ZHENG
 
Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial Alexandros Karatzoglou
 
Recommendation system (1).pptx
Recommendation system (1).pptxRecommendation system (1).pptx
Recommendation system (1).pptxprathammishra28
 
Item Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation AlgorithmsItem Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation Algorithmsnextlib
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning AlgorithmsHichem Felouat
 
An introduction to Recommender Systems
An introduction to Recommender SystemsAn introduction to Recommender Systems
An introduction to Recommender SystemsDavid Zibriczky
 
K- Nearest Neighbor Approach
K- Nearest Neighbor ApproachK- Nearest Neighbor Approach
K- Nearest Neighbor ApproachKumud Arora
 
Movie lens recommender systems
Movie lens recommender systemsMovie lens recommender systems
Movie lens recommender systemsKapil Garg
 
Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier Dev Sahu
 
Collaborative Filtering Recommendation System
Collaborative Filtering Recommendation SystemCollaborative Filtering Recommendation System
Collaborative Filtering Recommendation SystemMilind Gokhale
 
Recommendation Systems
Recommendation SystemsRecommendation Systems
Recommendation SystemsRobin Reni
 
Recommender systems
Recommender systemsRecommender systems
Recommender systemsTamer Rezk
 
Recent advances in deep recommender systems
Recent advances in deep recommender systemsRecent advances in deep recommender systems
Recent advances in deep recommender systemsNAVER Engineering
 
Recommender system introduction
Recommender system   introductionRecommender system   introduction
Recommender system introductionLiang Xiang
 
Recommender Systems: Advances in Collaborative Filtering
Recommender Systems: Advances in Collaborative FilteringRecommender Systems: Advances in Collaborative Filtering
Recommender Systems: Advances in Collaborative FilteringChangsung Moon
 
Introduction to Recommendation Systems
Introduction to Recommendation SystemsIntroduction to Recommendation Systems
Introduction to Recommendation SystemsTrieu Nguyen
 
[Final]collaborative filtering and recommender systems
[Final]collaborative filtering and recommender systems[Final]collaborative filtering and recommender systems
[Final]collaborative filtering and recommender systemsFalitokiniaina Rabearison
 
Recommendation system
Recommendation systemRecommendation system
Recommendation systemDing Li
 

What's hot (20)

Matrix Factorization In Recommender Systems
Matrix Factorization In Recommender SystemsMatrix Factorization In Recommender Systems
Matrix Factorization In Recommender Systems
 
Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial
 
Recommendation system (1).pptx
Recommendation system (1).pptxRecommendation system (1).pptx
Recommendation system (1).pptx
 
Item Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation AlgorithmsItem Based Collaborative Filtering Recommendation Algorithms
Item Based Collaborative Filtering Recommendation Algorithms
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
An introduction to Recommender Systems
An introduction to Recommender SystemsAn introduction to Recommender Systems
An introduction to Recommender Systems
 
K- Nearest Neighbor Approach
K- Nearest Neighbor ApproachK- Nearest Neighbor Approach
K- Nearest Neighbor Approach
 
Movie lens recommender systems
Movie lens recommender systemsMovie lens recommender systems
Movie lens recommender systems
 
Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier Sentiment analysis using naive bayes classifier
Sentiment analysis using naive bayes classifier
 
Collaborative Filtering Recommendation System
Collaborative Filtering Recommendation SystemCollaborative Filtering Recommendation System
Collaborative Filtering Recommendation System
 
Text Classification
Text ClassificationText Classification
Text Classification
 
Recommendation Systems
Recommendation SystemsRecommendation Systems
Recommendation Systems
 
Recommender systems
Recommender systemsRecommender systems
Recommender systems
 
Recent advances in deep recommender systems
Recent advances in deep recommender systemsRecent advances in deep recommender systems
Recent advances in deep recommender systems
 
Recommender system introduction
Recommender system   introductionRecommender system   introduction
Recommender system introduction
 
Recommender Systems: Advances in Collaborative Filtering
Recommender Systems: Advances in Collaborative FilteringRecommender Systems: Advances in Collaborative Filtering
Recommender Systems: Advances in Collaborative Filtering
 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
 
Introduction to Recommendation Systems
Introduction to Recommendation SystemsIntroduction to Recommendation Systems
Introduction to Recommendation Systems
 
[Final]collaborative filtering and recommender systems
[Final]collaborative filtering and recommender systems[Final]collaborative filtering and recommender systems
[Final]collaborative filtering and recommender systems
 
Recommendation system
Recommendation systemRecommendation system
Recommendation system
 

Viewers also liked

この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜Takahiro Inoue
 
Matrix factorization
Matrix factorizationMatrix factorization
Matrix factorizationrubyyc
 
آموزش محاسبات عددی - بخش دوم
آموزش محاسبات عددی - بخش دومآموزش محاسبات عددی - بخش دوم
آموزش محاسبات عددی - بخش دومfaradars
 
Matrix Factorization Technique for Recommender Systems
Matrix Factorization Technique for Recommender SystemsMatrix Factorization Technique for Recommender Systems
Matrix Factorization Technique for Recommender SystemsAladejubelo Oluwashina
 
Lecture 6 lu factorization & determinants - section 2-5 2-7 3-1 and 3-2
Lecture 6   lu factorization & determinants - section 2-5 2-7 3-1 and 3-2Lecture 6   lu factorization & determinants - section 2-5 2-7 3-1 and 3-2
Lecture 6 lu factorization & determinants - section 2-5 2-7 3-1 and 3-2njit-ronbrown
 
Nonnegative Matrix Factorization
Nonnegative Matrix FactorizationNonnegative Matrix Factorization
Nonnegative Matrix FactorizationTatsuya Yokota
 
Neighbor methods vs matrix factorization - case studies of real-life recommen...
Neighbor methods vs matrix factorization - case studies of real-life recommen...Neighbor methods vs matrix factorization - case studies of real-life recommen...
Neighbor methods vs matrix factorization - case studies of real-life recommen...Domonkos Tikk
 
Intro to Factorization Machines
Intro to Factorization MachinesIntro to Factorization Machines
Intro to Factorization MachinesPavel Kalaidin
 
Collaborative Filtering with Spark
Collaborative Filtering with SparkCollaborative Filtering with Spark
Collaborative Filtering with SparkChris Johnson
 
Factorization Machines with libFM
Factorization Machines with libFMFactorization Machines with libFM
Factorization Machines with libFMLiangjie Hong
 
Beginners Guide to Non-Negative Matrix Factorization
Beginners Guide to Non-Negative Matrix FactorizationBeginners Guide to Non-Negative Matrix Factorization
Beginners Guide to Non-Negative Matrix FactorizationBenjamin Bengfort
 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender SystemsT212
 
Recommendation system
Recommendation system Recommendation system
Recommendation system Vikrant Arya
 
Building a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engineBuilding a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engineNYC Predictive Analytics
 
Recommender system algorithm and architecture
Recommender system algorithm and architectureRecommender system algorithm and architecture
Recommender system algorithm and architectureLiang Xiang
 

Viewers also liked (17)

Multidimensional RNN
Multidimensional RNNMultidimensional RNN
Multidimensional RNN
 
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
 
Matrix factorization
Matrix factorizationMatrix factorization
Matrix factorization
 
آموزش محاسبات عددی - بخش دوم
آموزش محاسبات عددی - بخش دومآموزش محاسبات عددی - بخش دوم
آموزش محاسبات عددی - بخش دوم
 
Matrix Factorization Technique for Recommender Systems
Matrix Factorization Technique for Recommender SystemsMatrix Factorization Technique for Recommender Systems
Matrix Factorization Technique for Recommender Systems
 
Lecture 6 lu factorization & determinants - section 2-5 2-7 3-1 and 3-2
Lecture 6   lu factorization & determinants - section 2-5 2-7 3-1 and 3-2Lecture 6   lu factorization & determinants - section 2-5 2-7 3-1 and 3-2
Lecture 6 lu factorization & determinants - section 2-5 2-7 3-1 and 3-2
 
Nonnegative Matrix Factorization
Nonnegative Matrix FactorizationNonnegative Matrix Factorization
Nonnegative Matrix Factorization
 
Neighbor methods vs matrix factorization - case studies of real-life recommen...
Neighbor methods vs matrix factorization - case studies of real-life recommen...Neighbor methods vs matrix factorization - case studies of real-life recommen...
Neighbor methods vs matrix factorization - case studies of real-life recommen...
 
Intro to Factorization Machines
Intro to Factorization MachinesIntro to Factorization Machines
Intro to Factorization Machines
 
Collaborative Filtering with Spark
Collaborative Filtering with SparkCollaborative Filtering with Spark
Collaborative Filtering with Spark
 
Factorization Machines with libFM
Factorization Machines with libFMFactorization Machines with libFM
Factorization Machines with libFM
 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
 
Beginners Guide to Non-Negative Matrix Factorization
Beginners Guide to Non-Negative Matrix FactorizationBeginners Guide to Non-Negative Matrix Factorization
Beginners Guide to Non-Negative Matrix Factorization
 
Recommender Systems
Recommender SystemsRecommender Systems
Recommender Systems
 
Recommendation system
Recommendation system Recommendation system
Recommendation system
 
Building a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engineBuilding a Recommendation Engine - An example of a product recommendation engine
Building a Recommendation Engine - An example of a product recommendation engine
 
Recommender system algorithm and architecture
Recommender system algorithm and architectureRecommender system algorithm and architecture
Recommender system algorithm and architecture
 

Similar to Introduction to Matrix Factorization Methods Collaborative Filtering

Optimization in Crowd Movement Models via Anticipation
Optimization in Crowd Movement Models via AnticipationOptimization in Crowd Movement Models via Anticipation
Optimization in Crowd Movement Models via AnticipationSSA KPI
 
Self Organinising neural networks
Self Organinising  neural networksSelf Organinising  neural networks
Self Organinising neural networksESCOM
 
Machine learning
Machine learningMachine learning
Machine learningpdingles
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learningbutest
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learningbutest
 
Mining at scale with latent factor models for matrix completion
Mining at scale with latent factor models for matrix completionMining at scale with latent factor models for matrix completion
Mining at scale with latent factor models for matrix completionFabio Petroni, PhD
 
Day 13 graphing linear equations from tables
Day 13 graphing linear equations from tablesDay 13 graphing linear equations from tables
Day 13 graphing linear equations from tablesErik Tjersland
 
225.doc
225.doc225.doc
225.docbutest
 
Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...
Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...
Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...Beniamino Murgante
 
Singapore conference
Singapore conferenceSingapore conference
Singapore conferencekmatthcera
 

Similar to Introduction to Matrix Factorization Methods Collaborative Filtering (10)

Optimization in Crowd Movement Models via Anticipation
Optimization in Crowd Movement Models via AnticipationOptimization in Crowd Movement Models via Anticipation
Optimization in Crowd Movement Models via Anticipation
 
Self Organinising neural networks
Self Organinising  neural networksSelf Organinising  neural networks
Self Organinising neural networks
 
Machine learning
Machine learningMachine learning
Machine learning
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
Mining at scale with latent factor models for matrix completion
Mining at scale with latent factor models for matrix completionMining at scale with latent factor models for matrix completion
Mining at scale with latent factor models for matrix completion
 
Day 13 graphing linear equations from tables
Day 13 graphing linear equations from tablesDay 13 graphing linear equations from tables
Day 13 graphing linear equations from tables
 
225.doc
225.doc225.doc
225.doc
 
Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...
Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...
Intelligent analysis for historical macroseismic damage scenarios Fabrizio Gi...
 
Singapore conference
Singapore conferenceSingapore conference
Singapore conference
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

Introduction to Matrix Factorization Methods Collaborative Filtering

  • 1. INTRODUCTION TO MATRIX FACTORIZATION proprietary material METHODS COLLABORATIVE FILTERING USER RATINGS PREDICTION 1 Alex Lin Senior Architect Intelligent Mining
  • 2. Outline   Factoranalysis   Matrix decomposition proprietary material   Matrix Factorization Model   Minimizing Cost Function   Common Implementation 2
  • 3. Factor Analysis   Aprocedure can help identify the factors that might be used to explain the interrelationships among the variables proprietary material   Model based approach 3
  • 4. Refresher: Matrix Decomposition r q p 5 x 6 matrix 5 x 3 matrix 3 x 6 matrix X11 X12 X13 X14 X15 X16 x proprietary material X21 X22 X12 X24 X25 X26 y X31 X32 X33 X34 X35 X36 a b c z X41 X42 X43 X44 X45 X46 X51 X52 X53 X54 X55 X56 X32 = (a, b, c) . (x, y, z) = a * x + b * y + c * z Rating Prediction rui = qT pu ˆ i User Preference Factor Vector 4 Movie Preference Factor Vector
  • 5. Making Prediction as Filling Missing Value users 1 2 3 4 5 6 7 8 9 10 … n proprietary material 1 5 4 4 3 2 3 ? items 3 3 ? 5 ? 2 4 3 3 4 3 4 4 … m rui = qT pu ˆ i User Preference Factor Vector 5 Rating Prediction Movie Preference Factor Vector €
  • 6. Learn Factor Vectors users 1 2 3 4 5 6 7 8 9 10 … n 1 5 4 4 3 proprietary material 2 3 ? items 3 3 ? 5 ? 2 4 3 3 4 3 4 4 … 4 = U3-1 * I1-1 + U3-2 * I1-2 + U3-3 * I1-3 + U3-4 * I1-4 m 3 = U7-1 * I2-1 + U7-2 * I2-2 + U7-3 * I2-3 + U7-4 * I2-4 ….. 3 = U86-1 * I12-1 + U86-2 * I12-2 + U86-3 * I12-3 + U86-4 * I12-4 Note: only train on known entries 2X + 3Y = 5 2X + 3Y = 5 6 4X - 2Y = 2 4X - 2Y = 2 3X - 2Y = 2
  • 7. Why not use standard SVD?   Standard SVD assumes all missing entries are zero. This leads to bad prediction accuracy, especially when dataset is extremely sparse. (98% proprietary material - 99.9%)   See Appendix for SVD   In some published literatures, they call Matrix Factorization as SVD, but note it’s NOT the same kind of classical low-rank SVD produced by svdlibc. 7
  • 8. How to Learn Factor Vectors   How do we learn preference factor vectors (a, b, c) and (x, y, z)? proprietary material   Minimize errors on the known ratings To learn the factor min q*. p* ∑ (rui − x ui ) 2 vectors (pu and qi) (u,i)∈k Minimizing Cost Function (Least Squares Problem) rui : actual rating for user u on item I € xui : predicted rating for user u on item I 8
  • 9. Data Normalization   Remove Global mean users proprietary material 1 2 3 4 5 6 7 8 9 10 … n 1 1.5 -.9 -.2 .49 2 .79 ? items 3 0.6 ? .46 ? -.4 4 .39 .82 .76 .69 … .52 .8 m 9
  • 10. Factorization Model   Only Preference factors min ∑ (rui − µ − qT pu ) 2 proprietary material i q*. p* (u,i)∈k To learn the factor vectors (pu and qi) Rating = 4 € Global Preference Mean Factor rui : actual rating of user u on item I u : training rating average bu : user u user bias 10 bi : item i item bias qi : latent factor array of item i pu : later factor array of user u
  • 11. Adding Item Bias and User Bias   Add Item bias and User bias as parameters min ∑ (rui − µ − bi − bu − qT pu ) 2 proprietary material i q*. p* (u,i)∈k To learn Item bias and User bias Rating = 4 € Global Preference Mean Factor rui : actual rating of user u on item I u : training rating average Item Bias User Bias bu : user u user bias 11 bi : item i item bias qi : latent factor array of item i pu : later factor array of user u
  • 12. Regularization   To prevent model overfitting 2 2 ∑ proprietary material min (rui − µ − bi − bu − q pu ) + λ ( qi + pu + bi2 + bu ) T i 2 2 q*. p* (u,i)∈k Regularization to prevent overfitting Rating = 4 Global Preference Mean Factor rui : actual rating of user u on item I u : training rating average bu : user u user bias Item Bias User Bias bi : item i item bias 12 qi : latent factor array of item i pu : later factor array of user u λ : regularization Parameters €
  • 13. Optimize Factor Vectors   Find optimal factor vectors - minimizing cost function proprietary material   Algorithms:   Stochastic gradient descent   Others: Alternating least squares etc..   Most frequently use:   Stochastic gradient descent 13
  • 14. Matrix Factorization Tuning   Number of Factors in the Preference vectors   Learning Rate of Gradient Descent proprietary material   Best result usually coming from different learning rate for different parameter. Especially user/item bias terms.   Parameters in Factorization Model   Time dependent parameters   Seasonality dependent parameters   Many other considerations ! 14
  • 15. High-Level Implementation Steps   Construct User-Item Matrix (sparse data structure!)   Define factorization model - Cost function proprietary material   Take out global mean   Decide what parameters in the model. (bias, preference factor, anything else? SVD++)   Minimizing cost function - model fitting   Stochastic gradient descent   Alternating least squares   Assemble the predictions   Evaluate predictions (RMSE, MAE etc..)   Continue to tune the model 15
  • 16. Thank you   Any question or comment? proprietary material 16
  • 17. Appendix   Stochastic Gradient Descent   Batch Gradient Descent proprietary material   Singular Value Decomposition (SVD) 17
  • 18. Stochastic Gradient Descent Repeat Until Convergence { for i=1 to m in random order { proprietary material θ j := θ j + α (y (i) − hθ (x ( i) ))x (ji) (for every j) } partial derivative term } € Your code Here: 18
  • 19. Batch Gradient Descent Repeat Until Convergence { m θ j := θ j + α ∑ (y (i) − hθ (x ( i) ))x (ji) (for every j) proprietary material i=1 partial derivative term } € Your code Here: 19
  • 20. Singular Value Decomposition (SVD) A = U × S ×VT A U S VT m x r matrix r x r matrix r x n matrix proprietary material m x n matrix € items items rank = k k<r users users Ak = U k × Sk × VkT 20 €