You are on page 1of 34

MUSIC RECOMMENDATION USING MACHINE LEARNING

MINOR PROJECT REPORT


Submitted by
A.RUTHRA RAMAN
(20BCA039)
Under the Guidance of
Dr.R.SUDHA, MCA., M.Phil., PhD.,
Associate Professor &HOD
Department of Computer Applications
In partial fulfillment of the requirements for the award of the degree of
BACHELOR OF COMPUTER APPLICATIONS
of Bharathiar University

DEPARTMENT OF COMPUTER APPLICATIONS

PSG COLLEGE OF ARTS & SCIENCE

An Autonomous college -Affiliated to Bharathiar University

Accredited with ‘A++’ grade by NAAC (4thcycle)

College with Potential for Excellence

(Status Awarded by the UGC)

Star College Status Awarded by DBT - MST


An ISO 9001:2015 Certified Institution

Coimbatore -641014

NOVEMBER-2022

i
DEPARTMENT OF COMPUTER APPLICATIONS

PSG COLLEGE OF ARTS & SCIENCE

An Autonomous college - Affiliated to Bharathiar University


Accredited with 'A++' Grade by NAAC (4th cycle)
College with potential for excellence
(Status Awarded by the UGC)
Star College Status Awarded by DBT- MST
An ISO 9001:2015 certified Institution
Coimbatore- 641014

CERTIFICATE

This is to certify that this project work entitled “MUSIC RECOMMENATION


USING MACHINE LEARNING” is a Bonafide record of work done by A. RUTHRA
RAMAN (20BCA039) in partial Fulfillment of the requirement for the award of Degree of
Bachelor of Science in Computer Science of Bharathiar University.

Faculty Guide Head of the Department

Submitted for Viva - voce Examination held on

Internal Examiner External Examiner

DECLARATION
ii
I A. RUTHRA RAMAN (20BCA039), hereby declare that this minor project work
entitled " MUSIC RECOMMENDATION USING MACHINE LEARNING ", is
submitted to PSG College of Arts & Science (Autonomous), Coimbatore in partial
Fulfillment for the award of BACHELOR OF COMPUTER APPLICATIONS, is a record
of original work done by me under the supervision and guidance of Dr. R. SUDHA, MCA.,
M.Phil., Ph.D. Associate Professor & HOD in Department of computer Applications PSG
College of arts & science, Coimbatore.

This project work has not yet been submitted by me for the award of any other Degree /
Diploma / Associative ship / Fellowship or any other similar degree to any other University.

PLACE: COIMBATORE A. RUTHRA RAMAN


DATE : (20BCA039)

ACKNOWLEDGEMENT

iii
With great gratitude I would like to acknowledge the help of those who contributed
their valuable suggestions and timely assistance to complete this work.

First and foremost, I would like to extend my heartfelt gratitude and place my sincere
thanks to THIRU. L. GOPALAKRISHNAN managing Trustee, PSG & SONS Charities,
Coimbatore for providing all sorts of support and necessary facilities throughout the course.

I express my deep sense of gratitude to Secretary, Dr. T. KANNAIAN M.Sc.,


MTech., Ph.D., for permitting me to undertake this work.

I thank our Principal, Dr. D. BRINDHA M.Sc., MPhil., Ph.D., M.A(Yoga)., for her
support and constant source of inspiration through the course of project.

Also, I would like to thank our Vice Principal, Dr. A. ANGURAJ M.Sc., M.Phil.,
PhD., for his support.

I own my deepest gratitude to Dr. R. SUDHA MCA., M.Phil., Ph.D., Head of the
Department of Computer Applications, PSG College of Arts & Science, Coimbatore, for her
consultancy, encouraging me to pursue new goals and ideas.

My sincere thanks to Dr. R. SUDHA, MCA., M.Phil., Ph.D., Associate professor &
Head of the Department of Computer Applications, PSG College of Arts & Science,
Coimbatore for her valuable suggestions, support and guidance as my internal guide, without
which my work would not have reached the present form.

Last but not the least, I am greatly indebted to my parents and friends for their kind co-
operation in each and every step I took in this project.

iv
ABSTRACT

The project titled "MUSIC RECOMMENDATION USING MACHINE


LEARNING " is used to build a recommendation engine of songs from the million dataset
depending on the user’s song history and list recommended songs by popularity.
Recommendations engines seeks to predict or filter preferences according to the user’s
choices, which comes under information filtering system. Music recommendation systems
can significantly improve the listening and searching experience of a music library or music
application.

