Giter Site home page Giter Site logo

vaibhav67979 / ecommerce-product-recommendation-system Goto Github PK

View Code? Open in Web Editor NEW
38.0 4.0 13.0 152 KB

Product Recommendation System is a machine learning-based project that provides personalized product recommendations to users based on their interaction history, similar users, and also the popularity of products.

Home Page: http://vaibhav67979.tech/Ecommerce-product-recommendation-system/

License: MIT License

Jupyter Notebook 100.00%
artificial-intelligence machine-learning python e-commerce product product-recommendation svd e-commerce-product-recommendation-system

ecommerce-product-recommendation-system's Introduction

Ecommerce-product-recommendation-system

Product Recommendation System is a machine learning-based project that provides personalized product recommendations to users based on their browsing and purchase history. The system utilizes collaborative filtering and content-based filtering algorithms to analyze user behavior and generate relevant recommendations. This project aims to improve the overall shopping experience for users, increase sales for e-commerce businesses

Dataset

I have used an amazon dataset on user ratings for electronic products, this dataset doesn't have any headers. To avoid biases, each product and user is assigned a unique identifier instead of using their name or any other potentially biased information.

Approach

1) Rank Based Product Recommendation

Objective -

  • Recommend products with highest number of ratings.
  • Target new customers with most popular products.
  • Solve the Cold Start Problem

Outputs -

  • Recommend top 5 products with 50/100 minimum ratings/interactions.

Approach -

  • Calculate average rating for each product.
  • Calculate total number of ratings for each product.
  • Create a DataFrame using these values and sort it by average.
  • Write a function to get 'n' top products with specified minimum number of interactions.

2) Similarity based Collaborative filtering

Objective -

  • Provide personalized and relevant recommendations to users.

Outputs -

  • Recommend top 5 products based on interactions of similar users.

Approach -

  • Here, user_id is of object, for our convenience we convert it to value of 0 to 1539(integer type).
  • We write a function to find similar users -
    1. Find the similarity score of the desired user with each user in the interaction matrix using cosine_similarity and append to an empty list and sort it.
    2. extract the similar user and similarity scores from the sorted list
    3. remove original user and its similarity score and return the rest.
  • We write a function to recommend users -
    1. Call the previous similar users function to get the similar users for the desired user_id.
    2. Find prod_ids with which the original user has interacted -> observed_interactions
    3. For each similar user Find 'n' products with which the similar user has interacted with but not the actual user.
    4. return the specified number of products.

3) Model based Collaborative filtering

Objective -

  • Provide personalized recommendations to users based on their past behavior and preferences, while also addressing the challenges of sparsity and scalability that can arise in other collaborative filtering techniques.

Outputs -

  • Recommend top 5 products for a particular user.

Approach -

  • Taking the matrix of product ratings and converting it to a CSR(compressed sparse row) matrix. This is done to save memory and computational time, since only the non-zero values need to be stored.
  • Performing singular value decomposition (SVD) on the sparse or csr matrix. SVD is a matrix decomposition technique that can be used to reduce the dimensionality of a matrix. In this case, the SVD is used to reduce the dimensionality of the matrix of product ratings to 50 latent features.
  • Calculating the predicted ratings for all users using SVD. The predicted ratings are calculated by multiplying the U matrix, the sigma matrix, and the Vt matrix.
  • Storing the predicted ratings in a DataFrame. The DataFrame has the same columns as the original matrix of product ratings. The rows of the DataFrame correspond to the users. The values in the DataFrame are the predicted ratings for each user.
  • A funtion is written to recommend products based on the rating predictions made :
    1. It gets the user's ratings from the interactions_matrix.
    2. It gets the user's predicted ratings from the preds_matrix.
    3. It creates a DataFrame with the user's actual and predicted ratings.
    4. It adds a column to the DataFrame with the product names.
    5. It filters the DataFrame to only include products that the user has not rated.
    6. It sorts the DataFrame by the predicted ratings in descending order.
    7. It prints the top num_recommendations products.
  • Evaluating the model :
    1. Calculate the average rating for all the movies by dividing the sum of all the ratings by the number of ratings. 2, Calculate the average rating for all the predicted ratings by dividing the sum of all the predicted ratings by the number of ratings.
    2. Create a DataFrame called rmse_df that contains the average actual ratings and the average predicted ratings.
    3. Calculate the RMSE of the SVD model by taking the square root of the mean of the squared errors between the average actual ratings and the average predicted ratings.

The squared parameter in the mean_squared_error function determines whether to return the mean squared error (MSE) or the root mean squared error (RMSE). When squared is set to False, the function returns the RMSE, which is the square root of the MSE. In this case, you are calculating the RMSE, so you have set squared to False. This means that the errors are first squared, then averaged, and finally square-rooted to obtain the RMSE.

⚠️ This project is solely for learning how recommedation systems work. ⚠️

ecommerce-product-recommendation-system's People

Contributors

vaibhav67979 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ecommerce-product-recommendation-system's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.