A simple Music Recommender System developed using Angular, Node.js and MySQL and Recommendations logics are explored, using different filter techniques
- Node.js v14.15.3 (Download)
- NPM v6.14.9
- MySQL v5.7+
- Angular CLI v11.0.5 (Angular CLI Installation)
- @ng-bootstrap (Latest)
- Bootstrap (Latest)
- JQuery (Latest)
- Ngx-Spinner (Latest)
- Knex (Latest) (Knex Package)
- MySQL (Latest) (MySQL Package)
- Natural (Latest) (Natural Package)
- Stopword (Latest) (Stopword Package)
- Striptags (Latest) (Striptags Package)
- Vector-Object (Latest) (Vector-Object Package)
- Name: users
- Purpose: To store user details and filter results of users
- Name: songs
- Purpose: To store song details and similar content of songs
- Name: liked
- Purpose: To store liked songs of users
Download and run the provided SQL files to fill the tables in the selected database. Update database connection details in backend/config.js
.
Example:
DB_NAME: "music_recommender",
DB_HOST: "project.cqvbqklh6tez.ap-south-1.rds.amazonaws.com",
DB_USER: "admin",
DB_PASSWORD: "admin123"
- Navigate to the backend project folder and execute the following command to install dependencies:
npm install
- Start the Node.js server using the following command:
npm start
-
Once you see "Listening on port 3001," the application is running on port 3001.
-
To stop the server, press
Ctrl + C
.
-
Install Angular CLI from Angular CLI Installation.
-
Navigate to the frontend project folder and execute the following command to install dependencies:
npm install
- Start the Angular Application using the command:
ng serve
- Once you see "Compiles successfully," the application is running on port 4200.
Contains reusable code snippets, including functions for data training and response formatting.
Main functions where the request and response cycle (ExpressJS) ends.
Holds Knex queries, a query helper wrapped around MySQL.
Contains all the routes of the Express.js server.
Imports every single component to make it available as an API. Also contains server management.
train()
: Calls various functions for content-based recommendation.validateDocuments()
: Validates and preprocesses input documents.preprocessDocuments()
: Completes document preprocessing, including tokenization.produceWordVectors()
: Generates word vectors using tf-idf algorithm.calculateSimilarities()
: Calculates document similarities for recommendations.
Uncomment line 11 in backend/controllers/contentRecommender.js
to run the content-based trainer function.
trainDataForAllUsers()
: Trains collaborative recommendation data for all users.fetchUserList()
,fetchSongList()
,fetchLikeList()
: Fetches necessary data.createCoMatrix()
: Creates co-occurrence matrix.getRecommendations()
: Calculates recommendations using co-occurrence matrix.
Uncomment line 12 in backend/controllers/contentRecommender.js
to run the collaborative trainer function.
To run the collaborative filter for the current user, uncomment line 101 in backend/controllers/contentRecommender.js
.