v
TABLE OF CONTENTS

S.NO CONTENTS PAGE.NO


1 INTRODUCTION
1.1 OVERVIEW OF THE PROJECT
2 SYSTEM SPECFICATION
2.1 HARDWARE SPECFIACTION
2.2 SOFTWARE SPECFICATION
2.3 SOFTWARE DESCRIPTION
3 SYSYTEM ANALYSIS
3.1 EXISTING SYSTEM
3.2 PROPOSED SYSTEM
4 SYSTEM DESIGN
4.1 MODULE DESCRIPTION
4.2 DATA FLOW DIAGRAM
4.3 ER DIAGRAM
4.4 TABLE DESIGN
4.4 INPUT DESIGN
4.6 OUTPUT DEIGN
5 SYSTEM TESTING AND IMPLEMETATION
5.1 SYSTEM TESTING
5.2 SYSTEM IMPLEMENTATION
6 CONCLUSION

7 SCOPE FOR FUTURE ENHANCEMENT

8 BIBLIOGRAPHY

9 APPENDICES
A. SCREENSHOTS
B. SAMPLE CODING

vi
1. INTRODUCTION

1.1 OVERVIEW OF THE PROJECT

The intention of Music recommendation is to provide the users a personalized playlist


of their interested songs, their interested artists, and the playlist according to the popularity of
the song. The music recommendation using machine learning will be easier to the users to use
it, this project will reduce the work of creating playlist by users on their own, because this
project on its own it will create a personalized content of playlist according to the user’s
previous behavior of interests in the songs, artists, popularity. This Recommendation engine
works on the basis of the sample datasets obtained from the outside called million song
dataset which contains million set of song datasets, and thus it will work or create the playlist
according to the content based, collaborative based, and popularity based systems. The
modern music apps works according to this recommendation system, as it reduces the works
and time usage of the users in creating the playlists which contains their favorite songs,
favorite artists,and popularity based songs.

1
2. SYSTEM SPECIFICATION

2.1 HARDWARE SPECIFICATION

PROCESSOR : AMD Ryzen 5 5500U with Radeon Graphics 2.0 GHz


RAM : .800 GB
SYSTEM TYPE : 64 BITS
HARDWARE DRIVE : 512 GB

2.2 SOFTWARE SPECIFICATION

OPERATING SYSTEM : WINDOWS 11


BACK END : PYTHON
SOFTWARES : JUPYTER NOTEBOOK, ANACONDA.NAVIGATOR

2
2.3 SOFTWARE DESCRIPTION

OVERVIEW OF BACK-END

PYTHON
Python is a high level, interpreted, interactive, and object-oriented scripting
language. Python is designed to be highly readable. It uses English keywords frequently
where as other languages use punctuation, and it has fewer syntactical constructors than other
languages. Python is a great language for the beginner level programmers and supports the
development of a wide range of applications from simple text processing to WWW browsers
to games.

SOFTWARES

 JUPYTER NOTEBOOK
The Jupyter notebook is a community standard for communicating and performing
interactive computing. They are a document that blends computations, outputs, explanatory
text, mathematics, images, and rich media representations of objects. The platform has been
specifically designed for data science tasks, and supports over 40 programming languages.

 ANACONDA.NAVIGATOR
Anaconda.Navigator is a desktop graphical user interface (GUI) included in
Anaconda distribution that allows you to launch applications and manage conda
packages, environments, and channels without using command line interface (CLI)
commands.

3
3. SYSTEM ANALYSIS

3.1 EXISTING SYSTEM

The Existing system is a old method which requires the manual action to create a
playlist, where the users create a playlist according to their interests in songs, interests in
artists. This takes time and increases the work towards creating a playlist according to their
interests or their need of personalized playlists.

DRAWBACKS OF THE EXISTING SYSTEM.

 Needed manual action to create a playlist.

 Takes time to create a personalized playlist.

 There will be no automatized creation of playlist according to the users interest.

 They don’t have a user-friendly user interface (UI).

 The servers are not well maintained.

4
3.2 PROPOSED SYSTEM

The proposed system is user friendly interface, which does not require much time or work
towards creating a playlist, rather automatically it will create a playlist according to the user’s
previous history towards songs, artists, listening count, and playlist according to the
popularity of the songs. These types of recommendation engines are the much needed one for
the modern type of applications, which does not require any much of manual actions rather it
works on the basis of automation with the help of the software requirements.

