You are on page 1of 93

MUSIC RECOMMENDATION SYSTEM WITH

PLAGIARISM DETECTION
A Project report submitted in partial fulfillment of the requirements for
the award of the degree of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE ENGINEERING

Submitted by
Sheema Patro - 317126510169

P.N.V.S. Siva Dhanush - 317126510157

G.Sai Mahesh - 317126510141

Under the guidance of


Mr.P.Krishnanjeneyulu M.tech, (Ph.D)
Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY AND SCIENCES
(UGC AUTONOMOUS)
(Permanently Affiliated to AU, Approved by AICTE and Accredited by NBA & NAAC with ‘A’ Grade)
Sangivalasa, bheemili mandal, visakhapatnam dist.(A.P)
2017-2021
ACKNOWLEDGEMENT
We would like to express our deep gratitude to our project guide,
Mr.P.Krishnanjeneyulu, Assistant Professor, Department of Computer Science and
Engineering, ANITS, for his/her guidance with unsurpassed knowledge and immense
encouragement. We are grateful to Dr.R.Sivaranjani, Head of the Department,
Computer Science and Engineering, for providing us with the required facilities for
the completion of the project work.
We are very much thankful to the Principal and Management, ANITS, Sangivalasa,
for their encouragement and cooperation to carry out this work.

We express our thanks to Project Coordinator Dr.V.Usha Bala, for her Continuous
support and encouragement. We thank all teaching faculty of Department of CSE,
whose suggestions during reviews helped us in accomplishment of our project. We
would like to thank S. Sajahan of the Department of CSE, ANITS for providing great
assistance in accomplishment of our project.

We would like to thank our parents, friends, and classmates for their encouragement
throughout our project period. At last but not the least, we thank everyone for
supporting us directly or indirectly in completing this project successfully.

PROJECT STUDENTS:

Sheema Patro - 317126510169

P.N.V.S. Siva Dhanush - 317126510157

G. Sai Mahesh - 317126510141


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
ANIL NEERUKONDA INSTITUTE OF TECHNOLOGY AND SCIENCES
(UGC AUTONOMOUS)
(Affiliated to AU, Approved by AICTE and Accredited by NBA & NAAC with ‘A’ Grade)
Sangivalasa, bheemili mandal, visakhapatnam dist.(A.P)

CERTIFICATE

This is to certify that the project report entitled “Music Recommendation System
With Plagisarism Detection”, submitted by Sheema Patro (317126510169),
P.N.V.S. Siva Dhanush (317126510157), G. Sai Mahesh (317126510141) in partial
fulfillment of the requirements for the award of the degree of Bachelor of
Technology in Computer Science Engineering of Anil Neerukonda Institute of
Technology and Sciences (A), Visakhapatnam is a record of bonafide work carried
out under my guidance and supervision.

Project Guide Head of the Department

Mr.P.Krishnanjeneyulu M.Tech,(Ph.D) Dr.SIVARANJANI


Assistant Professor Department of CSE
Department of CSE ANITS
ANITS
DECLARATION

We, SHEEMA PATRO, P.N.V.S. SIVA DHANUSH, G. SAI MAHESH,


of final semester B.Tech., in the department of Computer Science and Engineering
from ANITS, Visakhapatnam, hereby declare that the project work entitled Music
Recommendation System With Plagiarism Detection is carried out by us and
submitted in partial fulfillment of the requirements for the award of Bachelor of
Technology in Computer Science Engineering, under Anil Neerukonda Institute of
Technology & Sciences(A) during the academic year 2017-2021 and has not been
submitted to any other university for the award of any kind of degree.

Sheema Patro - 317126510169

P.N.V.S. Siva Dhanush - 317126510157

G. Sai Mahesh - 317126510141


ABSTRACT
In this paper, we present a personalized music recommendation system based
on the KNN and machine learning algorithms.In personalized music recommendation
system, we propose a collaborative filtering and content filtering recommendation
algorithm to combine the output of the network with the log files to recommend music
to the user. The proposed system contains the log files which stores the previous
history of playlist of music by the user. The proposed music recommendation system
extracts the user's history from the log file and recommends music under each
recommendation.Content-based methods gives recommendations based on the
similarity of two song contents or attributes while collaborative methods make a
prediction on possible preferences using a matrix with ratings on different songs. The
plagiarism system extracts the music from input and finds music that are close to the
query music which the query has plagiarized. We use the million song dataset to
evaluate the personalized music recommendation system. The data cleaning is done by
the data science algorithms. The plagiarism detection is done by finding the similar
music genre which minimizes the issue of copyrights.

Index Terms— collaborative filtering algorithm. KNN, cosine similarity,


tf-idf, CSR Matrix,SVM.
Table of Contents

ABSTRACT
LIST OF SYMBOLS
LIST OF FIGURES
LIST OF TABLES
LIST OF ABBREVIATIONS
1. INTRODUCTION 1
1.1. Music Plagiarism 2
1.2. Motivational Work 3
1.3. Problem Statement 3
2. LITERATURE SURVEY 4
2.1. Introduction 4
2.2. Existing Method 5
2.2.1. Collaboration filtering 5
2.2.2. Memory-Based Collaborative Filtering(Neighbourhood based) 5
2.2.3. Model-based CF 6
2.2.4. Hybrid Collaborative Filtering Techniques 6
2.2.5. Content Based Recommender System 6
2.2.6 Context Based Recommender System 7
2.2.7. A recommender System Based on Genetic Algorithm 8
2.2.8. A Personalized Music Recommendation System Using 9
Convolutional Neural Networks Approach
2.2.9. Affective Music Recommendation System Reflecting the Mood of Input
Image 9
3. METHODOLOGIES AND ARCHITECTURE 10
3.1. Machine Learning 10
3.2. Python 13
3.3. Jupyter Notebook 18
3.4. Google colab 19
3.5. Colloborative filtering 19
3.6. System Architecture 20
3.7. Content -based 21
4. UML DIAGRAMS 23
4.1. Use case Diagram 24
4.2. Sequence Diagram 26
4.3. Activity Diagram 27
5. MODULES DIVISION 29
5.1. Colloborative Filtering 29
5.2. Content Based and Plagiarism Detection 29
5.3. Mood Prediction 29
6. ALGORITHMS 30
6.1. Colloborative Filtering Algorithms 30
6.2. Plagiarism Algorithms 34
6.3. Mood Prediction Algorithms 36
7. INPUT AND OUTPUT 39

8. CODE IMPLEMENTATION 41
8.1. Colloborative Filtering 41
8.1.1. Graphs
8.2. Content and Plagiarism 50
8.3. Mood Prediction 52
9. FUNCTIONAL REQUIREMENTS 57
10. NON-FUNCTIONAL REQUIREMENTS 57
11. DATASET 58
12. CONCLUSION 59
13. FUTURE WORK 59
14. REFERENCES 60
LIST OF SYMBOLS

Symbol Use

Σ To denote a sum of multiple terms

Θ Is used as a variable to represent an angle

cos(θ) Is the ratio of the adjacent side to the hypotenuse

||A|| Distance between A and B

LIST OF FIGURES

Fig.No. Topic Name Page No.

1 Steps of music recommendation system 21

2 Use Case Diagram for Colloborative Filtering 25

3 Use Case Diagram for Content Based 25

4 Sequence Diagram for Colloborative Filtering 26

5 Sequence Diagram for Content Based 27

6 Activity Diagram for Colloborative Filtering 28

7 Activity Diagram for Content Based 28

8 Most Popular Songs 47

9 Most Popular Artist 47

10 Listen Count by User 48

11 Output for Colloborative Filtering 49

12 Output for Content based 51

13 Output for Mood prediction 1 55

14 Output for Mood prediction 2 56


LIST OF TABLES

Table No. Topic Name Page No.


1 Use case Diagram Table 24

2 CSR Matrix Table 34

3 Colloborative Dataset Contents 39

4 Content based Dataset Contents 40

LIST OF ABBREVATIONS

CSR Compressed Sparse Row


KNN K-Nearest Neighborhood
SVM Support Vector Machine
1. INTRODUCTION

With the explosion of network in the past decades, internet has become the
major source of retrieving multimedia information such as video, books, and music etc.
People have considered that music is an important aspect of their lives and they listen
to music, an activity they engaged in frequently. However, the problem now is to
organize and manage the millions of music titles produced by society. A good music
recommender system should be able to automatically detect preferences and generate
playlists accordingly. The proposed system is to detect music plagiarism based on
music similarity. The plagiarism system extracts the music from input and finds music
that are close to the query music which the query has plagiarized. Meanwhile, the
development of recommender systems provides a great opportunity for industry to
aggregate the users who are interested in music. We need to generate the best music
recommendation system which is need to predict based on customization, by using
KNN, Machine Learning.

Everyones taste in music is unique which means that no matter what music
you make, someone is bound to enjoy listening to it. While the Music industry may
favor certain types of music more than others, it is important to understand that there
isnt a single human culture on earth that has existed without music. Music is of great
benefit to us, regardless of whether we are renowned recording artists, karaoke singers
or merely fans of music. The number of songs available exceeds the listening capacity
of single individual.

According to the MarsBands.com there are at least 97 million songs. These


are only the songs officially released. If we included songs everyone knows or the
incredibly old Celtic songs with no names, we would reach 200 million songs since
the website most likely does not include Happy Birthday or a nameless song from
1400 AC. This is when we take only the artists who had their name officially on Music
charts. Starting there, let's say that there are currently around 1 million songwriters
alive that we know about. If we use the same percentage as above, we can guess that
there have been about 15.3 million songwriters ever.

1
To get an idea, there are 4 million songs on Spotify that have never been
played. In total, there must be billions just there and Spotify itself is by no means the
limit of music. What about all the CDs and records made over the past century which
have not been digitized? What, indeed, about song passed down the generations in
small African communities? There are trillions and trillions of songs in the world, so
many that an estimate is impossible, and the potential more an infinitely greater
number which have not yet been made, a world of music for us to enjoy.

Currently, based on users’ listening behaviour and historical ratings,


collaborative filtering algorithm has been found to perform well. Since 2005, an annual
evaluation event called Music Information Retrieval Evaluation exchange (MIREX) is
held to facilitate the development of MIR algorithms.In content-based method
similarity between the songs are checked and songs are recommended based on the
similarity score.The content -based method can also be considered for plagiarism
detection, plagiarism can be detected based on the similarity score.

By using mood prediction we can easily recommend songs to the user


according to their interest and mood.The mood can be predicted in many ways such as
by using lyrics,face emotion detection etc.Here we used lyrics based mood prediction
and it also calculates the similarity score and recommends the songs.

The music recommender systems are double edged swords. The are of
valuable use both to the user as well as the provider. They keep the user engaged by
finding interesting music in the form of recommendations, lessening the burden on the
user by reducing the set of choices to choose from. They give the scope for exploration
and discovery of music that the user may not know exists. Because it is a music
recommender there is never less entertainment.

1.1. Music Plagiarism


The second component of recommender systems is music plagiarism. Music
often characterized by its melody, harmony, rhythm and timbre.Music plagiarism can
be suspected under the following cases: when two music have similar successive music
notes, when two music shares the unique parts of music which is rarely uses in others,
when music has similar music progress with different key and instruments, plagiarism
can be suspected. This system is composed of four modules:(1)Music Extraction

2
Module: music of the query music is extracted,(2)Similarity Calculation Modules: the
similarity between the sequence of the input polyphonic music and those of music in
the database is calculated,(3) The similar section of the music in the database is
detected.This can be done by using content-based filtering,The model only learns to
recommend items of the same type that the user is already using or, in our case,
listening to. Even though this could be helpful, the value of that recommendation is
significantly less because it lacks the surprise component of discovering something
completely new.

1.2. Motivation for work

Different recommendations primarily need to work for the satisfication the


users.Identifying user grievances thereby resolving them leads to customer
satisfaction as well as trustworthiness.The today’s world many people are busy and
suffering a lot in their life so to overcome that problem for atleast sometime and the
best solution is listening to the music.So we dediced to project on a music
recommendation system so that users can listen a song based on their interests , can
get the recommendation based on the similarity between the lyrics and also based on
their mood songs can be recommended.

1.3. Problem statement


The basic task in music recommendation system with plagiarism detection is
to generate the best music recommendation system by predicting based on
customization and detecting the similar music genre to avoid copyrights issue, by using
Collaborative filtering, Content based, Machine Learning, Data Analysis.

3
2. LITERATURE SURVEY

2.1. Introduction
An ideal music recommender system should be able to automatically
recommend personalised music to human listeners.So far, many music discovery
websites such as Last.fm, All music, Pandora, Audio baba Mog, Spotify, Apple Genius,
have aggregated millions of users, and the development is explosive . In this section,
we present the most popular approaches, metadata information retrieval, collaborative
filtering, content-based information retrieval, emotion-based model , context-based
information retrieval and hybrid models .

The proposed system contains the plagiarism in addition to the


recommendation system which acts as a great advantage to resolve the copyright
problems, the plagiarism module deals the check of similar music genre and detects the
songs with similar musical notes.

The collaborative filtering technique is used to recommend songs to the users


of similar groups. Involving collaborative filtering technique is an advantage to
recommend songs by achieving the customization. The three types of collaborative
filtering involved are memory based collaborative filtering, model based filtering,
hybrid based filtering.

The existing recommender systems using collaborative filtering algorithms


have gained a great success. Netflix opened a challenge for the best collaborative
filtering algorithm , and the winning algorithm using latent factor models could make
10.09% improvements over the algorithm used by Netflix at that time. Amazon uses
user-user based and item-item based collaborative filtering , which greatly contributes
to the success of the business. Recently a newer algorithm using neural network, neural
collaborative filtering was proposed.

The content-based filtering technique is used to predict the song by analyzing


the song track. It is rooted in information retrieval and information filtering that
recommends a song which is similar to those the user has listened to in the past rather
than what the user have rated ‘like’ Lots of research have been paid attention on
extracting and comparing the acoustic features in finding perceptual similar tracks .
The most representative ones so far are timbre, rhythm. Based on the extracted features,

4
the distance between songs are measured. Three typical similarity measurements are
K-means clustering with Earth-Mover’s Distance, Expectation-Maximization with
Monte Carlo Sampling, Average Feature Vectors with Euclidean Distance.

For content based algorithm, a lot of researchers have proposed different


methods using Machine Learning technique, such as Decision Tree based , Support
Vector Machine based , and even logistic regression . We can fully utilize the
knowledge we learnt from the class to implement these algorithms.

Digitization of music has led to easier access to different forms music across
the globe. Increasing work pressure denies the necessary time to listen and evaluate
music for a creation of a personal music library. One solution might be developing a
music search engine or recommendation system based on different moods. Develop a
mood classification system from lyrics as well by combining a wide range of semantic
and stylistic features extracted from textual lyrics.

2.2. Existing Systems


2.2.1. Collaboration Filtering
Collaborative filtering (CF) uses the numerical reviews given by the user and
is mainly based upon the historical data of the user available to the system . The
historical data available helps to build the user profile and the data available about the
item is used to make the item profile. Both the user profile and the item profile are
used to make a recommendation system. The Netflix Competition has given much
popularity to collaborative filtering .

Collaborative filtering is considered the most basic and the easiest method to
find recommendations and make predictions regarding the sales of a product. It does
have some disadvantages which has led to the development of new methods and
techniques.

2.2.2. Memory-Based Collaborative Filtering(Neighbourhood based)


People with similar interests are combined to form a group and every user is a
part of that . User –based CF and Itemimplement and scales well with correlated items.
There is no need items being recommended. There are many limitationsof memory
problem, sparsity and their dependencies on human ratings .

5
2.2.3. Model-based CF

Complex patters which are based on training data, are the models (such as
data mining algorithms, machine learning) and then intelligent predictions are made
for CF tasks for the real world data which arebased on learnt models. It intuitive
rationale for recommendations. Model disadvantage of model-based CF is that it loses
useful information for dimensionality reduction techniques .

2.2.4. Hybrid Collaborative Filtering Techniques


In hybrid recommender system, different techniques of collaborative
approaches and other recommender techniques (usually content based approaches),
combined to get better results.

Various problems like cold-start, data sparsity and scalability can be avoided
by using hybrid approach [40].There are different ways of combining CF with other
recommender techniques which are following:
• Hybrid Recommenders Incorporating CF and Content-Based Features
• Hybrid Recommenders Combining CF and Other Recommender Systems
• Hybrid Recommenders Combining CF Algorithms .

2.2.5. Content Based Recommender System


Content based systems focus on the features of the products and aim at
creating a user profile depending on the previous reviews and also a profile of the item
in accordance with the features it provides and the reviews it has received .It is
observed that reviews usually contain product feature and user opinion in pairs . It is
observed that users’ reviews contain a feature of the product followed by his/her
opinion about the product. Content based recommendation systems help overcome
sparsity problem that is faced in collaborative filtering based recommendation system.

Content based collaborative filtering is more widely used to compare pure CF


