This repository contains an implementation of the Alternating Least Squares (ALS) algorithm using PySpark on a Google Cloud services. The project focuses on generating collaborative book recommendations based on user ratings data .
The project involves the following steps:
- Loading book ratings data from a CSV file stored in a GCS bucket.
- Storing the loaded data into a BigQuery table using a PySpark cluster.
- Training an ALS model on the book ratings data to generate recommendations.
- Evaluating the model using the Root Mean Squared Error (RMSE) metric.
This notebook performs the following tasks:
- Loads a CSV file containing book ratings data from a GCS bucket.
- Uses a PySpark cluster to process the data.
- Stores the processed data into a BigQuery table.
This notebook performs the following tasks:
- Initiates a Spark session with BigQuery configuration.
- Loads data from the previously created BigQuery table into a DataFrame.
- Uses the ALS algorithm to train a recommendation model on the book ratings data.
- Calculates the RMSE score to evaluate the model's performance.
- Google Cloud Platform (GCP) account
- Google Cloud Storage (GCS) bucket
- Google BigQuery
- Google Cloud SDK
- PySpark cluster created on GCP
-
Clone the Repository
git clone https://github.com/zygmuntz/goodbooks-10k.git -
Upload the CSV file to GCS
Upload the ratings.csv file to a GCS bucket.
-
Configure Google Cloud SDK
Install google cloud SDK and Authenticate your GCP account:
gcloud auth login gcloud config set project your-gcp-project-id -
Run
csv_to_bigquery.ipynbOpen the notebook on pyspark cluster and follow the instructions to load the CSV file from GCS and store the data in a BigQuery table.
-
Run
als_recommendation.ipynbOpen the notebook on pyspark cluster and follow the instructions to initiate a Spark session, load data from BigQuery, train the ALS model, and evaluate its performance.