ADVANTAGES OF PROPOSED SYSTEM

 It is user friendly and anyone can enjoy listening music according to their interests
in songs, artists.

 This project offers user to create a playlist without their action needed, which
creates playlist automatically.

 This is will be very helpful for the client or users to operate.

 This project mainly focuses on giving the user a personalized playlist or contents
of their combined favorites.

 This does not require much time to create a playlist.

 It will work efficiently than its existing system.

5
4. SYSTEM DESIGN

4.1 MODULE DESCRIPTION

RECOMMENDATION MODULE

This Recommendation module generates recommendation based on the user profile. It


analyses the previous listening history and preferences of a user and provides a list of songs
that user might prefer to listen. We have used a global popularity model, content based
model, and collaborative filtering model.

4.1.1 RECOMMENDATION APPLICATION

 POPULARITY MODEL

It is a basic model which sorts the songs in the training set according to popularity in
descending order and recommends most popular songs. This method doesn’t take users
preferences into account.

 CONTENT BASED MODEL

Content-based filtering methods are based on a description of the item and a profile of
the user’s preferences. To create a content based recommendation, the system mainly focuses
on two types information: model of the user’s preferences and history of the user’s
interactions with the recommender system.

 COLLABORATIVE FILTERING

Collaborative filtering is based on the user’s assumption, as they will like the similar kinds
of items as they liked in the past. The system generates recommendations using only
information about rating profiles for different users or items.

6
4.2 DATA FLOW DIAGRAM
Data Flow Diagram (DFD) is a graphical representation of data flow in any
system. DFD is can also be used for the visualization of data processing of data (structure
design). On a DFD data items flow from an external data link, via an internal process.
The purpose of DFD is

 To show the scope and boundaries of the system.

 To show that the whole system has been considered.

 He May be used as a communication tool between a systems analysis


and person who plays a part in the system.

 To act as the starting point for redesigning a system.

The representations used to frame a data flow diagram are:

The circle represents the process. Its shows the pair of the part of the

Process that transforms input to output.

The arrow represents the graphical Data flow in or out of process.

It represents external Entities with the system communication.

7
DATA FLOW DIAGRAM
LEVEL 0

MILLION SONG
USER SONGS
DATASET

LEVEL 1

USER LISTENS SONGS

POPULARITY BASED
RECOMMENDATION

CONTENT BASED
RECOMMENDATION

COLLABRATIVE
FILTERING BASED
RECOMMENDATION

8
4.3 ENTITY RELATIONSHIP MODEL

An entity relationship diagram is a graphical depiction of organizational system


elements and the association among the elements. E-R diagram can help define system
boundaries. The entity relationship diagram also called, ERD or E-RD is a network model
that describes the stored data layout of the system at the high level of the abstraction. The
ERD is an effective modeling tool for the communicating with DBA diagram. Entity
relationship diagram depict data in its real state-data stores. An Entity is anything real of
abstract about which user want to store data. Most entities correspond to person, objects,
events and location. It is represented by relationship symbol, which is a decision box. The
components of the ERD are objects type, the relationship, associative object type, super
type/sub type indicators.

ATTRIBUTE

RELATIONSHP

ENTITY

Relationships:

 1-1 One to one relationship

 1-M One to many relationships.

 M-M Too many relationships.

9
ER DIAGRAM

USER LISTENS S SONGS MILLION SONG DATASET

RECOMMENDATION
SYSTEM

CONTENT BASED COLLABORATIVE


BASED

POPULARITY
BASED

BASED ON THE POPULARITY, OR


CURRENT TRENDING SONGS.

BASED ON THE USER’S


BASED ON THE PREVIOUS
FAVORITE SONGS OR LIKED
LISTENED SONGS.
SONGS

10
4.5 TABLE DESIGN
Table design in the process of producing a detailed data model of the database. This
logical data model contains all the needed logical and physical design choices and physical
storage parameters needed to generate a design in a model containing detailed attribute for
each. The term database design can be used to describe many different parts of the design of
overall database system. Principally, and most correctly, it can think of as the logical design
of the database structure used to store the data. In the relation model these are table and
views. In an object database entities and relationship map directly to object classes and
named relationship.
USER ID SONG ID LISTEN COUNT

1.b80344d063b5ccb3212f76538f3d9e43d87dca9e SOAKIMP12A8C130995 1

2.b80344d063b5ccb3212f76538f3d9e43d87dca9e SOBBMDR12A8C13253B 2