and pure Content-base. In CF the problem of sparsity is overcome (converting sparse
user filled matrix into full user rating matrix) by using content-based prediction.
Relevant entities of an item and relations are kept together as input.

6
2.2.6. Context Based Recommender System
Extending the user/item convention to the circumstances of the user to
incorporate the contextual information is what is achieved in context-based
recommender systems [15]. This helps to abandon the cumbersome process of making
the user fill a huge number of personal details.

It aids in extracting information about a particular community of individuals


and this information proves to be of high importance to improve the suggestions
provided to a user and makes the system more efficient. Recommender systems require
situational information of the user and context based recommender system accesses
this information directly using various techniques (such as GPS) and does not bother
the user with this.

The user's location data, social data, current time, weather data is taken into
consideration as the contextual data and is given as input to the system. An
approximate address of the user is determined and the location is saved. Social data of
a user can be accessed by requesting permission to a social account of the user.
Contextual factors are of two types: Dynamic and static, depending on whether they
change with time or not.

1. Dynamic: When the contextual factors change over time and hence unstable. They
may change by explicit user feedback. User feedback is generally used for refining the
profile of user to get better results of recommendations. The biggest challenge is that if
a system is considered to be dynamic then the system should be able to find out when
to switch to a different underlying context model.

2. Static: The contextual factors don’t change over time and hence stable. For e.g. to
buy a cell phone the contextual factors can be Time, purpose of purchasing and only
them while entire purchasing purpose recommendation application runs.

Contextual factors are of three types: Fully observable, partially observable


and Unobservable, depending on what is being observed (or what system exactly
knows).

7
1. Fully observable: Complete structure and values of contextual factors are known
explicitly, at the time when recommendations are made.
2. Partially observable: Some of the information is known explicitly about the
contextual factors.
3. Unobservable: There is no information of contextual factors explicitly available in
It.

2.2.7. A Recommender System Based on Genetic Algorithm

The recommender system by Hyun-Tae Kim, Eungyeong Kim, Jong-Hyun


Lee and Chang Wook Ahn is a hybrid approach of Collaborative Filtering (CF) and
Genetic Algorithm (GA). The proposed system aims to effectively adapt and respond
to immediate changes in users’ preferences. The experiments conducted in an objective
manner exhibit that our system is able to recommend items suitable with the subjective
favorite of each individual user.
The content-based filtering technique is applied to generate the initial
population of GA. The recommender system is divided into three phases:
1.Feature extraction
2.Feature evaluation
3.Interactive phase

2.2.7.1. Advantages
The experimental results exhibited that the average scores, which are
objectively collected by means of user evaluations, increases by degrees as the
generation grows.

2.2.7.2. Limitations
It’s really hard for people to come up with a good heuristic which actually
reflects what we want the algorithm to do. It might not find the most optimal solution
to the defined problem in all cases.

8
2.2.8. A Personalized Music Recommendation System Using
Convolutional Neural Networks Approach
A Personalized Music Recommendation System Using Convolutional Neural
Networks Approach”, they have used CNN to classify the music and generate a log file
and used CF to provide recommendations. There paper suggested that using traditional
classifiers such as SVN or KNN can reduce efficiency when applied on complex data.

2.2.9. Affective Music Recommendation System Reflecting the Mood


of Input Image
“Affective Music Recommendation System Reflecting the Mood of Input
Image” by Shoto Sasaki recommended music based on the present mood identified in
the image. The RS recommended based on the genre the user listens to and determines
its mood (happy, sad, lonely etc.) and predicts music based on it.

As it is difficult to select music manually, we need a recommendation system


that can operate affectively. In this paper, we assume that there exists a relationship
between our mood and images because visual information affects our mood when we
listen to music. Our system matches an input image with music using valence-arousal
plane which is an emotional plane.

Music recommendation system shares some similarities with other


commercial recommendation systems, but it focuses more on providing good and
personalized advice on music, rather than goods for users to buy. The ideal music
recommender system should be able to automatically recommend personalized music
to human listeners. Different from books or movies, the length of a piece of music is
much shorter, and the times that listening their favorite songs are normally more than
once, which are the main difficulties we are going to face in this project.

9
3. METHODOLOGIES AND ARCHITECTURE

3.1. Machine Learning

A machine learning model is the output of the training process and is defined
as the mathematical representation of the real-world process. The machine learning
algorithms find the patterns in the training dataset, which is used to approximate the
target function and is responsible for mapping the inputs to the outputs from the
available dataset. These machine learning methods depend upon the type of task and
are classified as Classification models, Regression models, Clustering, Dimensionality
Reductions, Principal Component Analysis, etc.

Machine learning is no exception, and a good flow of organized, varied data


is required for a robust ML solution. In today’s online-first world, companies have
access to a large amount of data about their customers, usually in the millions. This
data, which is both large in the number of data points and the number of fields, is
known as big data due to the sheer amount of information it holds.

3.1.1. Supervised Machine Learning


Supervised learning algorithms are used when the output is classified or
labeled. These algorithms learn from the past data that is inputted, called training data,
runs its analysis and uses this analysis to predict future events of any new data within
the known classifications. The accurate prediction of test data requires large data to
have a sufficient understanding of the patterns. The algorithm can be trained further by
comparing the training outputs to actual ones and using the errors for modification of
the algorithms.

In supervised learning, the ML algorithm is given a small training dataset to


work with. This training dataset is a smaller part of the bigger dataset and serves to
give the algorithm a basic idea of the problem, solution, and data points to be dealt
with. The training dataset is also very similar to the final dataset in its characteristics
and provides the algorithm with the labeled parameters required for the problem.

10
The algorithm then finds relationships between the parameters given,
essentially establishing a cause and effect relationship between the variables in the
dataset. At the end of the training, the algorithm has an idea of how the data works and
the relationship between the input and the output.

This solution is then deployed for use with the final dataset, which it learns
from in the same way as the training dataset. This means that supervised machine
learning algorithms will continue to improve even after being deployed, discovering
new patterns and relationships as it trains itself on new data.

3.1.2. Unsupervised Machine Learning


Unsupervised learning algorithms are used when we are unaware of the final
outputs, and the classification or labeled outputs are not at our disposal. These
algorithms study and generate a function to describe completely hidden and unlabelled
patterns. Hence, there is no correct output, but it studies the data to give out unknown
structures in unlabelled data.

In supervised learning, the labels allow the algorithm to find the exact nature
of the relationship between any two data points. However, unsupervised learning does
not have labels to work off of, resulting in the creation of hidden structures.
Relationships between data points are perceived by the algorithm in an abstract
manner, with no input required from human beings.

The creation of these hidden structures is what makes unsupervised learning


algorithms versatile. Instead of a defined and set problem statement, unsupervised
learning algorithms can adapt to the data by dynamically changing hidden structures.
This offers more post-deployment development than supervised learning algorithms.

3.1.3. Reinforcement Machine Learning


This type of machine learning algorithm uses the trial and error method to
churn out output based on the highest efficiency of the function. The output is
compared to find out errors and feedback, which are fed back to the system to improve
or maximize its performance. The model is provided with rewards which are basically
feedback and punishments in its operations while performing a particular goal.

11
Based on the psychological concept of conditioning, reinforcement learning
works by putting the algorithm in a work environment with an interpreter and a reward
system. In every iteration of the algorithm, the output result is given to the interpreter,
which decides whether the outcome is favorable or not.

In case of the program finding the correct solution, the interpreter reinforces
the solution by providing a reward to the algorithm. If the outcome is not favorable,
the algorithm is forced to reiterate until it finds a better result. In most cases, the
reward system is directly tied to the effectiveness of the result.

In typical reinforcement learning use-cases, such as finding the shortest route


between two points on a map, the solution is not an absolute value. Instead, it takes on
a score of effectiveness, expressed in a percentage value. The higher this percentage
value is, the more reward is given to the algorithm. Thus, the program is trained to
give the best possible solution for the best possible reward.

3.1.4. Semi-Supervised Machine Learning

These algorithms normally undertake labeled and unlabeled data, where the
unlabelled data amount is large as compared to labeled data. As it works with both and
in between supervised and unsupervised learning algorithms, therefore is called semi-
supervised machine learning. Systems using these models are seen to have improved
learning accuracy.

3.1.5. Classification
There is a division of classes of the inputs; the system produces a model from
training data wherein it assigns new inputs to one of these classes.
It falls under the umbrella of supervised learning. A real-life example can be spam
filtering, where emails are the input that is classified as “spam” or “not spammed”.

3.1.6. Regression
Regression algorithm also is a part of supervised learning, but the difference
being that the outputs are continuous variables and not discrete.

We have used unsupervised machine learning and KNN algorithm can be used for
both classification and regression problems. The KNN algorithm uses 'feature

12
similarity' to predict the values of any new data points. This means that the new point
is assigned a value based on how closely it resembles the points in the training set.

3.2. Python

What exactly is Python? You may be wondering about that. You may be
referring to this book because you wish to learn editing but are not familiar with
editing languages. Alternatively, you may be familiar with programming languages
such as C, C ++, C #, or Java and wish to learn more about Python language and how it
compares to these "big word" languages.

3.2.1. Python Concepts

You can skip to the next chapter if you are not interested in how and why
Python. In this chapter, I will try to explain why I think Python is one of the best
programming languages available and why it is such a great place to start.

Python was developed into an easy-to-use programming language. It uses


English words instead of punctuation, and has fewer syntax than other languages.
Python is a highly developed, translated, interactive, and object-oriented language.

Python translated - Interpreter processing Python during launch. Before using


your software, you do not need to install it. This is similar to PERL and PHP editing
languages.

Python interactive - To write your own applications, you can sit in Python
Prompt and communicate directly with the interpreter.

Python Object-Oriented - Python supports the Object-Oriented program style


or method, encoding the code within objects.

Python is a language for beginners - Python is an excellent language for


beginners, as it allows for the creation of a variety of programs, from simple text
applications to web browsers and games.

13
3.2.2. Python Features
Python features include -

Easy-to-learn - Python includes a small number of keywords, precise


structure, and well-defined syntax. This allows the student to learn the language faster.

Easy to read - Python code is clearly defined and visible to the naked eye.

Easy-to-maintain - Python source code is easy to maintain.

Standard General Library - Python's bulk library is very portable and shortcut
compatible with UNIX, Windows, and Macintosh.

Interaction mode - Python supports interaction mode that allows interaction


testing and correction of captions errors.

Portable - Python works on a variety of computer systems and has the same
user interface for all.

Extensible - Low-level modules can be added to Python interpreter. These


modules allow system developers to improve the efficiency of their tools either by
installing or customizing them.

Details - All major commercial information is provided by Python ways of


meeting

GUI Programming - Python assists with the creation and installation of a user
interface for images of various program phones, libraries, and applications, including
Windows MFC, Macintosh, and Unix's X Window.

Scalable - Major projects benefit from Python building and support, while Shell
writing is not.

Aside from the characteristics stated above, Python offers a long list of useful features,
some of which are described below. −

1.It supports OOP as well as functional and structured programming methodologies.

2.It can be used as a scripting language or compiled into byte-code for large-scale
application development.

14
3.It allows dynamic type verification and provides very high-level dynamic data types.

4.Automatic garbage pickup is supported by IT.

3.2.3. Datatypes

Python has five standard data types −

1.Numbers
2.String
3.List
4.Tuple
5.Dictionary

3.2.4. Python Numbers


Numeric values are stored in number data types. When you give a number a value, it
becomes a number object.

3.2.5. Python Strings


In this python uses a string is defined as a collection set of characters
enclosed in quotation marks. Python allows you to use any number of quotes in pairs.
The slice operator ([ ] and [:] ) can be used to extract subsets of strings, with indexes
starting at 0 at the start of the string and working their way to -1 at the end.
3.2.6. Python Lists
The most diverse types of Python data are lists. Items are separated by
commas and placed in square brackets in the list ([]). Lists are similar to C-order in
some ways. Listings can be for many types of data, which is one difference between
them.
The slide operator ([] and [:]) can be used to retrieve values stored in the list,
the indicators start with 0 at the beginning of the list and work their way to the end of
the list. The concatenation operator of the list is a plus sign (+), while the repeater is an
asterisk (*).

15
3.2.7. Python Tuples
A cone is a type of data type similar to a sequence of items. Cone is a set of
values separated by commas. The pods, unlike the list, are surrounded by parentheses.

Lists are placed in parentheses ([]), and the elements and sizes can be
changed, but the lumps are wrapped in brackets (()) and cannot be sorted. Powders are
the same as reading lists only.

3.2.8. Python Dictionary


Python dictionaries in Python are a way of a hash table. They are similar to
Perl's combination schemes or hashes, and are made up of two key numbers.

The dictionary key can be any type of Python, but numbers and strings are
very common. Prices, on the other hand, can be anything you choose Python.

