Git Product home page Git Product logo

saadbs7 / artistsrecommendersystem Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 127 KB

This repository contains a FastAPI-based User Artist Recommendation System. The system provides functionalities to manage users' artists, add new artists to their lists, and generate artist recommendations based on different criteria. The recommendation types include random artists, unknown artists, and artists similar to the user's history.

Dockerfile 1.38% Jupyter Notebook 79.26% Python 19.35%

artistsrecommendersystem's Introduction

Description:

This repository contains a FastAPI-based User Artist Recommendation System. The system provides functionalities to manage users' artists, add new artists to their lists, and generate artist recommendations based on different criteria. The recommendation types include random artists, unknown artists to the user, and artists similar to the ones they have already listened to.

Features:

Retrieve a list of a user's artists from the database.

Add artists to a user's list of artists.

Generate artist recommendations based on:

    a. Random artists.
    b. Artists unknown to the user.
    c. Artists similar to the ones they already listened to.

Files Description:

  • main.py: It contains the main code for the API

  • Similar_Artists_Kmeans_Model.ipynb: It contains the Kmeans Clustering AI model implementation for suggesting similar artists to the user

  • Clean_Dataset.npy: Cleaned ready to train Numpy array of Dataset

  • GenresKmeans.pickle: Kmeans trained model in pickle format

  • lastfm-matrix-germany.csv: The data is sourced from this file

Functions of API:

The API is doing the following things:

  1. Gets a List of Artists of a user:
    It takes the user_id and returns a list of artists that the user_id user has listened to.
  1. Updates the dataset when the user listens to an artist:
    It takes a valid user_id and a valid artist_name and then it updates the dataset by setting the artist field for that user as 1.
  1. Gives recommendations to the user based on:
      a. Random Artists:
        Randomly suggests 5 artists from a list of all artists.
      b. Unknown Artists:
        Randomly suggest 5 artists that are unknown to the user.
      c. Suggests Similar Artists:
        It does the following steps:
          - Checks if the user is in the database
          - Takes out the whole artists array of the selected user
          - Predicts cluster of the selected user using the array as an instance using Kmeans trained model
          - Uses the predicted cluster for finding other same predicted clusters of other users
          - Collects indexes of users of the same cluster
          - Gets the listened artists' names of all users of the cluster
          - Adds artists' names of same cluster users in a set
          - Appends similar artists in unknown_artists list that are not in user's lists
          - Suggest 5 artists from that unknown_artists list

Additional Information:

The system utilizes KMeans Clustering to classify users into clusters based on their music preferences. Users belonging to the same cluster are assumed to have very similar tastes in music and artists.

Prior to applying KMeans Clustering, Principal Component Analysis (PCA) decomposition was performed on the dataset. PCA helps in dimensionality reduction, enabling a better selection of the number of clusters for the KMeans algorithm.

The number of clusters for the KMeans Clustering model was selected using the Elbow Method, a technique that plots the explained variation as a function of the number of clusters, helping to identify the optimal number of clusters for the dataset. This method aids in finding a balance between model complexity and the accuracy of cluster assignments.

The system is containerized using Docker, and the Docker image can be pulled from the provided Docker repository for easy deployment and usage.

Pull from Docker Repository:

To pull the Docker image "user-artist-system" from my repository, you can use the following command:

docker pull saadbs/alpha-repo7:user-artist-system

Compose image

If you want to create your own Docker image, you can use Docker Compose.

Open the docker-compose.yml file and change the image field under the app service to your desired image name.

Build and Run the Docker Compose:

docker-compose up --build

artistsrecommendersystem's People

Contributors

saadbs7 avatar

Watchers

 avatar

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.