3.b80344d063b5ccb3212f76538f3d9e43d87dca9e SOBXHDL12A81C204C0 1

4.b80344d063b5ccb3212f76538f3d9e43d87dca9e SOBYHAJ12A6701BF1D 1

TABLE NAME: TRIPLETS_FILE

11
TABLE NAME: SONG_DATA

SONG ID TITLE RELEASE ARTIST NAME YEAR


SOQMMHC12AB0180CB8 SILENT NIGHT MONSTER FASTER PUSSY CAT 2003
BALLADS
SOVFVAK12A8C1350D9 TANSI VAAN KARKUTEILLA KARKKIAUTOMATTI 1995

SOGTUKN12AB017F4F1 NO ONE COULD BUTTER HUDSON 2006


EVER MOHAWKEY

TABLE NAME: MERGED_DATA

User_ Id Song_ Id Listen Title Release Artist year


count name

0 b80344d063b5ccb3212f76538f3d9e43d87d- SOAKIMP12A8C130995 1 The Cove Thicker Than Wa- Jack John- 0


ca9e ter son

1 b80344d063b5ccb3212f76538f3d9e43d87d- SOBBMDR12A8C13253B 2 Entre Dos Flamenco Para Paco De 1976


ca9e Aguas Niños Lucia

2 b80344d063b5ccb3212f76538f3d9e43d87d- SOBXHDL12A81C204C0 1 Stronger Graduation Kanye 2007


ca9e West

3 b80344d063b5ccb3212f76538f3d9e43d87d- SOBYHAJ12A6701BF1D 1 Constellations In Between Jack John- 2005


ca9e Dreams son

4 b80344d063b5ccb3212f76538f3d9e43d87d- SODACBL12A8C13C273 1 Learn To Fly There Is Nothing Foo Fight- 1999


ca9e Left To Lose ers

12
4.6 INPUT DESIGN
The input design in the process of entering data to the system. The input design goal is
to enter the computer as accurately as possible. Here inputs are design effectively so that
errors made by the operators are minimized. The input to the system has been designed in
such way that manual forms and the inputs are coordinate where the data elements are
common to source documents and to the input. The input is acceptable and understandable by
the users who are using the quality of the system input to determine the quality of the system
input to determine the quality for system output. Input specification describes the manner in
which data entered the system processing.

Fig. DATASETS IMPLEMENTING PAGE.

13
4.7 OUTPUT DESIGN
The output design was done so that the result of processing could be communicating to
the users. The various outputs have been in such a way that they represent the same format
that the office and management. Computers output is the most important and direct source of
information to the user. Efficient intelligence output design should improve the system
relationship with the user and help in decision making. A major form of output is hardcopy
form the printer output requirements are designed during system analysis. A good starting
point for the output design is the data flow diagram (DFD). Human factors issues for design
involve addressing internal controls to ensure readability.

Fig. SONGS RECOMMENDED ACCORDING TO POPULARITY

14
5. SYSTEM TESTING AND IMPLEMENTATION

5.1 SYSTEM TESTING:


It is the final test to verify that the product to be delivered meets the specifications
mentioned in the requirement document. It is the stage of implementation, which ensures that
system works accurately and effectively before the live operation Commences. It is a
confirmation that all are correct and gives opportunity to show the users that the system must
be tested with test data and show that the system will operate successfully and produces
expected results under expected conditions. The purpose of system testing to identify and
correct errors in the candidate system. As important as this phase is, one is frequently
compromised. Testing is vital to the parts of the system.so that the goal will be successfully
achieved. Inadequate testing or non-testing leads to errors that may not appear until months
later.

This creates many problems:

• The time lag between the cause and appearance of the problem.
• The effect of system errors on files and records within the system.
• It may lead to software failure.
• Privacy protection may fall when the databases don’t undergo continually
checking for breaches.

• It can cause huge crashes in the system that cause a lot of money to repair.

15
UNIT TESTING

In Unit testing, we have to test the programs making up the system. The software
units in a system are called modules and routines that are assembled and integrated to
perform a specific function. Unit testing focuses first on the modules, independently of one
another, to locate errors. This enables to detect errors in coding and logic that are contained
within the module. In the lines of this strategy all the individual functions and modules were
put to the test independently. This method was applied in combination with white and black
box testing techniques to find the errors in each module.

Test No Test Condition System Behavior Expected Result

1 Recommenders Recommend songs Recommend songs


according to the user according to the user
interests. interests.