Curly braces () surround dictionaries, and square braces ([) are used to assign
and access values.

3.2.9. Different Modes In Python


Python Normal and interactive are the two basic Python modes.The scripted
and completed.py files are executed in the Python interpreter in the regular manner.

Interactive mode is a command line shell that provides instant response for
each statement while simultaneously running previously provided statements in active
memory. The feed programme is assessed in part and whole as fresh lines are fed into
the interpreter.

Python is a full featured for general purpose programming language. It is a


mature and fast expanding platform for scientific research and numerical computing.
Python host numerous open source libraries and almost all general-purpose libraries
for machine learning which can be further use for deep learning models. All this
benefits from the python ecosystem lead to the top two libraries for numerical analysis
of deep learning was developed for python language, which is Pndas and numpy.

16
3.2.10. Pandas
Pandas is an open source library in Python. It provides ready to use high-
performance data structures and data analysis tools. Pandas module runs on top of
NumPy and it is popularly used for data science and data analytics. It allows us to store
and manipulate tabular data as a 2-D data structure.

Pandas is the most popular python library that is used for data analysis. It
provides highly optimized performance with back-end source code is purely written in
C or Python. We can analyze data in pandas with: Series.

Pandas allows us to analyze big data and make conclusions based on


statistical theories.Pandas can clean messy data sets, and make them readable and
relevant.Relevant data is very important in data science.

Pandas gives you answers about the data. Like:

 Is there a correlation between two or more columns?


 What is average value?
 Max value?
 Min value?

Pandas are also able to delete rows that are not relevant, or contains wrong values, like
empty or NULL values. This is called cleaning the data.
3.2.11. Numpy
NumPy is the fundamental package for scientific computing
in Python. NumPy arrays facilitate advanced mathematical and other types of
operations on large numbers of data. Typically, such operations are executed more
efficiently and with less code than is possible using Python's built-in sequences.

NumPy aims to provide an array object that is up to 50x faster than


traditional Python lists. The array object in NumPy is called ndarray , it provides a lot
of supporting functions that make working with ndarray very easy. Arrays are very
frequently used in data science, where speed and resources are very important.

17
In Python we have lists that serve the purpose of arrays, but they are slow to
process.NumPy aims to provide an array object that is up to 50x faster than traditional
Python lists.

The array object in NumPy is called ndarray, it provides a lot of supporting


functions that make working with ndarray very easy.Arrays are very frequently used in
data science, where speed and resources are very important.

NumPy arrays are stored at one continuous place in memory unlike lists, so
processes can access and manipulate them very efficiently.This behavior is called
locality of reference in computer science.

This is the main reason why NumPy is faster than lists. Also it is optimized
to work with latest CPU architectures.NumPy is a Python library and is written
partially in Python, but most of the parts that require fast computation are written in C
or C++.

The Pandas module mainly works with the tabular data, whereas
the NumPy module works with the numerical data. ... NumPy library provides objects
for multi-dimensional arrays, whereas Pandas is capable of offering an in-memory 2d
table object called DataFrame. NumPy consumes less memory as compared to Pandas.

3.3. Jupyter Notebook

The Jupyter Notebook is an open-source web application that allows you to


create and share documents that contain live code, equations, visualizations and
narrative text. Uses include: data cleaning and transformation, numerical simulation,
statistical modeling, data visualization, machine learning, and much more.

Jupyter is a free, open-source, interactive web tool known as a


computational notebook, which researchers can use to combine software code,
computational output, explanatory text and multimedia resources in a single document.

The Jupyter Notebook is not included with Python, so if you want to try it
out, you will need to install Jupyter. There are many distributions of
the Python language. This article will focus on just two of them for the purposes of
installing Jupyter Notebook.

18
3.4. Google Colab

Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows
anybody to write and execute arbitrary python code through the browser, and is
especially well suited to machine learning, data analysis and education.

1.Write and execute code in Python

2.Document your code that supports mathematical equations

3.Create/Upload/Share notebooks.

4.Import/Save notebooks from/to Google Drive

5.Import/Publish notebooks from GitHub

6.Import external datasets e.g. from Kaggle

7.Integrate PyTorch, TensorFlow, Keras, OpenCV

8.Integrate PyTorch, TensorFlow, Keras, OpenCV.

3.5. Colloborative Filtering

Collaborative filtering (CF) is a technique used by recommender systems. ...


In the newer, narrower sense, collaborative filtering is a method of making automatic
predictions (filtering) about the interests of a user by collecting preferences or taste
information from many users (collaborating).

Collaborative-based methods work with an interaction matrix, also called


rating matrix. The aim of this algorithm is to learn a function that can predict if a user
will benefit from an item - meaning the user will likely buy, listen to, watch this
item.Among collaborative-based systems, we can encounter two types: user-
item filtering and item-item filtering.

The aim of this algorithm is to learn a function that can predict if a user will
benefit from an item — meaning the user will likely listen to a song.This can be done
by using rating. There are two ways to collect user ratings: Explicit Rating and Implicit
Rating. We used K-Nearest Neighbors Algorithm.

19
1. Explicit Rating
This means we explicitly ask the user to give a rating. This represents the
most direct feedback from users to show how much they like a song.

2. Implicit Rating
We examine whether or not a user listened to a song, for how long or how
many times, which may suggest that he/she liked that particular song.

3.6. System Architecture

Our research consists of eight stages that is Beginning stage, comprises 1.


problem identification and literature study, 2. Data cleaning and selection, 3. Modeling
recommender system, 4. Designing, implementing and evaluating the music
recommender system application. 5.Analysis 6. Mood Prediction, 7. plagiarism
detection, 8.Recommendation.

3.6.1. Data Cleaning And Selection

Data cleaning is the process of detecting and correcting (or removing) corrupt
or inaccurate records from a record set, table, or database and refers to identifying
incomplete, incorrect, inaccurate or irrelevant parts of the data and then replacing,
modifying, or deleting the dirty or coarse data.

Data selection: Data selection is defined as the process of determining the


appropriate data type and source, as well as suitable instruments to collect data. Data
selection precedes the actual practice of data collection.The process
of selecting suitable data for a research project can impact data integrity.

3.6.2. Modeling Recommender System


Within recommendation systems, there is a group
of models called collaborative-filtering, which tries to find similarities between users
or between items based on recorded user-item preferences or ratings.

20
3.6.3. Designing Implementing And Evaluating The Music
Recommender System Application

Let a user enter a song title and the system will find a song which has the
most similar features. After calculating similarity and sorting the scores in descending
order, I find the corresponding songs of 5 highest similarity scores and return to users.

Fig1: Steps of music recommendation system

In this problem, we have to build a linear classifier model to predict the songs.
This process should be followed once the dataset is preprocessed: data cleaning and
data transformation. The DNN model will be built using python3 and tensorflow 1.3.0.

3.7. Content -Based


Content-based methods gives recommendations based on the similarity of
two song contents or attributes while collaborative methods make a prediction on
possible preferences using a matrix with ratings on different songs.content-based
recommendation algorithm has to perform the following two steps.First, extract
features out of the content of the song descriptions to create an object

21
representation.Second, define a similarity function among these object representations
which mimics what human understands as an item-item similarity.Because we are
working with text and words, Term Frequency-Inverse Document Frequency (TF-IDF)
can be used for this matching process.

Content-based methods are computationally fast and interpretable. Moreover,


they can be efficiently adapted to new items or users. However, one of the biggest
limitations of content-based recommendation systems is that the model only learns to
recommend items of the same type that the user is already using or, in our case,
listening to. Even though this could be helpful, the value of that recommendation is
significantly less because it lacks the surprise component of discovering something
completely new.

In the mood prediction,we do data preprocessing and feed to feature


engineering models like count vectorizer model,TfidfVectorizer Model, Tfidf-NGram
Model. Now the modified dataset is used in prediction models like Random Forest,
Logistion regression, SVM, and multinomial naive baise, to preict the test data set and
plot the confusion matrix.

Python is a full featured for general purpose programming language. It is a


mature and fast expanding platform for scientific research and numerical computing.
Python host numerous open source libraries and almost all general-purpose libraries
for machine learning which can be further use for deep learning models. All this
benefits from the python ecosystem lead to the top two libraries for numerical analysis
of deep learning was developed for python language, which is Pndas and numpy.

22
4. UML DIAGRAMS

Unified modelling language is a standardized language used for design


specifications in software engineering. As recommender systems are machine learning
systems which do not follow a specific methodology and are constructed according to
the need and the context of application. Models generally help in depicting every
singular feature of the system for better understanding. Moreover, UML has the object-
oriented features best suitable for the current scenario. Using this model any music
recommender system can be designed with any algorithm as this is abstracting the core
functionality but defining the high-level functional elements.

The kind of the diagram is defined by the primary graphical symbols shown
on the diagram. For example, a diagram where the primary symbols in the contents
area are classes is class diagram. A diagram which shows use cases and actors is use
case diagram. A sequence diagram shows sequence of message exchanges between
lifelines.

UML specification does not preclude mixing of different kinds of diagrams,


e.g. to combine structural and behavioral elements to show a state machine nested
inside a use case. Consequently, the boundaries between the various kinds of diagrams
are not strictly enforced. At the same time, some UML Tools do restrict set of
available graphical elements which could be used when working on specific type of
diagram.

UML specification defines two major kinds of UML diagram: structure


diagrams and behavior diagrams.

Structure diagrams show the static structure of the system and its parts on
different abstraction and implementation levels and how they are related to each other.
The elements in a structure diagram represent the meaningful concepts of a system,
and may include abstract, real world and implementation concepts.

Behavior diagrams show the dynamic behavior of the objects in a system,


which can be described as a series of changes to the system over time.

23
4.1. Use-Case Diagram
A use-case model describes a system's functional requirements in terms of
use cases. It is a model of the system's intended functionality (use cases) and its
environment (actors). Use cases enable you to relate what you need from a system to
how the system delivers on those needs. Because it is a very powerful planning
instrument, the use-case model is generally used in all phases of the development cycle
by all team members

An effective use case diagram can help your team discuss and represent:

1. Scenarios in which your system or application interacts with people,


organizations,or external systems.

2. Goals that your system or application helps those entities (known as actors) achieve.
3. The scope of your system.

Table 1:Use Case Diagram Table

24
4.1.1. Use Case Diagram for Colloborative Filtering(Fig 2)

4.1.2. Use Case Diagram for Content Based(Fig 3)

25
4.2. Sequence Diagram

A sequence diagram is a type of interaction diagram because it describes how


and in what order a group of objects works together. These diagrams are used by
software developers and business professionals to understand requirements for a new
system or to document an existing process. Sequence diagrams are sometimes known
as event diagrams or event scenarios.

Sequence diagrams can be useful references for businesses and other organizations.
Try drawing a sequence diagram to:
1.Represent the details of a UML use case.
2.Model the logic of a sophisticated procedure, function, or operation.
3.See how objects and components interact with each other to complete a process.
4.Plan and understand the detailed functionality of an existing or future scenario.
4.2.1. Sequence Diagram for Colloborative Filtering(Fig 4)

26
4.2.2. Sequence Diagram for Content-Based(Fig 5)

4.3. Activity Diagram:

An activity diagram is a behavioral diagram i.e. it depicts the behavior of a


system. An activity diagram portrays the control flow from a start point to a finish
point showing the various decision paths that exist while the activity is being executed.

It describes the flow of control of the target system, such as the exploring
complex business rules and operations, describing the use case also the business
process. In the Unified Modeling Language, activity diagrams are intended to model
both computational and organizational processes (i.e. workflows). The initiator is
generally a function module that gets called when an activity starts.

27
4.3.1. Activity Diagram for Colloborative Filtering(Fig 6)

4.3.2. Activity Diagram for Content-Based(Fig 7)

28
5. MODULES DIVISION

5.1. Collaborative Filtering

The collaborative filtering works based on the behavior of the user. The
larger the users, the more efficient the filter .

Collaborative filtering is based on the assumption that people who agreed in


the past will agree in the future, and that they will like 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. By locating peer users/items with a rating
history similar to the current user or item, it generates recommendations using this
neighborhood. We have implemented item based collaborative filtering model. Listen
count parameter is used as implicit feedback for training. To calculate similarity
between two items, we look into the set of items the target user has rated and compute
how similar they are to the target item i and then select K most similar items.
Similarity between two items is calculated by taking the ratings of the users who have
rated both the items and thereafter using the cosine similarity function.

Once we have the similarity between the items, the prediction is then
computed by taking a weighted average of the target users ratings on these similar
items. The formula to calculate rating is very similar to the user based collaborative
filtering except the weights are between items instead of between users. We use the
current users rating for the item or for other items, instead of other users rating for the
current items.

5.2. Plagiarism And Content-Based Module

It calculates the similarity between tracks based on the tags and categories
and recommend by checking the cosine similarity of given tracks.By using this we can
check the plagiarism between the songs by using similarity scores.

5.3. Mood Prediction

Digitization of music has led to easier access to different forms music across
the globe. Increasing work pressure denies the necessary time to listen and evaluate
music for a creation of a personal music library. One solution might be developing a

29
music search engine or recommendation system based on different moods. Develop a
mood classification system from lyrics as well by combining a wide range of semantic
and stylistic features extracted from textual lyrics.

In the mood prediction,we do data preprocessing and feed to feature


engineering models like count vectorizer model,TfidfVectorizer Model, Tfidf-NGram
Model. Now the modified dataset is used in prediction models like Random Forest,
Logistion regression, SVM, and multinomial naive baise, to preict the test data set and
plot the confusion matrix.

6. ALGORITHM
6.1. Collaborative filtering algorithms

6.1.1. KNN
The aim of this algorithm is to learn a function that can predict if a user will
benefit from an item — meaning the user will likely listen to a song.This can be done
by using rating. There are two ways to collect user ratings: Explicit Rating and Implicit
Rating. We used K-Nearest Neighbors Algorithm.

Explicit Rating
This means we explicitly ask the user to give a rating. This represents the
most direct feedback from users to show how much they like a song.

The dictionary meaning of explicit is to state clearly and in detail. Explicit feedback
data as the name suggests is an exact number given by a user to a product. Some of the
examples of explicit feedback are ratings of movies by users on Netflix, ratings of
products by users on Amazon

Implicit Rating
We examine whether or not a user listened to a song, for how long or
how many times, which may suggest that he/she liked that particular song.

Implicit ratings include measures of interest such as whether the user listen. A song
and, if so, how much time the user spent reading it. The main motivation for
using implicit ratings is that it removes the cost to the evaluator of examining
and rating the item.

30
Interaction matrices are based on the many entries that include a user-song pair
as well as a value that represents the user’s rating for that song.

We are going to use listen_count, the number of times a user listened to a song as
an implicit rating.

Doing some exploratory analysis, we can discover that a user listens to a mean
number of 26 songs and a median of songs of 16.

We can quickly see that not all users listen to all songs. So a lot of values in
the song x users matrix are going to be zero. Thus, we’ll be dealing with extremely
sparse data.

We now did work with a scipy-sparse matrix to avoid overflow and wasted
memory. For that purpose, we'll use the csr_matrix function from scipy.sparse.

First, we reshaped the data based on unique values from song_id as index
and user_id as columns to form axes of the resulting DataFrame..

Then, we’ll use the function pivot to produce a pivot table. Then, we’ll convert
this table to a sparse matrix.As we can observe many of the values are equal to zero.
This indicates that the user has not listened to that song.

There are 2 main approaches for colloborative filtering:


It finds users with similar interests and behavior, and considering what those
similar users listened to, it makes a recommendation. This technique is known as user-
based approach (or user-item).Or it can take into account what songs the user has
considered in the past and recommend new similar songs that the user can enjoy; a
technique that is called item-based approach (or item-item).

KNN: K - Nearest Neighbors (KNN) is considered the standard method when it


comes to both user-based and item-based collaborative filtering approaches.The KNN
algorithm is a supervised non-parametric Lazy Learning method used for both
classification and regression.It considers a graph based on the rating and plots the
rating of the input song in the graph and calculates the distance with all the other
songs using cosine similarity and recommends the song based on the distance I.e least
distance is compared.

31
KNN is a machine learning algorithm to find clusters of similar users based
on common book ratings, and make predictions using the average rating of top-k
nearest neighbors.

We use unsupervised algorithms with sklearn.neighbors. The algorithm we


use to compute the nearest neighbors is “brute”, and we specify “metric=cosine” so
that the algorithm will calculate the cosine similarity between rating vectors. Finally,
we fit the model.

1.metric: the distance metric to use. We are going to use cosine.


2.algorithm: Algorithm used to compute the nearest neighbors. We are going to use
a brute force algorithm
3.n_neighbors: Number of neighbors to use for queries. We are going to use 20 .
Remember that we mentioned before that this parameter is very important.

The kNN algorithm measures distance to determine the “closeness” of


instances. It then classifies an instance by finding its nearest neighbors, and picks the
most popular class among the neighbors.

This method will make a prediction based on the entire data set. When we
want to predict a new value, the algorithm will look for the K instances of the set
closest to it. Then, it will use the output values of the closest K neighbours to compute
the value of the variable that need to predicted.

Parameter K is to be determined, a sufficiently high value is needed to avoid


underfitting, however if the value is too high there is a risk of overfitting and so a poor
generalisation on unseen data. A compromise has to be found. For each new item i, the
first step is to calculate its distance d to all the other values of the dataset and retain the
K items for which the distance is minimal.

Then the optimal K is used to make the prediction: in the case of a regression,
the next step is to calculate the mean (or median) of the output values of the selected K
neighbours.

32
K Nearest Neighbor considers K Nearest Neighbors (Data points)
to predict the class or continuous value for a new Datapointas the name
suggests
1) Instance-based learning uses full training instances to predict output
for unknown data, rather than learning weights from training data to
predict output (as in model-based algorithms).
2) Lazy Learning: The model is not learned using training data before
the prediction is required on the new instance, and the learning
process is postponed until the prediction is asked.
3) Non-Parametric: In KNN, the mapping function has no specified
form.

6.1.2. CSR Matrix

Sparse matrix in general are collections in which vast majority of values are
some default values usually none or 0.CSR stands for “Compressed Sparse Row”.The
CSR notation output the row-column tuple where the matrix contains non-zero values
along with those values. It gives the information of the listen count and its location
other than 0 in music recommendation system.

33
CSR Matrix Table(Table 2)

6.1.3. FuzzyWuzzy

Fuzzywuzzy is a python library used for string matching. Fuzzywuzzy is the


process of matching strings that match a given pattern. It uses Levenshtein distance to
calculate the difference between sequences. It matches the Two strings by giving the
similarity index.If we give any song wrongly then it checks with the other songs and
calculates the similarity using fuzzymatching function and calculates the ratio and
considers the song with the highest ratio as the input song.

6.2. Plagiarism algorithms

6.2.1. Cosine similarity (Content-Based Model)


Content-based recommendation algorithm has to perform the following
two steps. First, extract features out of the content of the song descriptions to create an
object representation. Second, define a similarity function among these object
representations which mimics what human understands as an item-item similarity.
Because we are working with text and words, Term Frequency-Inverse Document
Frequency (TF-IDF) can be used for this matching process.

34
Recommendations done using content-based recommenders can be seen as a
user-specific classification problem. This classifier learns the user’s likes and dislikes
from the features of the song.

The most straightforward approach is keyword matching.The idea behind is to


extract meaningful keywords present in a song description a user likes, search for the
keywords in other song descriptions to estimate similarities among them, and based on
that, recommend those songs to the user.

TF-IDF is a information retrieval technique that weighs the terms frequency


(TF) and inverse document frequency(IDF).The product of these scores of a term is
called the TF*IDF weight of that term.

The higher the TF-Idf score the rarer the term is in a given document and vice versa.

The parameters which are passed to the function are:


1. analyzer: Whether the feature should be made of word or character n-grams.
2. 2.stop_word: Remember that stop words are simply words that add no significant
value to our system, so they should be ignored by the system. We pass English so that it
is identified as the language of the lyrics.

We create a lyric_matrix variable where we store the matrix containing each word and
its TF-IDF score with regard to each song lyric.

For our song recommendation system, we are going to use cosine


similarity and particularly, its implementation from Scikit-learn.

We want to calculate the cosine similarity of each item with every other item
in the dataset. So we just pass the lyrics_matrix as argument.Once we get the
similarities, we’ll store in a dictionary called similarities, the names of the 50 most
similar songs for each song in our dataset.

Cosine similarity is a metric used to measure how similar two items


are.Mathematically, it measures the cosine of the angle between the two vectors
projected into a multi-dimensional space. The output value ranges from 0-1.0 means
no similarity where as 1 means that both the items are 100% similar.The python cosine
similarity as the dot product of the input samples .

35
Given two vectors of attributes, A and B, the cosine similarity, cos( product and
magnitude).

Basically, the cosine similarity is the dot product of two vectors divided by the
product of the magnitude of each vector. We divide the dot product by the magnitude
because we are measuring only angle difference. On the other hand, dot product is
taking the angle difference and magnitude into account. If we divide the dot product by
the product of each vectors magnitude we normalize our data and only measure the
angle difference. Dot product is a better measure of similarity if we can ignore
magnitude.

