Training the matrix factorization model
In this section, we'll train the BigQuery ML matrix factorization model in order to build a recommendation system with the e-commerce data that we've already prepared.
Let's start training the purchase_recommender
ML model by executing the following SQL statement:
CREATE OR REPLACE MODEL `09_recommendation_engine.purchase_recommender` OPTIONS(model_type='matrix_factorization', Â Â Â Â Â Â Â Â user_col='fullVisitorID', Â Â Â Â Â Â Â Â item_col='purchased_product_id', Â Â Â Â Â Â Â Â rating_col='quantity', Â Â Â Â Â Â Â Â feedback_type='implicit' Â Â Â Â Â Â Â Â ) AS SELECT fullVisitorID, purchased_product_id, quantity FROM `09_recommendation_engine.product_purchases`;
The first few lines of the query are composed...