16
INTEGRATED TESTING

Again, this software testing strategy has two different approaches namely the top-
down approach in which the integration is carried out from the top-level module to the
bottom and the bottom-up approach in which the integration is carried out from the low-level
modules to the top. The module was tested using the bottom-up approach by introducing
stubs for the top-level functions. This test was used to identify the errors in the interfaces, the
errors in passing the parameters between the functions and to correct them.

Test no Test condition System behavior Expected result

1 Popularity Based Recommend the Recommended the


songs according to songs according to
Recommendation
the popularity. the popularity.

2 Content Based Recommend the Recommended the

Recommendation songs according to songs according to


the user’s favorite the user’s favorite
songs. songs.

3 Collaborative Based Recommend the Recommended the


Recommendation songs according to songs according to
the user’s previous the user’s previous
behavior towards behavior towards
songs. songs.

17
5.2 SYSTEM IMPLEMENTATION

System implementation is the important stage of product where the theoretical design
is turned into the practical system. And, it is also a set of procedures performed to complete
the design (as necessary) contained in the approved systems design document and to test,
install, and begin to use the new or revised Information System. It depicts systems
implementation as the fifth major step in the development of an Information System.

The systems implementation goals are as follows:

 Complete as necessary the design contained in the approved systems design docu-
ment. For example, the detailed contents of new or revised documents, computer
screens, and database must be laid out and created.

 Write, test, and document the programs and procedures required by the approved sys-
tems design document.

 Ensure, by completing the preparation of user manuals and other documentation and
by training personnel, that the organization’s personnel can operate the new system.

 Determine, by thoroughly testing the system with users, that the system satisfies the
users requirements.

 Ensure a correct conversion by planning, controlling, and conducting an orderly in-


stallation of the new system.

18
6. CONCLUSION

Music Recommendation using machine learning is an efficient project, which simplifies the
work of creating playlist according to the user’s wish. This model can capture the specific
interests of the user and can recommend personalized content of playlist which the user needs
to hear. These playlists will be updated automatically according to the user’s behavior. It
works with the recommendation system of collaborative, content and popularity based
systems. This project works with real data sets. This is a recommendation engine project in
NLP (Natural Language Processing).

19
7. SCOPE FOR FUTURE ENHANCEMENT

This model can be reused differently depending on the data set and parameters, and
thus we can include some of other type of recommendation systems like hybrid
recommendation system, personalized and Non-personalized recommendation system. Larger
dataset can take a lot of time to process, for quicker results you can shorten the sample size of
the dataset.

20
8. BIBILOGRAPHY

REFERENCES

www.hackersrealm.net

https://github.com/aswintechguy

http://bit.ly/mlprojectsplaylist

http://bit.ly/nlpconcepts

21
9. APPENDICES

A. SCREENSHOT

Importing modules

22
Loading the datasets

Combining the datasets

23
Data preprocessing

24
Listen count

Popularity Recommendation Engine

Item similarity

25
Similar items

26
B. SAMPLE CODE

import pandas as pd
import numpy as np
import Recommenders as Recommenders

song_df_1 = pd.read_csv('triplets_file.csv') song_df_1.head()

song_df_2 = pd.read_csv('song_data.csv') song_df_2.head()

song_df = pd.merge(song_df_1, song_df_2.drop_duplicates(['song_id']),


on='song_id', how='left') song_df.head()

print(len(song_df_1), len(song_df_2))

len(song_df)

song_df['song'] = song_df['title']+' - '+song_df['artist_name']


song_df.head()

song_df = song_df.head(10000)

27
song_grouped = song_df.groupby(['song']).agg({'listen_count':'count'}).reset_index()
song_grouped.head()

grouped_sum = song_grouped['listen_count'].sum() song_grouped['percentage'] =


(song_grouped['listen_count'] / grouped_sum ) * 100
song_grouped.sort_values(['listen_count', 'song'], ascending=[0,1])

pr = Recommenders.popularity_recommender_py()

pr.create(song_df, 'user_id', 'song')

pr.recommend(song_df['user_id'][5])

pr.recommend(song_df['user_id'][100])

ir = Recommenders.item_similarity_recommender_py() ir.create(song_df, 'user_id', 'song')

user_items = ir.get_user_items(song_df['user_id'][5])

for user_item in user_items: print(user_item)

ir.recommend(song_df['user_id'][5])

ir.get_similar_items(['Oliver James - Fleet Foxes', 'The End - Pearl Jam'])

28

You might also like