The cosine of a 0 degree angle is 1, therefore the closer to 1 the cosine


similarity is the more similar the items are.

6.3. Mood Prediction Algorithms


Digitization of music has led to easier access to different forms music across
the globe. Increasing work pressure denies the necessary time to listen and evaluate
music for a creation of a personal music library. One solution might be developing a
music search engine or recommendation system based on different moods. Develop a

36
mood classification system from lyrics as well by combining a wide range of semantic
and stylistic features extracted from textual lyrics.

6.3.1. Count Vectorizer


Scikit-learn's CountVectorizer is used to convert a collection of text
documents to a vector of term/token counts. It also enables the pre-processing of text
data prior to generating the vector representation. This functionality makes it a highly
flexible feature representation module for text.

6.3.2. Fit_transform()
fit_transform() is used on the training data so that we can scale the
training data and also learn the scaling parameters of that data. Here, the model built
by us will learn the mean and variance of the features of the training set. These learned
parameters are then used to scale our test data.

6.3.3. TfidfVectorizer Model


TfidfVectorizer - Transforms text to feature vectors that can be used
as input to estimator. vocabulary_ Is a dictionary that converts each token (word) to
feature index in the matrix, each unique token gets a feature index. ... In each vector
the numbers (weights) represent features tf-idf score.

Scikit-learn's Tfidftransformer and Tfidfvectorizer aim to do the


same thing, which is to convert a collection of raw documents to a matrix of TF-IDF
features.

6.3.4. Model
A contiguous sequence of N items from a given sample of text or speech”.
Here an item can be a character, a word or a sentence and N can be any integer. When
N is 2, we call the sequence a bigram. Similarly, a sequence of 3 items is called a
trigram, and soon.

An n-gram model is a type of probabilistic language model for predicting the


next item in such a sequence in the form of a (n − 1)–order Markov model.

37
6.3.5. SVM
“Support Vector Machine” (SVM) is a supervised machine learning
algorithm which can be used for both classification or regression challenges.
However, it is mostly used in classification problems. In the SVM algorithm, we plot
each data item as a point in n-dimensional space (where n is number of features you
have) with the value of each feature being the value of a particular coordinate.

SVM or Support Vector Machine is a linear model for classification and


regression problems. It can solve linear and non-linear problems and work well for
many practical problems. The idea of SVM is simple: The algorithm creates a line or a
hyperplane which separates the data into classes.During the Training phase based on
the training dataset it divodes the words into different categories such as happy ,sad etc
and based on the words the mood of the input song is predicted and based on the
similarity score which are sorted in the increasing order the mood for the top similarity
songs are predicted using svm and then the same mood songs are recommended.

Support Vector Machine are widely used for music classifification and gives
good results but the features used are often restricted to MFCC and some rhythmic
features. This method uses several successive SVMs to improve the results.

The basic principle is to separate two groups of data while maximising the
margin around the border (so the distance between two classes). It is based on the idea
that almost everything becomes linearly separable when represented in high-
dimensional spaces. So the two steps are: transforming the input into a suitable high-
dimensional space, and then finding the hyperplane that separate data while
maximising margins.

38
7. INPUT AND OUTPUT
Input Data: Million Songs Dataset

Collaborative
https://media.githubusercontent.com/media/sheemachinnu/music-recommendation-
system/main/10000_part1.txt

https://github.com/sheemachinnu/music-recommendation-
system/blob/main/10000_part2.txt

Colloborative Dataset Contents(Table 3)

Listen count is the number of the times the user listened to the song,title
belongs to the name of the song which is given in the output,release is the album with
which the song was artist name is the name of the singer and year is in which year it is
published are related to the each song.

Each song will be assigned with a unique song id and also each user will be assigned
with unique user id.

39
Content
https://raw.githubusercontent.com/sheemachinnu/music-recommendation-
system/main/song_data.csv

Content Based Dataset Contents(Table 4)

Here the artist is the name of the singer,song is the title of the song,and text is the
lyrics of the song.

40
8. CODE IMPLEMENTATION

8.1. Collaborative Filtering: KNN

part1 = open("./music-recommendation-system/10000_part1.txt").readlines()
part2 = open("./music-recommendation-system/10000_part2.txt").readlines()

total = part1 + part2

f = open('./music-recommendation-system/10000.txt', 'w')
f.write(''.join(total))
f.close()

# KNN Recommender
from sklearn.neighbors import NearestNeighbors
from fuzzywuzzy import fuzz
import numpy as np

class Recommender:
def __init__(self, metric, algorithm, k, data, decode_id_song):
self.metric = metric
self.algorithm = algorithm
self.k = k
self.data = data
self.decode_id_song = decode_id_song
self.data = data
self.model = self._recommender().fit(data)

def make_recommendation(self, new_song, n_recommendations):

recommended=self._recommend(new_song=new_song,n_recommendations=n_recom
mendations)
print("... Done")
return recommended

def _recommender(self):
Returrn NearestNeighbors(metric=self.metric,algorithm=self.algorithm,
n_neighbors=self.k, n_jobs=-1)

def _recommend(self, new_song, n_recommendations):


# Get the id of the recommended songs
recommendations = []
recommendation_ids=self._get_recommendations(new_song=new_song,

41
n_recommendations=n_recommendations)
# return the name of the song using a mapping dictionary
recommendations_map = self._map_indeces_to_song_title(recommendation_ids)
# Translate this recommendations into the ranking of song titles recommended
for i, (idx, dist) in enumerate(recommendation_ids):
recommendations.append(recommendations_map[idx])
return recommendations

def _get_recommendations(self, new_song, n_recommendations):


# Get the id of the song according to the text
recom_song_id = self._fuzzy_matching(song=new_song)
# Start the recommendation process
print(f"Starting the recommendation process for {new_song} ...")
# Return the n neighbors for the song id
distances,indices=self.model.kneighbors(self.data[recom_song_id],
n_neighbors=n_recommendations+1)
return sorted(list(zip(indices.squeeze().tolist(), distances.squeeze().tolist())),
key=lambda x: x[1])[:0:-1]

def _map_indeces_to_song_title(self, recommendation_ids):


# get reverse mapper
return {song_id: song_title for song_title, song_id in self.decode_id_song.items()}

def _fuzzy_matching(self, song):


match_tuple = []
# get match
for title, idx in self.decode_id_song.items():
ratio = fuzz.ratio(title.lower(), song.lower())
if ratio >= 60:
match_tuple.append((title, idx, ratio))

# sort
match_tuple = sorted(match_tuple, key=lambda x: x[2])[::-1]
if not match_tuple:
print(f"The recommendation system could not find a match for {song}")
return
return match_tuple[0][1]

42
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

from scipy.sparse import csr_matrix

#Read userid-songid-listen_count
song_info=pd.read_csv('./music-recommendation-
system/10000.txt',sep='\t',header=None)
song_info.columns = ['user_id', 'song_id', 'listen_count']

#Read song metadata


song_actual = pd.read_csv('./music-recommendation-system/song_data.csv')
song_actual.drop_duplicates(['song_id'], inplace=True)

#Merge the two dataframes above to create input dataframe for recommender systems
songs = pd.merge(left=song_info, right=song_actual, on="song_id", how="left")

songs.head()

songs.to_csv('songs.csv', index=False)

df_songs = pd.read_csv('songs.csv')
df_songs.shape

df_songs.head()

#Get total observations


print(f"There are {df_songs.shape[0]} observations in the dataset")

df_songs.isnull().sum()
df_songs.dtypes

#Unique songs
unique_songs = df_songs['title'].unique().shape[0]
print(f"There are {unique_songs} unique songs in the dataset")

#Unique artists
unique_artists = df_songs['artist_name'].unique().shape[0]

43
print(f"There are {unique_artists} unique artists in the dataset")
#Unique users
unique_users = df_songs['user_id'].unique().shape[0]
print(f"There are {unique_users} unique users in the dataset")

#count how many rows we have by song, we show only the ten more popular songs
ten_pop_songs =
df_songs.groupby('title')['listen_count'].count().reset_index().sort_values(['listen_count
', 'title'], ascending = [0,1])
ten_pop_songs['percentage'] =
round(ten_pop_songs['listen_count'].div(ten_pop_songs['listen_count'].sum())*100, 2)

ten_pop_songs = ten_pop_songs[:10]
ten_pop_songs

labels = ten_pop_songs['title'].tolist()
counts = ten_pop_songs['listen_count'].tolist()

plt.figure()
sns.barplot(x=counts, y=labels, palette='Set3')
sns.despine(left=True, bottom=True)

#count how many rows we have by artist name, we show only the ten more popular
artist
ten_pop_artists =
df_songs.groupby(['artist_name'])['listen_count'].count().reset_index().sort_values(['lis
ten_count', 'artist_name'], ascending = [0,1])

ten_pop_artists = ten_pop_artists[:10]
ten_pop_artists

plt.figure()
labels = ten_pop_artists['artist_name'].tolist()
counts = ten_pop_artists['listen_count'].tolist()
sns.barplot(x=counts, y=labels, palette='Set2')
sns.despine(left=True, bottom=True)

listen_counts=pd.DataFrame(df_songs.groupby('listen_count').size(),
columns=['count'])
listen_counts.head()

print(f"The maximum time the same user listened to the same songs was:

44
{listen_counts.reset_index(drop=False)['listen_count'].iloc[-1]}")

print(f"On average, a user listen to the same song {df_songs['listen_count'].mean()}


times")

plt.figure(figsize=(20, 5))
sns.boxplot(x='listen_count', data=df_songs)
sns.despine()

# What are the most frequent number of times a user listen to the same song?
listen_counts_temp=listen_counts[listen_counts['count'] > 50].reset_index(drop=False)
plt.figure(figsize=(16, 8))
sns.barplot(x='listen_count', y='count', palette='Set3', data=listen_counts_temp)
plt.gca().spines['top'].set_visible(False)
plt.gca().spines['right'].set_visible(False)
plt.show();

# How many songs does a user listen in average?


song_user = df_songs.groupby('user_id')['song_id'].count()

plt.figure(figsize=(16, 8))
sns.distplot(song_user.values, color='orange')
plt.gca().spines['top'].set_visible(False)
plt.gca().spines['right'].set_visible(False)
plt.show();

print(f"A user listens to an average of {np.mean(song_user)} songs")

print(f"A user listens to an average of {np.median(song_user)} songs, with minimum


{np.min(song_user)} and maximum {np.max(song_user)} songs")

# Get how many values should it be if all songs have been listen by all users
values_matrix = unique_users * unique_songs

# Substract the total values with the actural shape of the DataFrame songs
zero_values_matrix = values_matrix - df_songs.shape[0]

print(f"The matrix of users x songs has {zero_values_matrix} values that are zero")

# Get users which have listen to at least 16 songs


song_ten_id = song_user[song_user > 16].index.to_list()

# Filtered the dataset to keep only those users with more than 16 listened

45
df_song_id_more_ten =
df_songs[df_songs['user_id'].isin(song_ten_id)].reset_index(drop=True)

# convert the dataframe into a pivot table


df_songs_features = df_song_id_more_ten.pivot(index='song_id', columns='user_id',
values='listen_count').fillna(0)
#df_songs_features.isnull().sum()
df_songs_features.head()

# obtain a sparse matrix


mat_songs_features = csr_matrix(df_songs_features.values)

test = pd.DataFrame(mat_songs_features)
test.head()
#mat_songs_features

df_unique_songs =
df_songs.drop_duplicates(subset=['song_id']).reset_index(drop=True)[['song_id',
'title']]

decode_id_song = {
song: i for i, song in
enumerate(list(df_unique_songs.set_index('song_id').loc[df_songs_features.index].title)
)
}

model = Recommender(metric='cosine', algorithm='brute', k=20,


data=mat_songs_features, decode_id_song=decode_id_song)

song = 'Dog Days Are Over'

new_recommendations = model.make_recommendation(new_song=song,
n_recommendations=10)
print(f"The recommendations for {song} are:")
print(f"{new_recommendations}")

46
8.1.1. Graphs

8.1.1.1. Most Popular Songs(Fig 8)

Graph between title and listen count

we'll count how many times each song appears.The listen_count represents how many
times one user listen to the same song.The graph is for top ten popular songs which are
sorted based on the listen_count.

8.1.1.2. Most Popular Artist(Fig 9)

Graph between artist name and listen

we'll count how many times each artist appears. Again, we'll count how many timesn
the same artist appears.

47
8.1.1.3. Listen Count by User(Fig 10)

A box plot or boxplot is a method for graphically depicting groups of numerical data
through their quartiles.
It tells about other information based on the listen_count:
1. What was the maximum time the same user listen to a same song?
2. How many times on average the same user listen to a same song?

What are the most frequent number of times a user listen to the same song?

48
How many songs does a user listen in average?

Output for Collaborative Filtering (Fig 11)

49
8.2. Content Based (Plagiarism)
import numpy as np
import pandas as pd

from typing import List, Dict

from sklearn.feature_extraction.text import TfidfVectorizer


from sklearn.metrics.pairwise import cosine_similarity

songs = pd.read_csv('/content/songdata.csv')
songs.head(20)

songs = songs.sample(n=5000).drop('link', axis=1).reset_index(drop=True)


songs['text'] = songs['text'].str.replace(r'\n', '')

tfidf = TfidfVectorizer(analyzer='word', stop_words='english')


lyrics_matrix = tfidf.fit_transform(songs['text'])

cosine_similarities = cosine_similarity(lyrics_matrix)
similarities = {}

for i in range(len(cosine_similarities)):
# Now we'll sort each element in cosine_similarities and get the indexes of the songs.
similar_indices = cosine_similarities[i].argsort()[:-50:-1]
# After that, we'll store in similarities each name of the 50 most similar songs.
# Except the first one that is the same song.
similarities[songs['song'].iloc[i]] = [(cosine_similarities[i][x], songs['song'][x],
songs['artist'][x]) for x in similar_indices][1:]

class Recommender:
def __init__(self, matrix):
self.matrix_similar = matrix

def _print_message(self, song, recom_song):


rec_items = len(recom_song)
print(f'The {rec_items} recommended songs for {song} are:')
for i in range(rec_items):
print(f"Number {i+1}:")
print(f"{recom_song[i][1]} by {recom_song[i][2]} with
{round(recom_song[i][0], 3)} similarity score")
print("--------------------")

def recommend(self, recommendation):


# Get song to find recommendations for
song = recommendation['song']
# Get number of songs to recommend
number_songs = recommendation['number_songs']
# Get the number of songs most similars from matrix similarities
recom_song = self.matrix_similar[song][:number_songs]

50
# print each item
self._print_message(song=song, recom_song=recom_song)

recommedations = Recommender(similarities)

print(songs['song'])
#song_idx = 2008
#inp = song_idx
sname = "As Good As New"

recommendation = {
"song": sname,
"number_songs": 4
}
recommedations.recommend(recommendation)

recommendation2 = {
"song": songs['song'].iloc[2456],
"number_songs": 4
}
recommedations.recommend(recommendation2)

Output for Content Based (Fig 12)

51
8.3. Mood prediction:
df=pd.read_csv("/content/music-recommendation
system/datasets/lyrics_emotion_dataset/training.csv")
df_new=pd.read_csv("/content/music-recommendation-
system/datasets/lyrics_emotion_dataset/testing.csv")

df_new['lyrics'] = [entry.lower() for entry in df_new['lyrics']]


df_new['lyrics']= [word_tokenize(entry) for entry in df_new['lyrics']]

df['lyrics'] = [entry.lower() for entry in df['lyrics']]


df['lyrics']= [word_tokenize(entry) for entry in df['lyrics']]

tag_map = defaultdict(lambda : wn.NOUN)


tag_map['J'] = wn.ADJ
tag_map['V'] = wn.VERB
tag_map['R'] = wn.ADV
for index,entry in enumerate(df_new['lyrics']):
Final_words = []
word_Lemmatized = WordNetLemmatizer()
for word, tag in pos_tag(entry):
if word not in stopwords.words('english') and word.isalpha():
word_Final = word_Lemmatized.lemmatize(word,tag_map[tag[0]])
Final_words.append(word_Final)
df_new.loc[index,'text_final'] = str(Final_words)

tag_map = defaultdict(lambda : wn.NOUN)


tag_map['J'] = wn.ADJ
tag_map['V'] = wn.VERB
tag_map['R'] = wn.ADV
for index,entry in enumerate(df['lyrics']):
Final_words = []
word_Lemmatized = WordNetLemmatizer()
for word, tag in pos_tag(entry):
if word not in stopwords.words('english') and word.isalpha():
word_Final = word_Lemmatized.lemmatize(word,tag_map[tag[0]])
Final_words.append(word_Final)
df.loc[index,'text_final'] = str(Final_words)

train_x = df['text_final']
valid_x = df_new['text_final']
train_y = df['mood']
valid_y = df_new['mood']

Encoder = LabelEncoder()
train_y = Encoder.fit_transform(train_y.ravel())
valid_y = Encoder.fit_transform(valid_y.ravel())
classLabels = {}

52
encoderClasses = Encoder.classes_

for i in range(len(encoderClasses)):
classLabels[i] = encoderClasses[i]

classLabels

all_texts = []
for items in train_x:
all_texts.append(items)
for items in valid_x:
all_texts.append(items)
print(all_texts[0])

TF-IDF Vectorizer
porter_stemmer = nltk.stem.porter.PorterStemmer()
def porter_tokenizer(text, stemmer=porter_stemmer):
lower_txt = text.lower()
tokens = nltk.wordpunct_tokenize(lower_txt)
stems = [porter_stemmer.stem(t) for t in tokens]
no_punct = [s for s in stems if re.match('^[a-zA-Z]+$', s) is not None]
return no_punct

from sklearn.feature_extraction.text import TfidfVectorizer


tfidf_vect = TfidfVectorizer(
encoding='utf-8',
decode_error='replace',
strip_accents='unicode',
analyzer='word',
binary=False,
stop_words="english",
tokenizer=porter_tokenizer
)

tfidf_vect.fit(all_texts)
xtrain_tfidf = tfidf_vect.transform(train_x)
xvalid_tfidf = tfidf_vect.transform(valid_x)

Model
from sklearn.metrics import f1_score

claf=svm.LinearSVC(class_weight="balanced")
claf.fit(xtrain_tfidf,train_y)
p = claf.predict(xvalid_tfidf)

score = f1_score(valid_y[:len(p)], p, average='weighted')


print("F1_Score", "{:.2f}".format(score))

def predictEmotion(lyrics):

53
wt=word_tokenize(lyrics)
tag_map = defaultdict(lambda : wn.NOUN)
tag_map['J'] = wn.ADJ
tag_map['V'] = wn.VERB
tag_map['R'] = wn.ADV
Final_words = []
word_Lemmatized = WordNetLemmatizer()
for word, tag in pos_tag(wt):
if word not in stopwords.words('english') and word.isalpha():
word_Final = word_Lemmatized.lemmatize(word,tag_map[tag[0]])
Final_words.append(word_Final)
result = str(Final_words)
df9=pd.DataFrame(columns=["lyrics"])
df9=df9.append({'lyrics':result},ignore_index=True)

testx=df9['lyrics']

xvalid_tfidf = tfidf_vect.transform(testx)
y=claf.predict(xvalid_tfidf)

return classLabels[y[0]]

recommendation = {
"song": songs['song'].iloc[song_idx],
"number_songs": -1
}
recommnded_songs = recommedations.recommend(recommendation)

emotionOfSelectedSong = predictEmotion(songs['text'].iloc[song_idx])
EmotionOfSelectedSong

for song in recommnded_songs:


emotion = predictEmotion(songs["text"][songs["song"] ==
song[1]].values[0])# print(songs["text"][songs["song"] ==
song[1]].values[0])
if (emotionOfSelectedSong == emotion):
reccomendedSongsByEmotion.append((song[1], song[0],
emotion))noOfRecomendations -= 1
if (noOfRecomendations == 0): break

54
reccomendedSongsByEmotion

n = len(reccomendedSongsByEmotion)

print(f'The {n} recommended songs for {sname} are:\n')


for i in range(n):
print(f"Number {i+1}:")
print(f"{reccomendedSongsByEmotion[i][0]} with {round(reccomen
dedSongsByEmotion[i][1], 3)} similarity score with mood {reccomend
edSongsByEmotion[i][2]}")
print("--------------------")

Output for mood prediction 1(Fig 13)

55
Output for Mood Prediction 2(Fig 14)

The output reprrsents the song titles along with the similarity score which are based on
the mood of the input song given.

56
9. FUNCTIONAL REQUIREMENTS
A Functional Requirement (FR) is a description of the service that the software must
offer. It describes a software system or its component. ... It can be a calculation, data
manipulation, business process, user interaction, or any other
specific functionality which defines what function a system is likely to perform.
1. The system can add, read datasets.
2.The system performs the classifier training process and display the music
recommended from the training data
3.The system can display a set of musical records from the content, collaborative
filtering.
4.The system displays the musical records based on emotion of the user and displays
the personalized music.
5.The system can detect and displays the plagiarism in the musical records.

10. NON-FUNCTIONAL REQUIREMENTS


A non-functional requirement (NFR) is a requirement that specifies criteria that can
be used to judge the operation of a system, rather than specific behaviors. They are
contrasted with functional requirements that define specific behavior or functions.

1.The system can run in various web browser which support the system environment.
2.The system gives a fast response.
3.The system has a user-friendly interface design.
Availability: The application is available to all the intended users, all the time
based on the Network Availability.

Implementation: This System can be easily implemented and has scope for
making future changes easily, since the system is developed by using the feature of
Modularity.

57
Hardware Requirements:
1.RAM: 4GB
2.Storage: 500GB
3.CPU: 2 GHz or faster
4.Architecture: 32-bit or64-bit

Software requirements:
1.Python in Jupyter Notebook is used for data pre-processing, model training and
prediction.
2.Operating System: windows 7 and above or Linux based OS or MACOS

11.DATASET
Link:
Content:
https://raw.githubusercontent.com/sheemachinnu/music-recommendation-
system/main/song_data.csv

Collaborative:https://media.githubusercontent.com/media/sheemachinnu/music-
recommendation-system/main/10000_part1.txt

https://media.githubusercontent.com/media/sheemachinnu/music-recommendation-
system/main/10000_part1.txt

Name: Million songs dataset

58
12. CONCLUSION

The following are our conclusions based on experiment results. First, music
recommender system should consider the music genre information to increase the
quality of music recommendations. The music recommender is able to recommend the
songs based on the song features. The music Recommender is able to check plagiarism
in the dataset taken by generating the similarity score for each recommended song.
The mood of the song is predicted by examining the lyrics of the given song with all
the other songs in the dataset and predicting the mood and similarity scores and
recommending the songs based on the mood.The complex nature of the machine
learning systems like the Music Recommendation System cant have a standardized
structure because different music recommender systems work in different way. Based
on our analyses, we can suggest for future research to add other music features in order
to improve the accuracy of the recommender system, such as using tempo gram for
capturing local tempo at a certain time.

13. FUTURE WORK


In the future, we would like to try the following things:
1.Using audio signal (e.g. audio frequency) to recommend songs
2.Trying Convolutional Neural Network
3.Making the recommender system a real-time system
4.Trying clustering techniques to recommend music

59
14. REFERENCES
1. D. Arditi, Digital Subscriptions: The Unending Consumption of Music in the Digital
Era, Popular Music and Society (2017).

2.Choi K, Fazekas G, Sandler M. Automatic Tagging using Deep Convolutional


Neural Network. arXiv eprints arXiv:1606.00298. 2016.

3.Wang X, Wang Y. Improving Content-based and Hybrid Music Recommendation


using Deep Learning. In Proceedings of the 22nd ACM international conference on
Multimedia; 2014; Orlando. p. 627-636.

4.Everyone listens to music, but how we listen is changing. [online] Available at:
http://www.nielsen.com/us/en/insights/news/2015/everyone-listens-to-music-but-how-
we-listen-is-changing.html [Accessed 10 Oct. 2017].

5.Labrosa.ee.columbia.edu. (2017). Million Song Dataset | scaling MIR research.


[online] Available at: https://labrosa.ee.columbia.edu/millionsong/ [Accessed 10 Oct.
2017].

6.en.wikipedia.org. (2017). Netflix Prize. [online] Available at:


https://en.wikipedia.org/wiki/Netflix_Prize [Accessed 11 Oct. 2017].

7.Linden, G., Smith, B. and York, J. (2003). Amazon.com Recommendations Item-to-


Item Collaborative Filtering. [ebook] Available at:
https://www.cs.umd.edu/~samir/498/Amazon-Recommendations.pdf [Accessed 10
Oct. 2017].

8. Xiangnan He, Lizi Liao, Hanwang Zhang, Liqiang Nie, Xia Hu, and Tat-Seng
Chua. 2017. Neural Collaborative Filtering. In Proceedings of the 26th International
Conference on World Wide Web (WWW '17). International World Wide Web
Conferences Steering Committee, Republic and Canton of Geneva, Switzerland, 173-
182. DOI: https://doi.org/10.1145/3038912.3052569.

9. Gershman, A. and Meisels, A. (2015). A Decision Tree Based Recommender


System.[ebook] IEEE Xplore, pp.170-179. Available at:
https://subs.emis.de/LNI/Proceedings/Proceedings165/170.pdf [Accessed 9 Oct. 2017].

60
10.Min SH., Han I. (2005) Recommender Systems Using Support Vector Machines. In:
Lowe D., Gaedke M. (eds) Web Engineering. ICWE 2005. Lecture Notes in Computer
Science, vol 3579. Springer, Berlin, Heidelberg.

11.R-bloggers. (2017). Hybrid content-based and collaborative filtering


recommendations with {ordinal} logistic regression (2): Recommendation as discrete
choice. [online] Available at: https://www.r-bloggers.com/hybrid-content-based-and-
collaborative-filtering-recommendations-with-ordinal-logistic-regression-2-
recommendation-as-discrete-choice/ [Accessed 7 Oct. 2017].

12.Choi K, Fazekas G, Sandler M. Convolutional Recurrent Neural Networks For


Music Classification. 2017 IEEE International Conference on Acoustics, Speech and
Signal Processing (ICASSP). 2016.

Submitted by:

Sheema Patro P.N.V.S. Siva Dhanush G. Sai Mahesh


(317126510169) (317126510157) (317126510141)

Mr.P.Krishnanjeneyulum M.Tech,(Ph.D)
Assistant Professor
Computer Science and Engineering
ANITS

61
REFERENCE PAPER

62
A Survey of Music Recommendation Systems
and Future Perspectives

Yading Song, Simon Dixon, and Marcus Pearce ٨

Centre for Digital Music


Queen Mary University of London
{yading.song, simon.dixon, marcus.pearce}@eecs.qmul.ac.uk

Abstract. Along with the rapid expansion of digital music formats,


managing and searching for songs has become significant. Though music
information retrieval (MIR) techniques have been made successfully in
last ten years, the development of music recommender systems is still at
a very early stage. Therefore, this paper surveys a general framework and
state-of-art approaches in recommending music. Two popular algorithms:
collaborative filtering (CF) and content-based model (CBM), have been
found to perform well. Due to the relatively poor experience in finding
songs in long tail and the powerful emotional meanings in music, two
user-centric approaches: context-based model and emotion-based model,
have been paid increasing attention. In this paper, three key compo-
nents in music recommender - user modelling, item profiling, and match
algorithms are discussed. Six recommendation models and four potential
issues towards user experience, are explained. However, subjective music
recommendation system has not been fully investigated. To this end, we
propose a motivation-based model using the empirical studies of human
behaviour, sports education, music psychology.

Keywords: Music recommendation; music information retrieval; collab-


orative filtering; content-based model; emotion-based model; motivation-
based model; music psychology

1 Introduction

With the explosion of network in the past decades, internet has become the major
source of retrieving multimedia information such as video, books, and music etc.
People has considered that music is an important aspect of their lives and they
listen to music, an activity they engaged in frequently. Previous research has also
indicated that participants listened to music more often than any of the other
activities [57] (i.e. watching television, reading books, and watching movies).
Music, as a powerful communication and self-expression approach, therefore,
has appealed a wealth of research.
s
Yading is supported by the China Scholarship Council. We would like to thank
Geraint A. Wiggins for his advices.

9th International Symposium on Computer Music Modelling and Retrieval (CMMR 2012)
19-22 June 2012, Queen Mary University of London
All rights remain with the authors.
395
2 Yading Song, Simon Dixon and Marcus Pearce

However, the problem now is to organise and manage the million of music
titles produced by society [51]. MIR techniques have been developed to solve
problems such as genre classification [42, 75], artist identification [46], and in-
strument recognition [49]. Since 2005, an annual evaluation event called Music
Information Retrieval Evaluation eXchange (MIREX1) is held to facilitate the
development of MIR algorithms.
Additionally, music recommender is to help users filter and discover songs
according to their tastes. A good music recommender system should be able to
automatically detect preferences and generate playlists accordingly. Meanwhile,
the development of recommender systems provides a great opportunity for in-
dustry to aggregate the users who are interested in music. More importantly,
it raises challenges for us to better understand and model users’ preferences in
music [76].
Currently, based on users’ listening behaviour and historical ratings, collab-
orative filtering algorithm has been found to perform well [9]. Combined with
the use of content-based model, the user can get a list of similar songs by low-
level acoustic features such as rhythm, pitch or high-level features like genre,
instrument etc [7].
Some music discovery websites such as Last.fm 2, Allmusic3, Pandora4 and
Shazam 5 have successfully used these two approaches into reality. At the mean-
time, these websites provide an unique platform to retrieve rich and useful in-
formation for user studies.
Music is subjective and universal. It not only can convey emotion, but also
can it modulate a listener’s mood [23]. The tastes in music are varied from person
to person, therefore, the previous approaches cannot always meet the users’
needs. An emotion-based model and a context-based model have been proposed
[18, 34]. The former one recommends music based on mood which allows the user
to locate their expected perceived emotion on a 2D valence-arousal interface [22].
The latter one collects other contextual information such as comments, music
review, or social tags to generate the playlist. Though hybrid music recommender
systems would outperform the conventional models, the development is still at
very early stage [88]. Due to recent studies in psychology, signal processing,
machine learning and musicology, there is much room for future extension.
This paper, therefore, surveys a general music recommender framework from
user profiling, item modelling, and item-user profile matching to a series of state-
of-art approaches. Section 2 gives a brief introduction of components in music
recommendation systems and in section 3, the state-of-art recommendation tech-
niques are explained. To the end of this paper, we conclude and propose a new
model based on users’ motivation.

1 http://www.music-ir.org/mirex/wiki/MIREX HOME
2 http://www.last.fm/
3 http://www.allmusic.com/
4 http://www.pandora.com
5 http://www.shazam.com/

396
A Survey of Music Recommendation Systems 3

2 Components in Music Recommender System


Generally, a music recommender system consists of three key components - users,
items and user-item matching algorithms. User profiling (see section 2.1) ad-
dresses the variation in users’ profile. This step aims at differentiating their music
tastes using basic information. Item profiling (see section 2.2) on the contrary,
describes three different types of metadata - editorial, cultural and acoustic,
which are used in different recommendation approaches. In section 2.3, we ex-
plain the query in music recommender systems, and the matching algorithms
are presented in section 3.
2.1 User Modelling

A successful music recommender needs to meet users’ various requirements. How-


ever, obtaining user information is expensive in terms of financial costs and hu-
man labor [74]. For user-oriented design, lots of efforts on user studies need to
be investigated.
User modelling, as the one of the key elements, it models the difference
in profile. For example, the difference in geographic region or age, their music
preferences might be different. Interestingly, other factors such as gender, life
styles, and interests could also determine their choices of music.
Recent research has revealed that intelligence, personality and the users’
preference in music are linked [57]. According to Rentfrow and Gosling [26, 58]
who had investigated the relationship between music preference and Big-Five
Inventory (BFI: openness, conscientiousness, extraversion, agreeableness, and
neuroticism), their studies showed a highly extraverted person would tend to
choose the music which is energetic, while a greater preference for rhythmic and
energetic music was associated with greater extraversion and agreeableness. User
modelling, therefore, is essential in prediction of their music taste. It has been
divided into two parts: user profile modelling and user experience modelling.

First Step - User Profile Modelling Celma [14] suggested that the user
profile can be categorised into three domains: demographic, geographic, and psy-
chographic (shown in Table 1). Based on the steadiness, psychological data has
been further divided into stable attributes which are essential in making a long
term prediction and fluid attributes which can change on an hour to hour basis
[24].

Data type Example


Demographic Age, marital status, gender etc.
Geographic Location, city, country etc.
Psychographic Stable: interests, lifestyle, personality etc.
Fluid: mood, attitude, opinions etc.

Table 1. User profile classification

397
4 Yading Song, Simon Dixon and Marcus Pearce

Second Step - User Listening Experience Modelling Depending on the


level of music expertise, their expectations in music are varied accordingly. Jen-
nings [32] analysed the different types of listeners whose age range from 16-45
and categorised the listeners into four groups: savent, enthusiasts, casuals, indif-
ferents (see Table 2).

Type Percentage Features


Savants 7 Everything in life seems to be tied up with music. Their
musical knowledge is very extensive.
Enthusiasts 21 Music is a key part of life but is also balanced by other
interests.
Casuals 32 Music plays a welcome role, but other things are far more
important.
Indifferents 40 They would not lose much sleep if music ceased to exist, they
are a predominant type of listeners of the whole population.

Table 2. Use listening experience categorisation

This information gives us a good example that their expertise needs to be


considered when designing user-oriented recommendation systems. For instance,
based on their expectation, we need to consider the amount of music to be
discovered and filtered in long tail which represents interesting and unknown
music but hidden in the tail of the popularity curve [3]. Other user information
including access pattern, listening behaviour are also useful for user modelling
and dynamic optimisation [50]. Exploring user information can be either done
through the initial survey or observing their behaviour of music in long tail.

2.2 Item Profiling


The second component of recommender systems is music item. It defines a var-
ious of information that used in MIR. In 2005, Pachet [53] classified the mu-
sic metadata into three categories: editorial metadata (EM), cultural metadata
(CM), and acoustic metadata (AM).

– Editorial metadata: Metadata obtained by a single expert or group of


experts. This is obtained literally by the editor, and also it can be seen as
the information provided by them. E.g. the cover name, composer, title, or
genre etc.
– Cultural metadata: Metadata obtained from the analysis of corpora of
textual information, usually from the Internet or other public sources. This
information results from an analysis of emerging patterns, categories or as-
sociations from a source of documents. E.g. Similarity between music items.
– Acoustic metadata: Metadata obtained from an analysis of the audio sig-
nal. This should be without any reference to a textual or prescribed infor-
mation. E.g. Beat, tempo, pitch, instrument, mood etc.

398
A Survey of Music Recommendation Systems 5

Editorial metadata are mostly used in metadata information retrieval (see


section 3.1), and cultural metadata have been largely used in context-based
information retrieval (see section 3.5). However, most music recommendation
systems are using acoustic metadata for discovering music which is named as
content-based information retrieval (see section 3.3).

2.3 Query Type


Assuming that the users have already known the information about the music,
the quickest way to search for music is via key editorial information such as
title, the name of the singer and lyrics etc. However, it is not always the case
of knowing them. In the past ten years, an advanced and more flexible music
information retrieval system called “query by humming/singing system (QBSH)”
was developed [25]. It allows the user to find the songs either by humming or
singing.
Nevertheless, it still requires lots of human efforts. In recommender systems,
a more appropriate way is to use listening histories or seed music as the query
to detect their music preferences.

3 State-of-art Approaches in Music Recommendation


An ideal music recommender system should be able to automatically recommend
personalised music to human listeners [36, 52]. Different from books or movies,
the length of a piece of music is much shorter, and the times that listening their
favourite songs are normally more than once.
The existing recommender systems such as Amazon, Ebay have gained a great
success. It can recommend complementary goods, the buyer can compare the
products (new-item/old-item) and negotiate with the sellers [69]. However, music
recommender is not only giving products with reasonable price, but suggesting
them personalised music.
So far, many music discovery websites such as Last.fm, Allmusic, Pandora,
Audiobaba 6, Mog 7, Musicovery 8, Spotify9, Apple ”Genius” have aggregated mil-
lions of users, and the development is explosive [10, 11]. In this section, we present
the most popular approaches, metadata information retrieval (see section 3.1),
collaborative filtering (see section 3.2), content-based information retrieval (see
section 3.3), emotion-based model (see section 3.4), context-based information
retrieval (see section 3.5) and hybrid models (see section 3.6). At the end of each
approach, their limitations are described.

3.1 Metadata Information Retrieval (Demographic-based Model)


As the most fundamental method, it is the easiest way to search for music.
Metadata information retrieval uses textual metadata (editorial information)
6 http://audiobaba.com/
7 http://www.mog.com/
8 http://www.musicovery.com/
9 http://www.spotify.com/

399
6 Yading Song, Simon Dixon and Marcus Pearce

supplied by the creators, such as the title of the song, artist name, and lyrics to
find the target songs [20].

Limitation Though it is fast and accurate, the drawbacks are obvious. First of
all, the user has to know about the editorial information for a particular music
item. Secondly, it is also time consuming to maintain the increasing metadata.
Moreover, the recommendation results is relatively poor, since it can only rec-
ommend music based on editorial metadata and none of the users’ information
has been considered.

3.2 Collaborative Filtering

To recommend items via the choice of other similar users, collaborative filtering
technique has been proposed [28]. As one of the most successful approaches in
recommendation systems, it assumes that if user X and Y rate n items similarly
or have similar behaviour, they will rate or act on other items similarly [59].
Instead of calculating the similarity between items, a set of ‘nearest neigh-
bour’ users for each user whose past ratings have the strongest correlation are
found. Therefore, scores for the unseen items are predicted based on a com-
bination of the scores known from the nearest neighbours [65]. Collaborative
filtering is further divided into three subcategories: memory-based, model-based,
and hybrid collaborative filtering [63, 68].

Memory-based Collaborative Filtering Memory-based collaborative filter-


ing is to predict the item based on the entire collections of previous ratings.
Every user is grouped with people with similar interests, so that a new item is
produced by finding the nearest neighbour using a massive number of explicit
user votes [9].

Model-based Collaborative Filtering In contrast to memory-based CF,


model-based CF uses machine learning and data mining algorithms which al-
low the system to train and model the users’ preferences. It represents the user
preference by a set of rating scores and constructs a special prediction model [2].
Based on the known model, the system makes prediction for test and real-world
data.

Hybrid Collaborative Filtering Hybrid CF model is to make prediction


by combining different CF models. It has been proved that hybrid CF model
outperforms any individual method [83].

Limitations Because of the subjectivity in music, the assumption that users


with similar behaviours may have same tastes has not been widely studied.
Though collaborative filtering recommender works well, the key problems such
as cold start, popularity bias are unavoidable [27].

400
A Survey of Music Recommendation Systems 7

– Popularity bias Generally, popular music can get more ratings. The music
in long tail, however, can rarely get any. As a result, collaborative filtering
mainly recommend the popular music to the listeners. Though giving pop-
ular items are reliable, it is still risky, since the user rarely get pleasantly
surprised.
– Cold start It is also known as data sparsity problems. At an early stage,
few ratings is provided. Due to the lack of these ratings, prediction results
are poor.
– Human effort A perfect recommender system should not involve too much
human efforts, since the users are not always willing to rate. The ratings
may also grow towards those who do rate, but it may not be representative.
Because of this absence of even distributed ratings, it can either give us false
negative or false positive results.

3.3 Content/Audio/Signal-based Music Information Retrieval


Different from collaborative filtering technique, content-based approach makes
prediction by analysing the song tracks [2, 41]. It is rooted in information re-
trieval and information filtering [13] that recommends a song which is similar
to those the user has listened to in the past rather than what the user have
rated ‘like’ [4, 43]. Lots of research have been paid attention on extracting and
comparing the acoustic features in finding perceptual similar tracks [8, 45]. The
most representative ones so far are timbre, rhythm [7, 10, 11].
Based on the extracted features, the distance between songs are measured
[43]. Three typical similarity measurements are listed below [44].

– K-means clustering with Earth-Mover’s Distance: It computes a gen-


eral distance between Gaussian Mixture Models (GMM) by combining indi-
vidual distance between gaussian components [62].
– Expectation-Maximization with Monte Carlo Sampling: This mea-
surement makes use of vectors sampled directly from the GMMs of the two
songs to be compared; the sampling is performed computationally via ran-
dom number generation [51].
– Average Feature Vectors with Euclidean Distance: It calculates low-
order statistics such as mean and variance over segments [16].

Query by Humming (QBSH) Humming and singing are the natural way to
express the songs [31]. In the early 1990s, based on content-based model, query
by humming system was proposed [25, 80]. Early query by humming systems
were using melodic contour which had been seen as the most discriminative
features in songs.
It follows three steps: construction of the songs database, transcription of
the users’ melodic information query and pattern matching algorithms which
are used to get the closest results from collections [1]. In the past few years,
except melody, a better performance has also been achieved by embedding with
lyrics and enhancing the main voice [19, 77].

401
8 Yading Song, Simon Dixon and Marcus Pearce

Limitations To some extent, content-based model solves the problems in col-


laborative filtering. For instance, by measuring the similarity of acoustic features
between songs, the system can recommend music using distance measurements.
Therefore, no human rating is needed. However, similarity-based method has
not been fully investigated in terms of listeners’ preference. None of the research
proved that similar behaviour leads to the choice of same music.
Since content-based model largely depends on acoustic features, the number
of selected features needs to be further considered. Moreover, other user infor-
mation and non-acoustic information should be included for future modification
and augmentation.

3.4 Emotion-based Model

Music as a self-expression tool, it always performs with affection. Rich in content


and expressivity [86], the conventional approaches for music information retrieval
are no longer sufficient. Music emotion has appealed lots of research and it has
become the main trend for music discovery and recommendation [34]. A com-
mercial web service called ‘Musicovery ’ uses the fundamental emotion model (2D
valence-arousal) found by psychologists. It allows users to locate their expected
perceived emotion in a 2D space: valence (how positive or negative) and arousal
(how exciting or calming).
Similar to content-based model, the emotion perception is associated with
different patterns of acoustic cues [6, 35, 48, 61]. Different perceptual features
such as energy, rhythm, temporal, spectral, and harmony have been widely used
in emotion recognition [84].

Limitations

– Data collection In order to accurately model the system, a great amount of


dataset are needed. However, finding the reliable ground truth is expensive
and requires a lot of human efforts [67]. Instead of human annotation [73],
social tags [36, 74], annotation games like MajorMiner [47] and TagATune
[37], lyrics or music review are being used for data collection.
– Ambiguity and granularity Emotion itself is hard to define and describe.
The same affective feeling experienced by different people may give different
emotion expression (i.e. cheerful, happy) and there is no perfect relationship
between affective terms with emotions [64, 85]. Some research were based on
basic taxonomy (sad, happy, angry etc.), but it cannot describe the richness
of our human perception. MIREX evaluation has categorised emotion into
5 mood clusters [29] (see Table 3). Russell [60] found a circumflex model
which affective concepts fall in a circle in the following order: pleasure (0°),
excitement (45°), arousal (90°), distress (135°), displeasure (180°), depression
(225°), sleepiness (270°), and relaxation (315°). It can represent the struc-
ture of affective experience and now it has been become the most noted 2D
valence-arousal emotion model. The problem of classifying emotion, there-
fore has been solved, since each point on the plane represents an affective
term.

402
A Survey of Music Recommendation Systems 9

Cluster 1 Passionate, rousing, confident, boisterous, rowdy


Cluster 2 Rollicking, cheerful, fun, sweet, amiable/good natured
Cluster 3 Literate, poignant, wistful, bittersweet, autumnal, brooding
Cluster 4 Humorous, silly, campy, quirky, whimsical, witty, wry
Cluster 5 Aggressive, fiery, tense/anxious, intense, volatile, visceral

Table 3. MIREX five mood categories

3.5 Context-based Information Retrieval

Rather than using acoustic features in content-based model and ratings in col-
laborative filtering, context-based information retrieval model uses the public
opinion to discover and recommend music [18]. Along with the development of
social networks such as Facebook 10, Youtube11, and Twitter 12, these websites
provide us rich human knowledge such as comments, music review, tags and
friendship networks [36].
Context-based information retrieval, therefore, uses web/document mining
techniques to filter out important information to support problems like artist
similarity, genre classification, emotion detection [82], semantic space [39, 40]
etc. Some researchers have suggested that the use of social information has out-
performed content-based model [70, 81].
However, the same problems as collaborative filtering, the popular music can
always get more public opinions than those in long tail [21]. Eventually, rich
music gets richer feedback, it again results in a popularity bias problem.

3.6 Hybrid Model Information Retrieval

Hybrid model aims at combining two or more models to increase the overall per-
formance. Burke [9] pointed out several methods to build a hybrid model such as
weighted, switching, mixed, feature combination, and cascade. There is no doubt
that a proper hybrid model would outperform a single approach, since it can
incorporate the advantages of both methods while inheriting the disadvantages
of neither [65, 87, 88].

3.7 Other Issues

We have discussed above the essential problems in music recommender systems,


the other issues such as dynamic evolvement, playlist generation, user interface
design and evaluation need to be further considered. Though it doesn’t affect the
recommendation performance, it certainly influence the user listening experience.
10 https://www.facebook.com/
11 http://www.youtube.com/
12 https://twitter.com/

403
10 Yading Song, Simon Dixon and Marcus Pearce

Dynamic Evolvement As the users aggregate in the recommender systems, it


needs to be able to adapt to new data such as user listening histories and listening
behaviour to further personalised their music taste [30]. This procedure is called
evolvement. It addresses the problem that when the new user comes and new
items into the system, it can dynamically and automatically evolve itself [65].

Playlist Generation Another issue is the sequence of the playlist [38]. Most
of the recommender systems are not flexible, because the playlist is ordered by
the similarity distance between seed songs. Though the most similar songs are
given in order, the theme and mood can be dramatically changed in between.
This may result in the dissatisfaction and discontinuation of the songs.
Research indicates that a playlist should have a main theme (mood, event,
activity) evolve with time [17]. Rather than randomly shuffling, human skipping
behaviour can be considered for dynamic playlist generation [15, 54]. For exam-
ple, assuming that the users dislike the song when they skipped it, the system
therefore, removes the songs which are similar to the song which they skipped
[55, 56, 78].

User Interface Design A bad design of user interface cannot affect the accu-
racy of the system, it does influence the ratings and listening experience. A clear
design always gives the user a better understanding of the system. Moreover,
an overall control of the system and less human efforts required for operation
should be considered during designing.

Evaluation There is no common objective evaluation in music recommendation


systems [72]. Most of the evaluation techniques are based on subjective system
testing which let users to rank the systems given the playlist generated by dif-
ferent approaches [5, 79]. However, it is very expensive in terms of financial costs
and human labor. Another important factor is that the evaluation in different
regions (i.e. different background, age, language) might give different results.
Hence, a proper evaluation criteria is essential and highly recommended.

4 Conclusion and Future Work


In this paper, we explain a basic metadata-based model and two popular mu-
sic recommender approaches: collaborative filtering and content-based model.
Though they have achieved great success, their drawbacks such as popularity
bias and human efforts are obvious. Moreover, the use of hybrid model would
outperform a single model since it incorporates the advantages of both methods.
Its complexity is not fully studied yet.
Due to the subjective nature in music and the issues existing in the previous
methods, two human-centred approaches are proposed. By considering affective
and social information, emotion-based model and context-based model largely
improved the quality of recommendation. However, this research is still at an
early stage.

404
A Survey of Music Recommendation Systems 11

As we can see from the development of music recommenders over the past
years, the given results tend to be more personalised and subjective. Only consid-
ering the music itself and human ratings are no longer sufficient. A great amount
of work in recent years have been done in music perception, psychology, neuro-
science and sport which study the relationship between music and the impact
of human behaviour. David Huron also mentioned music has sex and drug-like
qualities. Undoubtably, music always has been an important component of our
life, and now we have greater access to it.
Researches in psychology pointed out that music not only improves mood,
increases activation, visual and auditory imagery, but also recalls of associated
films or music videos and relieves stress [33]. Moreover, the empirical exper-
iments in sport mentioned that the main benefits for listening to the music
which include work output extension, performance enhancement, and dissoci-
ation from unpleasant feelings etc [71]. For example, athletes prefer uptempo,
conventional, intense, rebellious, energetic, and rhythmic music rather than re-
flective and complex music [66]. An important fact found by psychologists is that
users’ preference in music is linked to their personality. Also worth mentioning
that fast, upbeat music produces a stimulative effect whereas slow, while soft
music produces a sedative effects [12]. All of these highlight that music recom-
mender is not only a tool for relaxing, but also acts as an effective tool to meet
our needs under different contexts. To our knowledge, there is few research based
on these empirical results.
Designing a personalised music recommender is complicated, and it is chal-
lenging to thoroughly understand the users’ needs and meet their requirements.
As discussed above, the future research direction will be mainly focused on user-
centric music recommender systems. A survey among athletes showed practition-
ers in sport and exercise environments tend to select music in a rather arbitrary
manner without full consideration of its motivational characteristics. Therefore,
future music recommender should be able to lead the users reasonably choose
music. To the end, we are hoping that through this study we can build the bridge
among isolated research in all the other disciplines.

Acknowledgments. Yading is supported by the China Scholarship Council.


We would like to thank Geraint A. Wiggins, Steven Hargreaves and Emmanouil
Benetos for their advices.

References
1. Ricardo A. Baeza-Yates and Chris H. Perleberg. Fast and Practical Approximate
String Matching. In Combinatorial Pattern Matching, Third Annual Symposium,
pages 185–192, 1992.
2. G. Adomavicius and A. Tuzhilin. Toward the Next Generation of Recommender
Systems: A Survey of the State-of-the-art and Possible Extensions. IEEE Trans-
actions on Knowledge and Data Engineering, 17(6):734–749, June 2005.
3. C Anderson. The Long Tail. Why the Future of Business is selling less of more.
Hyperion Verlag, 2006.

405
12 Yading Song, Simon Dixon and Marcus Pearce

4. Jean-julien Aucouturier and Francois Pachet. Music Similarity Measures: What is


the Use. In Proceedings of the ISMIR, pages 157–163, 2002.
5. Luke Barrington, Reid Oda, and G. Lanckriet. Smarter Than Genius? Human
Evaluation of Music Recommender Systems. In 10th International Society for
Music Information Retrieval Conference, number ISMIR, pages 357–362, 2009.
6. Kerstin Bischoff, Claudiu S Firan, Raluca Paiu, Wolfgang Nejdl, L S De, Cyril
Laurier, and Mohamed Sordo. Music Mood and Theme Classification - A Hybrid
Approach. In 10th International Society for Music Information Retrieval Confer-
ence, number Ismir, pages 657–662, 2009.
7. Dmitry Bogdanov and Perfecto Herrera. How Much Metadata Do We Need in
Music Recommnendation? A Subjective Evaluation Using Preference Sets. In 12th
International Society for Music Information Retrieval Conference, number ISMIR
2011, pages 97–102, 2011.
8. Dmitry Bogdanov, J. Serra, Nicolas Wack, Perfecto Herrera, and Xavier Serra.
Unifying Low-level and High-level Music Similarity Measures. IEEE Transactions
on Multimedia, 13(99):1–1, 2011.
9. Robin Burke. Hybrid Recommender Systems: Survey and Experiments. User
Modeling and User-Adapted Interaction, 12(4):331–370, 2002.
10. Pedro Cano, Markus Koppenberger, and Nicolas Wack. An Industrial-strength
Content-based Music Recommendation System. In Proceedings of the 28th annual
international ACM SIGIR conference on Research and development in information
retrieval - SIGIR ’05, page 673, New York, New York, USA, 2005. ACM Press.
11. Pedro Cano, Markus Koppenberger, and Nicolas Wack. Content-based Music Au-
dio Recommendation. In Proceedings of the 13th annual ACM international con-
ference on Multimedia, number ACM, pages 211–212, 2005.
12. FRD Carpentier. Effects of Music on Physological Arousal, Exploration into Tempo
and Genre. Media Psychology, 10(3):339–363, 2007.
13. M.A. Casey, Remco Veltkamp, Masataka Goto, Marc Leman, Christophe Rhodes,
and Malcolm Slaney. Content-based Music Information Retrieval: Current Direc-
tions and Future Challenges. Proceedings of the IEEE, 96(4):668–696, 2008.
14. O. Celma Herrada. Music Recommendation and Discovery in the Long Tail. PhD
Thesis, 2009.
15. Zeina Chedrawy and S. Abidi. A Web Recommender System for Recommend-
ing, Predicting and Personalizing Music Playlists. In Web Information Systems
Engineering-WISE 2009, pages 335–342. Springer, 2009.
16. Parag Chordia, Mark Godfrey, and Alex Rae. Extending Content-Based Recom-
mendation: The Case of Indian Classical Music. In ISMIR 2008: proceedings of
the 9th International Conference of Music Information Retrieval, pages 571–576,
2008.
17. Sally Jo Cunningham, David Bainbridge, and Annette Falconer. More of an
Art than a Science : Supporting the Creation of Playlists and Mixes. In Seventh
International Conference on Music Information Retrieval, Victoria, Canada, 2006.
18. M. Datcu, H. Daschiel, A. Pelizzari, M. Quartulli, A. Galoppo, A. Colapicchioni,
M. Pastori, K. Seidel, P.G. Marchetti, and S. D’Elia. Music Recommendation
Using Content and Context Information Mining. Geoscience and Remote Sensing,
IEEE Transactions on, 41(12):2923–2936, 2003.
19. C. de la Bandera, A.M. Barbancho, L.J. Tardón, Simone Sammartino, and Isabel
Barbancho. Humming Method for Content-Based Music Information Retrieval.
ISMIR 2011, (Ismir):49–54, 2011.
20. J. Stephen Downie. Music Information Retrieval. Annual Review of Information
Science and Technology, 37(1):295–340, January 2005.

406
A Survey of Music Recommendation Systems 13

21. Douglas Eck, Paul Lamere, T. Bertin-Mahieux, and Stephen Green. Automatic
Generation of Social Tags for Music Recommendation. Advances in neural infor-
mation processing systems, 20:385–392, 2007.
22. T. Eerola and J. K. Vuoskoski. A Comparison of the Discrete and Dimensional
Models of Emotion in Music. Psychology of Music, 39(1):18–49, August 2010.
23. Yazhong Feng and Y Zhuang. Popular Music Retrieval by Detecting Mood. In
International Society for Music Information Retrieval 2003, volume 2, pages 375–
376, 2003.
24. Alan Page Fiske, Shinobu Kitayama, Hazel Rose Markus, and R E Nisbett. The
Cultural Matrix of Social Psychology. 1998.
25. Asif Ghias, Jonathan Logan, David Chamberlin, and Brian C. Smith. Query by
Humming. Proceedings of the third ACM international conference on Multimedia
- MULTIMEDIA ’95, pages 231–236, 1995.
26. S Gosling. A Very Brief Measure of the Big-Five Personality Domains. Journal of
Research in Personality, 37(6):504–528, December 2003.
27. Jonathan L. Herlocker, Joseph a. Konstan, Loren G. Terveen, and John T. Riedl.
Evaluating Collaborative Filtering Recommender Systems. ACM Transactions on
Information Systems, 22(1):5–53, January 2004.
28. Will Hill, Larry Stead, Mark Rosenstein, George Furnas, and South Street. Rec-
ommending and Evaluating Choices in a Vitual Community of Use. Mosaic A
Journal For The Interdisciplinary Study Of Literature, pages 5–12, 1995.
29. X Hu and J. Stephen Downie. Exploring Mood Metadata: Relationships with
Genre, Artist and Usage Metadata. In 8th International Conference on Music
Information Retrieval, 2007.
30. Yajie Hu and Mitsunori Ogihara. Nextone Player: A Music Recommendation Sys-
tem Based on User Behavior. In 12th International Society for Music Information
Retrieval Conferenceh, number Ismir, pages 103–108, 2011.
31. Jyh-Shing Roger Jang and Hong-Ru Lee. A General Framework of Progressive
Filtering and Its Application to Query by Singing/Humming. IEEE Transactions
on Audio, Speech, and Language Processing, 16(2):350–358, February 2008.
32. D Jennings. Net, Blogs and Rock ’n’ Rolls: How Digital Discovery Works and What
It Means for Consumers. 2007.
33. Patrik N Juslin and Daniel Vastfjäll. Emotional Responses to Music: the Need to
Consider Underlying Mechanisms. The Behavioral and brain sciences, 31(5):559–
621, October 2008.
34. Y.E. Kim, E.M. Schmidt, Raymond Migneco, B.G. Morton, Patrick Richardson,
Jeffrey Scott, J.A. Speck, and Douglas Turnbull. Music Emotion Recognition: A
State of the Art Review. In Proc. of the 11th Intl. Society for Music Information
Retrieval (ISMIR) Conf, number Ismir, pages 255–266, 2010.
35. Fang-Fei Kuo, Meng-Fen Chiang, Man-Kwan Shan, and Suh-Yin Lee. Emotion-
based Music Recommendation by Association Discovery from Film Music. In Pro-
ceedings of the 13th annual ACM international conference on Multimedia - MUL-
TIMEDIA ’05, page 507, New York, New York, USA, 2005. ACM Press.
36. Paul Lamere. Social Tagging and Music Information Retrieval. Journal of New
Music Research, 37(2):101–114, June 2008.
37. Edith L. M. Law, Luis Von Ahn, Roger B. Dannenberg, and Mike Crawford.
Tagatune: A Game for Music and Sound Annotation. In 8th International Con-
ference on Music Information Retrieval, 2007.
38. Jin Ha Lee, Bobby Bare, and Gary Meek. How Similar is too Similar? Exploring
Users’ Perception of Similarity in Playlist Evaluation. In International Conference
on Music Information Retrieval 2011, number ISMIR, pages 109–114, 2011.

407
14 Yading Song, Simon Dixon and Marcus Pearce

39. Mark Levy. A Semantic Space for Music Derived from Social Tags. Austrian
Compuer Society, 1:12, 2007.
40. Mark Levy and Mark Sandler. Music Information Retrieval Using Social Tags and
Audio. IEEE Transactions on Multimedia, 11(3):383–395, 2009.
41. Qing Li, Byeong Man Kim, Dong Hai Guan, and Duk Oh. A Music Recommender
Based on Audio Features. In Proceedings of the 27th annual international ACM
SIGIR conference on Research and development in information retrieval, pages
532–533, Sheffield, United Kingdom, 2004. ACM.
42. Bass Lines, Emiru Tsunoo, George Tzanetakis, and Nobutaka Ono. Beyond Tim-
bral Statistics : Improving Music Classification Using Percussive. IEEE Transac-
tions on Audio, Speech and Language Processing, 19(4):1003–1014, 2011.
43. Beth Logan. Music Recommendation from Song Sets. In International Conference
on Music Information Retrieval 2004, number October, pages 10–14, Barcelona,
Spain, 2004.
44. Terence Magno and Carl Sable. A Comparison of Signal of Signal-Based Music
Recommendation to Genre Labels, Collaborative Filtering, Musicological Analysis,
Human Recommendation and Random Baseline. In ISMIR 2008: proceedings of
the 9th International Conference of Music Information Retrieval, pages 161–166,
2008.
45. Chun-man Mak, Tan Lee, Suman Senapati, Yu-ting Yeung, and Wang-kong Lam.
Similarity Measures for Chinese Pop Music Based on Low-level Audio Signal At-
tributes. In 11th International Society for Music Information Retrieval Conference,
number ISMIR, pages 513–518, 2010.
46. M Mandel. Song-level Features and Support Vector Machines for Music Classifi-
cation. In Proc. International Conference on Music, 2005.
47. MI Mandel. A Web-based Game for Collecting Music Metadata. In In 8th Inter-
national Conference on Music Information Retrieval (ISMIR), 2008.
48. M Mann, TJ Cox, and FF Li. Music Mood Classification of Television Theme
Tunes. In 12th International Society for Music Information Retrieval Conference,
number Ismir, pages 735–740, 2011.
49. Janet Marques and Pedro J Moreno. A Study of Musical Instrument Classification
Using Gaussian Mixture Models and Support Vector Machines, 1999.
50. M. Ogihara, Bo Shao, Dingding Wang, and Tao Li. Music Recommendation Based
on Acoustic Features and User Access Patterns. IEEE Transactions on Audio,
Speech, and Language Processing, 17(8):1602–1611, November 2009.
51. F. Pachet and J.J. Aucouturier. Improving Timbre Similarity: How High is the
Sky? Journal of negative results in speech and audio sciences, 1(1):1–13, 2004.
52. François Pachet and Daniel Cazaly. A Taxonomy of Musical Genres. In Content-
Based Multimedia Information Retrieval Access Conference (RIAO), number April,
2000.
53. Francois Pachet. Knowledge Management and Musical Metadata. In Encyclopedia
of Knowledge Management. 2005.
54. Elias Pampalk, Tim Pohle, and Gerhard Widmer. Dynamic Playlist Generation
Based on Skipping Behavior. In Proc. of the 6th ISMIR Conference, volume 2,
pages 634–637, 2005.
55. Steffen Pauws, Berry Eggen, and Miles Davis. PATS : Realization and User Evalu-
ation of an Automatic Playlist Generator PATS : Realization and User Evaluation
of an Automatic Playlist Generator. In 3rd International Conference on Music
Information Retrieval, 2002.
56. CBE Plaza. Uncovering Affinity of Artist to Multiple Genres from Social Behavior
Data. In ISMIR 2008: proceedings of the 9th, pages 275–280, 2008.

408
A Survey of Music Recommendation Systems 15

57. Peter J. Rentfrow and Samuel D. Gosling. The Do Re Mi’s of Everyday Life: The
structure and personality correlates of music preferences. Journal of Personality
and Social Psychology, 84(6):1236–1256, 2003.
58. Peter J Rentfrow and Samuel D Gosling. Message in a Ballad: the Role of Mu-
sic Preferences in Interpersonal Perception. Psychological science, 17(3):236–42,
March 2006.
59. Paul Resnick, Hal R Varian, and Guest Editors. Recommender Systems. Commu-
nications of the ACM, 40(3):56–58, 1997.
60. J.A. Russell. A Circumplex Model of Affect. Journal of personality and social
psychology, 39(6):1161–1178, 1980.
61. Pasi Saari, Tuomas Eerola, and Olivier Lartillot. Generalizability and Simplicity as
Criteria in Feature Selection: Application to Mood Classification in Music. Audio,
Speech, and Language Processing, IEEE Transactions on, 19(99):1–1, 2011.
62. A Salomon. A Content-based Music Similarity Function. In Cambridge Research
Labs-Tech Report, number June, 2001.
63. Badrul Sarwar, George Karypis, and Joseph Konstan. Item-based Collaborative
Filtering Recommendation Algorithms. Proceedings of the 10th, pages 285–295,
2001.
64. Bo Shao, Tao Li, and M. Ogihara. Quantify Music Artist Similarity Based on
Style and Mood. In Proceeding of the 10th ACM workshop on Web Information
and Data Management, pages 119–124. ACM, 2008.
65. Yoav Shoham and Marko Balabannovic. Content-Based, Collaborative Recom-
mendation. Communications of the ACM, 40(3):66–72, 1997.
66. Stuart D Simpson and Costas I Karageorghis. The Effects of Synchronous Music on
400-m Sprint Performance. Journal of sports sciences, 24(10):1095–102, October
2006.
67. Janto Skowronek and M McKinney. Ground Truth for Automatic Music Mood
Classification. In Proc. ISMIR, pages 4–5, 2006.
68. Xiaoyuan Su and Taghi M. Khoshgoftaar. A Survey of Collaborative Filtering
Techniques. Advances in Artificial Intelligence, 2009(Section 3):1–19, 2009.
69. Neel Sundaresan. Recommender Systems at the Long Tail. In of the fifth ACM
conference on Recommender systems, number RecSys 2011, pages 1–5, 2011.
70. Panagiotis Symeonidis, Maria Ruxanda, Alexandros Nanopoulos, and Yannis
Manolopoulos. Ternary Semantic Analysis of Social Tags for Personalized Mu-
sic Recommendation. In Proc. 9th ISMIR Conf, pages 219–224. Citeseer, 2008.
71. P.C. Terry and C.I. Karageorghis. Psychophysical Effects of Music in Sport and
Exercise: An Update on Theory, Research and Application. In Proceedings of
the 2006 Joint Conference of the Australian Psychological Society and the New
Zealand Psychological Society: Psychology Bridging the Tasman: Science, Culture
and Practice, pages 415–419. Australian Psychological Society, 2006.
72. Nava Tintarev and Judith Masthoff. Effective Explanations of Eecommendations:
User-centered Design. In Proceedings of the 2007 ACM conference on Recommender
systems, pages 153–156. ACM, 2007.
73. KTG Tsoumakas and George Kalliris. Multi-Label Classification of Music into
Emotions. In ISMIR 2008: proceedings of the 9th International Conference of
Music Information Retrieval, pages 325–330, 2008.
74. Douglas Turnbull, Luke Barrington, and Gert Lanckriet. Five Approaches to Col-
lecting Tags for Music. In ISMIR 2008: proceedings of the 9th International Con-
ference of Music Information Retrieval, pages 225–230, 2008.

409
16 Yading Song, Simon Dixon and Marcus Pearce

75. George Tzanetakis, Student Member, and Perry Cook. Musical Genre Classifi-
cation of Audio Signals. IEEE Transactions on Speech and Audio Processing,
10(5):293–302, 2002.
76. Alexandra Uitdenbogerd and van Schyndel Ron. A Review of Factors Affecting
Music Recommender. In 3rd International Conference on Music Information Re-
trieval (2002), 2002.
77. Erdem Unal, Elaine Chew, Panayiotis G. Georgiou, and Shrikanth S. Narayanan.
Challenging Uncertainty in Query by Humming Systems: A Fingerprinting Ap-
proach. IEEE Transactions on Audio, Speech, and Language Processing, 16(2):359–
371, February 2008.
78. Rob van Gulik and Fabio Vignoli. Visual Playlist Generation on the Artist Map. In
5th International Conference on Music Infomation Retrieval, number ISMIR2005,
pages 520–523, 2005.
79. Fabio Vignoli. A Music Retrieval System Based on User-driven Similarity and
its Evaluation. In International Conference on Music Information Retrieval 2005,
2005.
80. C.C. Wang, J.S.R. Jang, and Wennen Wang. An Improved Query by
Singing/Humming System Using Melody and Lyrics Information. In 11th Inter-
national Society for Music Information Retrieval Conference, number Ismir, pages
45–50, 2010.
81. Dingding Wang, Tao Li, and Mitsunori Ogihara. Tags Better Than Audio Features?
The Effect of Joint use of Tags and Audio Content Features for Artistic Style Clu-
tering. In International Conference on Music Information Retrieval 2010, number
ISMIR, pages 57–62, 2010.
82. Ju-chiang Wang, Hung-shin Lee, Hsin-min Wang, and Shyh-kang Jeng. Learning
the Similarity of Audio Msuic in Bag-of-Frames Representation from Tagged Music
Data. In International Conference on Music Information Retrieval 2011, number
ISMIR, pages 85–90, 2011.
83. Jun Wang, A.P. De Vries, and M.J.T. Reinders. Unifying User-based and Item-
based Collaborative Filtering Approaches by Similarity Fusion Categories. In Pro-
ceedings of the 29th annual international ACM SIGIR conference on Research and
development in information retrieval, pages 501–508. ACM, 2006.
84. Xing Wang, Xiaoou Chen, Deshun Yang, and Yuqian Wu. Music Emotion Clas-
sification of Chinese Songs Based on Lyrics using TF*IDF and Rhyme. In 12th
International Society for Music Information Retrieval Conference, number Ismir,
pages 765–770, 2011.
85. Dan Yang and W.S. Lee. Disambiguating Music Emotion Using Software Agents.
In Proceedings of the 5th International Conference on Music Information Retrieval
(ISMIR04), pages 52–58, 2004.
86. Yi-Hsuan Yang. Music Emotion Recognition. Tayler and Francis Group, 2011.
87. Kazuyoshi Yoshii, Masataka Goto, Kazunori Komatani, Tetsuya Ogata, and Hi-
roshi G Okuno. Hybrid Collaborative and Content-based Music Recommendation
Using Probabilistic Model with Latent User Preferences. In Proceedings of the 7th
International Conference on Music Information Retrieval, pages 296–301, 2006.
88. Kazuyoshi Yoshii, Masataka Goto, Kazunori Komatani, Tetsuya Ogata, and Hi-
roshi G Okuno. Improving Efficiency and Scalability of Model-Based Music Rec-
ommender System Based on Incremental Training. In ISMIR 2007: proceedings of
the 8th International Conference of Music Information Retrieval, number ISMIR,
2007.

410
PAPER PUBLICATION
International Journal of Management, Technology And Engineering ISSN NO : 2249-7455
MUSIC RECOMMENDATION SYSTEM WITH
PLAGIARISM DETECTION
Mr. P. Krishnanjaneyulu1, Sheema Patro2, V. Jahnavi2, P. N. V. S Dhanush2, G. Mahesh2

1
Assistant Professor at Department of CSE, Anil Neerukonda Institute of Technology and Sciences (A), Visakhapatnam-531162, India
2
Final year students of Department of CSE, Anil Neerukonda Institute of Technology and Sciences (A), Visakhapatnam-531162, India

Abstract— In this paper, we present a personalized music recommendation system based on the KNN and machine learning algorithms. In
personalized music recommendation system, we propose a collaborative filtering and content filtering recommendation algorithm here we
use log file which stores the recommendations to user . The proposed system contains the log files which stores the previous history of
playlist of music by the user. Here in this paper we extracts data of the users access files from the history of logs and recommend them.
Content-based methods gives recommendations based on the similarity of two song contents or attributes while here we implement the
matrix of different songs and perform the collaborative filtering methods on different songs for recommendation system The plagiarism
system extracts the music from input and finds music that are close to the query music which the query has plagiarized. We use the million
song dataset to evaluate the personalized music recommendation system. The data cleaning is done by the data science algorithms. The
plagiarism detection is done by finding the similar music genre which minimizes the issue of copyrights.

Index Terms— collaborative filtering algorithm. KNN, cosine similarity, tf-idf, CSR Matrix

Introduction They keep the user engaged by providing fascinating music


in the form of suggestions, minimizing the number of
With the growth of the internet in recent decades, it has
options available to the user. They allow for the
become the primary source for retrieving multimedia
investigation and discovery of music that the user might not
material such as video, literature, and music, among other
be aware of. There is never a lack of enjoyment because it is
things. People regard music to be a significant part of their
a music recommender.
lives, and they listen to it on a regular basis. The issue now
is how to organize and manage the millions of music titles
that society produces. A smart music recommendation
2. Related Work
system should be able to detect preferences automatically
and produce playlists based on them. The suggested Existing collaborative filtering algorithms-based
technique uses music to detect plagiarism in music similarity. recommender systems have had a lot of success. Netflix held
a competition for the best collaborative filtering algorithm
The plagiarism algorithm takes music from input and
[3], and the algorithm, here it implements latent factor
discovers music that is similar to the query music that has
models, which is improved by 8.1 percent. Amazon employs
been plagiarised by the query. Meanwhile, the advent of
user-to-user and item-to-item collaborative filtering [4],
recommender systems gives the music industry a fantastic
which is critical to the company's success. A fresh neural
opportunity to gather users who are interested in music.
network-based algorithm, neural collaborative filtering (He
Using KNN and Machine Learning, we need to create the
2017) [5, has just been proposed. Many academics have
finest music recommendation system that can forecast
proposed several methods employing Machine Learning
depending on customization.
techniques for content-based algorithms, such as Decision
The collaborative filtering algorithm has been confirmed to Tree Algorithm based was implemented here for the
function well based on user listening behavior and historical recommendation system [6], the algorithms like SVM was
ratings. The Music Information Retrieval Evaluation used in this paper [7], and even logistic regression [8]. To
Exchange (MIREX) has been organized annually since 2005 construct these algorithms, we may fully utilize the
to aid in the development of MIR algorithms. Similarity knowledge we gained in class. While the music
between songs is assessed in the content-based method, and recommendation system resembles existing commercial
songs are recommended based on the similarity score. recommendation systems in certain ways, it concentrates on
Plagiarism here we can use content based filtering offering good and individualized music advise rather than
techniques; plagiarism can be recognized based on similarity. things for users to purchase. The ideal music
Score. recommendation system would be able to make
individualized music recommendations to human listeners
We may quickly propose music to users based on their
automatically. The length of a piece of music is significantly
interests and moods using mood prediction. The mood can
less than that of a book or a movie, and people usually listen
be predicted in a variety of methods, including using lyrics,
to the songs they like more and more times which is a
face expression detection, and so on. In this case, we utilized
challenging task in implementation of the recommendation
lyrics-based mood prediction, which calculates the similarity
system
score and recommends music.

3 Proposed Work
Music recommendation systems are a two-edged sword.
They are advantageous to both the user and the provider. 1. Collaborative Filtering

Volume XI, Issue VI, JUNE/2021 Page No: 99


International Journal of Management, Technology And Engineering ISSN NO : 2249-7455

2. Plagiarism and content-based module pattern is known as fuzzywuzzy. The difference between
sequences is calculated using Levenshtein distance. It
3. Mood Prediction
compares the two strings and returns a similarity index. If
Algorithm: Collaborative filtering we provide an incorrect song, it compares it to other songs,
determines the similarity using the fuzzy matching function,
calculates the ratio, and uses the song with the highest ratio
3.1 KNN as the input song.
The goal of this method is to develop a function that can
predict whether or not a user would profit from an item —
3.8 Plagiarism:
in this case, whether or not the user would listen to a music.
This can be accomplished through the use of ratings. User 3.8.1 Cosine similarity (Content-Based Model)
ratings can be collected in two ways: explicitly and
The following two phases must be completed by a content-
implicitly. The K-Nearest Neighbors Algorithm was utilized.
based recommendation system. To begin, extract features
from the song descriptions' content to generate an object
representation. Second, create a similarity function among
3.2 Explicit Rating: these object representations that resembles the item-item
This means we explicitly ask the user to give a rating. This similarity that humans recognize. Because we're dealing
represents the most direct feedback from users to show how with text and words, we may use Term Frequency-Inverse
much they like a song. Document Frequency (TF-IDF) to match them.

3.3 Implicit Rating: 3.8.2 TF-IDF


We examine whether or not a user listened to a song, for It is a methodology for retrieving information that considers
how long or how many times, which may suggest that the terms frequency (TF) and inverse document frequency
he/she liked that particular song. (IDF). The TF*IDF weight of a phrase is defined as the
product of these scores. The TF-Idf score indicates how
uncommon a phrase is in a given document, and vice versa.
3.4 Interaction matrices We'll use cosine similarity, namely its implementation in
Scikit-learn, for our song recommendation engine. We want
These are based on the many entries that include a user-song to see how similar each item is to every other item in the
pair as well as a value that represents the user’s rating for collection using cosine similarity. As a result, we just supply
that song. the lyrics matrix as an argument. Once we get thesimilarities,
we'll save the names of the 50 most similar songs for each
song in our dataset in a dictionary named similarities.
3.5 KNN:
The metric of cosine similarity is used to determine how
K - Nearest Neighbors (KNN) is considered the standard similar two objects are. It estimates the cosine of the angle
method when it comes to both user-based and item-based formed by two vectors projected onto a multi-dimensional
collaborative filtering approaches. The KNN algorithm is a space mathematically. The output value is between 0 and 1.
supervised non-parametric Lazy Learning method used for A value of 0 indicates no similarity, whereas a value of 1
both classification and regression. It considers a graph based indicates that both objects are identical. The cosine
on the rating and plots the rating of the input song in the similarity in Python is calculated as the dot product of the
graph and calculates the distance with all the other songs input samples.
and recommends the song based on the distance I.e. least
distance is compared.
3.9 Mood Prediction
3.6 CSR Matrix: The digitization of music has made various types of music
more accessible to people all over the world. Increased work
Sparse matrix in general are collections in which vast pressure takes away the time needed to listen to and assess
majority of values are some default values usually none or music in order to build a personal music library. One option
0.CSR stands for “Compressed Sparse Row”. The CSR could be to create a mood-based music search engine or
notation output the row-column tuple where the matrix recommendation system. Combining a wide range of
contains non-zero values along with those values. It gives semantic and stylistic elements collected from textual lyrics,
the information of the listen count and its location other than develop a mood classification system.
0 in music recommendation system.

3.7 Fuzzy Wuzzy:


Fuzzywuzzy is a string matching library written in Python.
The process of matching strings that match a specified

Volume XI, Issue VI, JUNE/2021 Page No: 100


International Journal of Management, Technology And Engineering ISSN NO : 2249-7455

3.10 Count Vectorizer:


The CountVectorizer in Scikit-learn is used to turn a set of
text documents into a vector of term/token counts. It also
allows text data to be pre-processed before being converted
into a vector format. Because of this, it's a text feature
representation module with a lot of flexibility.

3.11 Fit_transform():
The fit transform() function is applied to the training data in
order to scale it and learn its scaling parameters. Here, the
model we developed will learn the mean and variance of the
training set's characteristics. Our test data is then scaled
using the parameters we've learned.

3.12 TfidfVectorizer Model:


Fig 1: Steps of music recommendation system
Tfidf Vectorizer - Converts text into feature vectors that can
be used as estimator input. vocabulary_ is a dictionary that
translates each token (word) into a feature index in the 4. Algorithms
matrix, with a feature index for each unique token. The
integers (weights) in each vector indicate the tf-idf score 4.1 KNN
features. Tfidf transformer and Tfidf vectorizer from Scikit- The K Nearest Neighbor algorithm is a type of supervised
learn try to perform the same thing: convert a collection of learning technique that is used for classification and
raw documents into a matrix of TF-IDF features. regression. It's a flexible approach that may also be used to
fill in missing values and resample datasets. K Nearest
Neighbor considers K Nearest Neighbors (Data points) to
3.13 Model: predict the class or continuous value for a new Datapoint, as
N items in a continuous sequence from a given sample of the name suggests
text or speech.” A character, a word, or a sentence can be 1) Instance-based learning uses full training instances to
used as an item, and N can be any integer. When N is 2, the predict output for unknown data, rather than learning
sequence is referred to as a bigram. A trigram, for example, weights from training data to predict output (as in model-
is a sequence of three things, and so on. In the form of a (n based algorithms).
1)–order Markov model, an n-gram model is a sort of
probabilistic language model for predicting the next item in 2) Lazy Learning: The model is not learned using
a sequence. training data before the prediction is required on the new
instance, and the learning process is postponed until the
prediction is asked.
3.14 SVM: 3) Non-Parametric: In KNN, the mapping function has
SVM (Support Vector Machine) is a supervised machine no specified form.
learning technique that can be used to solve classification
and regression problems. It is, however, mostly employed to
solve categorization difficulties. Each data item is plotted as
a point in n-dimensional space (where n is the number of
features you have), with the value of each feature being the
value of a certain coordinate in the SVM algorithm. The
Support Vector Machine, or SVM, is a linear model that can
be used to solve classification and regression issues. It can
solve both linear and nonlinear problems and is useful for a
wide range of applications. SVM is a basic concept: The
method divides the data into classes by drawing a line or
hyperplane. During the training phase, the training dataset
divides the words into different categories such as happy,
sad, and so on, and based on the words, the mood of the
input song is predicted, and based on the similarity score, Fig 2: Steps for KNN algorithm implementation
which is sorted in increasing order, the mood for the top
similarity songs is predicted using SVM, and then similar
mood songs are recommended.

Volume XI, Issue VI, JUNE/2021 Page No: 101


International Journal of Management, Technology And Engineering ISSN NO : 2249-7455

Fig 5 Graph between artist name and listen


4.2 Cosine similarity
If you can determine whether two things are similar, you
can utilize that information to construct more sophisticated
jobs, such as:
4.2.1 Search: find the most similar document to a given one
4.2.2 Classification: is some customer likely to buy that
product
4.2.3 Clustering: are there natural groups of similar
documents
4.2.4 Product recommendations: which products are similar
Fig 6: listen count graph by each user
to the customer’s past purchases

Fig 7: Content based recommendation system

Fig3: algorithm implementation for cosine similarity

5. Performance Analysis

Fig 8: emotion detection in songs

Conclusion
The following are our conclusions based on experiment
results. First, music recommender system should consider
the music genre information to increase the quality of music
recommendations. The music recommender is able to
Fig 4 Graph between title and listen count recommend the songs based on the song features. The music
Recommender is able to check plagiarism in the dataset
taken by generating the similarity score for each
recommended song. The mood of the song is predicted by
examining the lyrics of the given song with all the other
songs in the dataset and predicting the mood and similarity
scores and recommending the songs based on the mood. The
complex nature of the machine learning systems like the
Music Recommendation System can’t have a standardized
structure because different music recommender systems
work in different way. Based on our analyses, we can
suggest for future research to add other music features in
order to improve the accuracy of the recommender system,

Volume XI, Issue VI, JUNE/2021 Page No: 102


International Journal of Management, Technology And Engineering ISSN NO : 2249-7455

such as using tempo gram for capturing local tempo at a


certain time.
References
[1] Everyone listens to music, but how we listen is changing.
[online] Available at:
http://www.nielsen.com/us/en/insights/news/2015/everyone-
listens-to-music-but-how- we-listen-is-changing.html
[Accessed 10 Oct. 2017].
[2] Labrosa.ee.columbia.edu. (2017). Million Song Dataset |
scaling MIR research. [online] Available at:
https://labrosa.ee.columbia.edu/millionsong/ [Accessed 10
Oct. 2017].
[3] en.wikipedia.org. (2017). Netflix Prize. [online]
Available at: https://en.wikipedia.org/wiki/Netflix_Prize
[Accessed 11 Oct. 2017].
[4] Linden, G., Smith, B. and York, J. (2003). Amazon.com
Recommendations Item-to- Item Collaborative Filtering.
[ebook] Available at:
https://www.cs.umd.edu/~samir/498/Amazon-
Recommendations.pdf [Accessed 10 Oct. 2017].
[5] Xiangnan He, Lizi Liao, Hanwang Zhang, Liqiang Nie,
Xia Hu, and Tat-Seng Chua. 2017. Neural Collaborative
Filtering. In Proceedings of the 26th International
Conference on World Wide Web (WWW '17). International
World Wide Web Conferences Steering Committee,
Republic and Canton of Geneva, Switzerland, 173- 182.
DOI: https://doi.org/10.1145/3038912.3052569
[6] Gershman, A. and Meisels, A. (2015). A Decision Tree
Based Recommender System. [ebook] IEEE Xplore, pp.170-
179. Available at:
https://subs.emis.de/LNI/Proceedings/Proceedings165/170.p
df [Accessed 9 Oct. 2017].
[7] Min SH., Han I. (2005) Recommender Systems Using
Support Vector Machines. In: Lowe D., Gaedke M. (eds)
Web Engineering. ICWE 2005. Lecture Notes in Computer
Science, vol 3579. Springer, Berlin, Heidelberg
[8] R-bloggers. (2017). Hybrid content-based and
collaborative filtering recommendations with {ordinal}
logistic regression (2): Recommendation as discrete choice.
[online] Available at: https://www.r-bloggers.com/hybrid-
content-based-and- collaborative-filtering-
recommendations-with-ordinal-logistic-regression-2-
recommendation-as-discrete-choice/ [Accessed 7 Oct. 2017].

Volume XI, Issue VI, JUNE/2021 Page No: 103

You might also like