You are on page 1of 13

Spotify Music Recommendation

System
Introduction
Music is one of the popular entertainment media in the digital era. Music is
considered as the work of humancreativity to express ideas and emotions in the form
of sounds that consist of melody, harmony and rhythm. Music canbe categorized into
several genres, such as pop, rock, jazz, blues, folk etc. Listening to music in the
digital age is easierbecause of the features on the smartphone that can play music
offline and online Nowadays, the availability of digitalmusic is very abundant
compared to the previous era, so to sort out all this digital music is very time
consuming andcauses information fatigue.Therefore, it is very useful to develop a
music recommender system that can search musiclibraries automatically and
suggest songs that are suitable for users.Music streaming applications like Spotify
and Pandora have features to recommend music to users. These featurescan help to
get a list of appropriate music from the popular music libraries based on music that
has been heardpreviously. This makes the recommender system play an important
role in maintaining the streaming music business.Music recommendations are done
by looking for similarities from one music to another or by giving preference fromone
user to another.

The challenge of music recommender system is to create a system that can


continually findattractive new music which understand the users’ preferences in
music .This requires that the music personalizedrecommender system should
effectively reflect the personalpreferences. It needs adjustments to achieve
personalizedrecommendations for the needs of different audiences. Therefore, the
music personalized recommender system is amore complicated than the general
recommender system. It is necessary to consider user needs comprehensively
andcombines the music feature recognition and audio processingtechnologies to
extract the music features. The objectiveof this paper is to implement apersonalized
recommender system, which has practical significance and great vale inresearch.In
the last decade music streaming services have gained great popularity thanksto
smartphones. Further, these services let his users share his favorites songs,artists
and playlists. Within streaming music services, Spotify 1has more than75 millions of
activeusers, more than 30 millions of songs plus 20,000 each day,and about 1TB of
usage data generate per day.Even though Spotify is the largest streaming service in
the world, until July2015 when Spotify’s Discover Weekly was introduced, Spotify did
not officiallyhave any recommendation system (RS). In addition, the amount and
quality ofthe information that Spotify provides through its API 2presents challenges
forcreating RS.Regarding RS for Spotify, there are various works such as artist
recommendations through Twitter’s hashtags [4], combining Spotify’s history and
Facebooklikes to generate recommendations [3], and even artist visualization tools
All cited works use third party information to make the recommendations,creating a
dependence on the availability of such information. This article pro-poses a RS
based on collaborative filtering (CF) that is based entirely on theinformation that
Spotify provides through its API.
In the era of social media platforms and excessive creation of user-generated
content, it has never been easier to gather and process digital user traces on a large
scale, and in turn exploit them to build comprehensive user profiles. Thanks to this
abundance of user and usage data, the research fields of music information retrieval
(MIR) and music recommender systems, like many others, are currently in the
process of a paradigm shift, away from system-centric approaches and models
toward listener-centric ones At the same time, obtaining meaningful, clean, and
large-scale data about listeners, music items, and their interaction is time-consuming
and laborious. On the one hand, music platforms such as Spotify,Last.fm, or
Soundcloud provide convenient APIs that offer access to their databases. As a
consequence, a common strategy in academic research on listener-aware MIR is
that researchers acquire experimental data themselves using these APIs, which
results in non-standardized data collections, in turn hindering reproducibility.

RELATED WORK

 Algorithms for next-track music recommendation The majority of research


works in the area of recommender systems, as mentioned above, aims to
improve the prediction accuracy of an algorithm based on long-term user
profiles. In the specific problem setting of our scenario—the recommendation
of additional tracks during playlist construction—we, however, do not make
the assumption that such a user profile is available for personalization.
Differently from the traditional “matrix completion” problem formulation, the
computational task in our case is thus to determine a set of suitable musical
tracks given a sequence of previous tracks. A variety of algorithms have been
proposed for this scenario that is commonly referred to as “next-track music
recommendation”, “playlist continuation” or “session-based recommendation”
(Bonnin and Jannach 2014; Quadrana et al. 2018). The proposals range from
the application of sequential pattern mining, session-based nearest neighbor
techniques, random walks on a hypergraph whose edges correspond to
playlist categories, hybrid techniques based on meta-data and content
information, re-ranking techniques based on musical features, or neural
networks that leverage various types of data (Hariri et al. 2012; McFee and
Lanckriet 2012; Jannach et al. 2015; Vall et al. 2018).

 A comparative evaluation in Bonnin and Jannach (2014) revealed that in


terms of typical information retrieval (IR) measures like the recall, a newly
proposed method called CAGH was particularly competitive. The conceptually
simple method (“Collocated Artists—Greatest Hits”) takes the artists of the
given playlist beginning as an input and recommends the most popular tracks
of these artists and of other artists that are similar to those appearing in the
playlist beginning. The similarity between artists can be based on different
measures, e.g., on their co-occurrence in publicly shared playlists. Since the
CAGH method not only led to competitive performance results in terms of IR
measures, but also led to a very good quality perception in a user study
presented in Kamehkhosh and Jannach (2017), we also rely on a very similar
recommendation approach in this work.
 Commercial companies only sometimes reveal how parts of their machinery
works. In a number of public presentations, Spotify, for example, revealed that
they use matrix factorization based on implicit feedback for their “Discovery”
feature (Johnson 2014; Johnson and Newett 2014). Little technical detail is
however known about their “Radio” or playlist recommendation feature. After
Spotify acquired The Echo Nest in 2014, a music intelligence platform that
focused on the analysis of audio content, it was announced that they were
planning to also utilize content-based techniques. In more recent
presentations, such as (Steck et al. 2015), the authors report that Spotify uses
an ensemble of different techniques including NLP models and Recurrent
Neural Networks as well as explicit feedback signals (e.g., thumbs-up/thumbs-
down), and also audio features for certain recommendation tasks. It remains,
however, unclear from the presentations which techniques are used for which
types of recommendations (radios, weekly recommendations, playlists, etc.).

 According to the documentation of the Web API of Spotify, recommendations


are aimed to create a playliststyle listening experience based on seed artists,
tracks and genres. In this context, the available information for a given seed
item is used to find similar artists and tracks. An analysis of Spotify’s playlist
continuation API revealed that it seems to have a tendency to recommend
less popular items than some academic approaches (Jannach et al. 2016a).
Since the above-mentioned CAGH method by design has a tendency to
recommend comparably popular tracks, we decided to use Spotify’s
recommendation API as an additional source for track suggestions in our
study.

 Visualization and user interaction aspects The probably most widely


investigated aspect that has been explored through user studies relates to
visualization aspects (Lehtiniemi and Ojala 2013; Andjelkovic et al. 2016,
2019; Zhang and Liu 2017) and to the design of the user interface (Baur et al.
2010, 2011; Bostandjiev et al. 2012; Kamalzadeh et al. 2016; Jin et al. 2017).
Andjelkovic et al. (2016, 2019), for instance, introduced “MoodPlay” as an
interactive music-artists recommender system, which integrates content and
mood-based filtering functionalities in the user interface. Andjelkovic et al.
(2019) conducted a user study involving 279 participants in which four
versions of the interface were evaluated with various visualizations and
interactions. The results showed, among other aspects, that the interface
design and a certain combination of interactive features improved objective
and perceived recommendation accuracy, as well as self-reported user
satisfaction. In a similar approach, Zhang and Liu (2017) evaluated the
usability of three alternative visualizations of a user’s listening history (via
Bean plot, Instrument plot, and Transitional Pie plot) through different user
studies. Their results showed that the proposed visualization is useful for non-
expert users for visual analysis tasks.In another work, Baur et al. (2010)
proposed an interactive track recommendation service called “Rush”, which
was optimized for touch-screen devices. Among other aspects, the authors
analyzed its usability for left-handed and right-handed users. Furthermore, in
Baur et al. (2011), the authors introduced “Rush 2” as a mobile interface for
playlist creation with varying levels of automation (from manual to automatic).
A two-week diary study was conducted to evaluate the usability of the
application and the satisfaction of the users. Other related user studies in this
context, such as Bostandjiev et al. (2012), Kamalzadeh et al. (2016) and Jin
et al. (2017), highlighted that explanations, visual representations, and user
control mechanisms can be suitable means to increase user satisfaction.

 Immediate consideration of user feedback In which ways users are enabled to


state their preferences and how these preferences are integrated into the
recommendation process is another area of research, which has been
investigated to some extent through user studies (Pontello et al. 2017; Yakura
et al. 2018). Pontello et al. (2017), for instance, presented a framework that
relies on real-time user feedback to support personalized navigation in large
media collections. To evaluate the proposed framework, they developed a
Web application called “Mixtape” where users could provide a start track and
were then presented one suggestion after each other. For each track, the
users could provide a “like” statement or skip the track. One main result after
analyzing over 2000 navigation sessions was that the resulting playlists based
on immediate feedback were more coherent in terms of the artists in
comparison with tag-based and artist-based navigation approaches. In a more
recent work, Yakura et al. (2018) proposed a recommender system
calledFocusMusicRecommender” for playing music while working. Among
other functionalities, they introduced a “keep listening” feedback button that
together with the “skip” button enables the system to determine songs that
users like and dislike. The authors also estimated the concentration level of
users based on various indicators such as keyboard input, mouse input, and
Web browsing activity. The estimated concentration level was then adopted to
refine the users’ preference level. The value of considering the user’s
concentration level was then validated in a within-subjects user study, where
the participants reported on their impressions regarding the different tracks
that were played by the recommenders. The study revealed that considering
the estimated concentration level was useful, leading to a selection of tracks
that is more suitable during work.

 Recommender systems (RS) have developed to be a vital field of research


since the emergence of the first literature on collaborative filtering during the
mid-1990s (Gunawardana& Shani, 2015; Guy, 2015; Masthoff, 2010).
Generally, the definition of RS is described as the supporting systems which
assist users to discover product, information, or services like books, music,
movies,websites, digital products, and TV programs by gathering and
analysing recommendations from other users, which translates to reviews
from different consultants, and user characteristics (Celma, 2010; Negre,
2015). The objective of creating RS is to moderate overload of information by
recovering the most important information and services from a gigantic
amount of data, consequently providing tailored services. The most vital
element of a recommender system is its capability to guess the preferences
and interests of the user by analyzation of their behaviour and/or that of other
users to produce tailored recommendations (Tkalcic& Chen, 2015). Electronic
service personalization methods are represented by RS and have gained
much consideration in the past two decades(Celma, 2010).With the growth of
recommendation techniques and approaches, ever more RS (software) have
been instigated and numerous real-life recommender system software have
been created. In recent times it has been pointed out that application study is
the key focus of research of contemporary recommender system research,
particularly in the present-day age of big data (Negre, 2015). The uses of RS
include endorsing music, movies, television programs, documents, books,
websites, tourism scenic spots, conferences, and learning materials.
Moreover, they encompass the areas of e-commerce, e-learning, e-library, e-
business, and e-government services. Thus, this section focuses on the
existing literature on RS, with a particular focus on Music Recommender
Systems (MRS) (Hidasi et al., 2016). Recent years have witnessed the boom
of MRS, thanks to the arrival and realization of online streaming services,
which today make all music almost available in the world at the fingertip of the
user. Despite the fact today’s MRS significantly assist users in finding
interesting music in these large catalogues, MRS literature is still struggling
with substantial challenges. Particularly, when it comes to create, incorporate,
and assess recommendation approaches that incorporate information beyond
standard user, item interfaces or content-based descriptors, but go deeper
into the very core of listener preferences, needs, and ideas, MRS research
develops to be a big endeavour and interrelated publications quite meager
(Jannach and Adomavicius 2016).

Objectives

➢ Develop a generic framework that delivers “recommendations” that are based on


the combination of previously gathered user feedback data (i.e. ratings and listening
4 history),
➢The objective was to predict the popularity of any song and build a
recommendation system to recommend songs.
➢ Support the recommendation systems’ algorithms by using a multi‐strategy
approach that combines the results of different base recommenders and generic
recommenders into a final recommendation.
➢the music provider can predict and then offer the appropriate songs to their users
based on the characteristics of the music that has been heard previously.
PROPOSED METHODOLOGY

Collaborative filtering recommendation is one of the earliest applied techniques and


it has successfully spread and entered the recommender system field (Badrul,
George, Joseph & John, 2007). It generally uses the “K-nearest neighbor (KNN)”
technique which is based on the user’s historical records. The music taste of users
calculates the distances between the different users. Collaborative filtering
recommendation uses the target “user's nearest neighbor user” to weight and
evaluate the value of the product. Collaborative filtering recommendation predicts the
extent of user's preference for a specific target product (Claypool, Gokhale &
Miranda, 1999). According to Nilashi, Bagherifard, Ibrahim, Alizadeh, Nojeem and
Roozegar (2013), the general produce of the collaborative filtering recommendation
was summarized in figure 5. The circulation of the recommendation process should
run continuously in order to receive improved recommendations, since it takes time
to accumulate user data and match users with “neighbor users”

Types of collaborative Recommender Systems:

Memory-based collaborative filtering: Done mainly remembering the user-item


interaction matrix, and how a user reacts to it, i.e, the rating that a user gives to an
item. There is no dimensionality reduction or model fitting .

User-User filtering: In this kind, if a user A’s characteristics are similar to some other
user B then, the products that B liked are recommended to A. As a statement, we can
say, “the users who like products similar to you also liked those products”. So here we
recommend using the similarities between two users.

Based on the usage data and the user’s interests, the system searches the
“neighbor users” who share similar interests with the user. Then the recommendation
system recommends the contents that “neighbor users” are interested in to the user.
The general idea of how collaborative recommender systems work is easy to
understand. In other words, this approach is also commonly accepted in daily life,
people refer to friends’ recommendations when making their own decisions.
Collaborative filtering has been frequently used in e-commerce recommender
systems during the past few years. Collaborative filtering provides recommendations
for the target users based on other users’ evaluation of content (Soboroff & Nicholas,
1999). Based on Cai, Leung, Li, Min, Tang and Li (2014), the objects of collaborative
filtering recommendation are presented as follows (see table 1). Collaborative
filtering recommender systems can be recognized as a way that it makes the
suitable recommendation from the user's perspectives. According to Soboroff and
Nicholas (1999), collaborative filtering recommendation does not require users to
provide by themselves what they are interested in, for example by completing some
research forms (Soboroff & Nicholas, 1999).

The advantage of the collaborative filtering technique is that this technique involves
analyzing complex unstructured objects such as music, movies etc. (Robillard,
Maalej, Walker & Zimmermann, 2014). According to Cai, Leung, Li, Min, Tang and Li
(2014), the advantages of collaborative filtering are as follows:
 It can evaluate information that is difficult to be analyzed by a filtering system
automatically, such as art, music etc.
 It can avoid “low accuracy” content analysis by matching users with “neighbor
users”, and that is based on a number of complex concept (such as the quality of
information, personal taste) filters.  It is able to make “not similar”
recommendations. This is also an apparent difference between collaborative filtering
and content-based filtering. Based on users’ profile information, content-based
filtering recommends what users are already familiar with. However, collaborative
filtering provides recommendations which are based on other user’s taste. This may
solve the “similar” problem.
A lot of surveys and research works have pointed out how a collaborative
filtering recommender system works. These systems collect data of users’ buying
behavior or preferences and then analyze the data. Moreover, recommender
systems provide the user with recommendations based on the similarity between
products or users.
According to Robin Burke (1999), there are two problems in the collaborative
recommendation approach.
 “Ramp-up” problem By using the collaborative recommendation approach,
there needs to be a big amount of product rating data available initially so that the
collaborative recommendation approach can work, otherwise if there is no rating
data for the system to analyze (for example a new recommender system without any
existing rating data), a recommendation cannot be given. And also the accuracy of
the recommendation service has a strong connection with the number of product
ratings. Or, in other words, with the collaborative recommendation approach,
accuracy is dependent on the number of available ratings.
 “Banana” problem In the survey of Robin Burke (1999), he gave an example
of buying bananas in the supermarket to explain this problem. In American
supermarkets, most of the people want to buy bananas. Almost every shopping
basket contains bananas. So if there is a not welldeveloped or “naïve” recommender
system using the collaborative recommendation approach to draw up product
recommendations for customers, the recommendation will always be bananas.
Because bananas appear in the baskets every time. The system cannot analyze if
bananas have any connection with the products. This makes another problem in the
collaborative recommendation approach visible, namely that “main stream” items
tend to be recommended repeatedly. Whether the recommendation is good or not
depends on the data sets (Herlocker, J., Konstan, J., Terveen, L. &Riedl, J., 2004).
The recommendation approach has to match with the data sets. For the collaborative
recommendation approach, it is advantageous for useful data sets when the number
of users is higher than the number of items (Herlocker, J., Konstan, J., Terveen, L.
&Riedl, J., 2004). For example, in the restaurants recommendation app in Shanghai,
there are 70,000 restaurants in shanghai but the number of customers using them is
much higher than 70,000. For data sets where the number of items considerably
exceeds the number of customers, it will probably not be that accurate (Herlocker, J.,
Konstan, J., Terveen, L. &Riedl, J., 2004).
For example: the music recommender system. Collaborative filtering
recommendation is used in the Spotify recommender system. We have described
the definition and the process of recommendation to gain a thorough understanding
for the Spotify music recommendation functions and mechanism. We have designed
our questionnaire and focus group interview based on the knowledge about
collaborative filtering recommendation and other kind of recommendations. Our
respondents had this basic knowledge before answering the interview questions.
Now, if one user A behaves like other users B, C, and D, then for a product x, A’s
rating is given by:

Where Rxu is the rating given to x by user u and i=0 to n are the users who have
shown behaviorsimilar to u. Now, all the n users are not an equal amount similar to
the user u. So, we find a weighted sum to provide the rank.

The weights here are the similarity metrics used.

Now, users show some differences in behaviors while rating. Some are generous
raters, others are not, i.e, maybe one user rates in range 3 to 5, while other user rates
1 to 3. So, we calculate the average of all the ratings that the user has provided, and
subtract the value from Ri in order to normalize the ratings by each user.

Item-Item filtering: Here, if user A likes an item x, then, the items y and z which are
similar to x in property, then y and z are recommended to the user. As a statement, it
can be said, “Because you liked this, you may also like those”.

The same equations are used here also

Where R is the rating user u gives to the product x, and it is the average of the ratings
u gave to products like x. Here also, we take a weighted average

Where the Weight is the similarity between the products.


Similarity Metrics

They are mathematical measures which are used to determine how similar is a vector
to a given vector.

Similarity metrics used mostly:

1. Cosine Similarity: The Cosine angle between the vectors.

2. Dot Product: The cosine angle and magnitude of the vectors also matters.

3. Euclidian Distance: The elementwise squared distance between two


vectors

4. Pearson Similarity: It is a coefficient given by:

Model-based collaborative filtering: Remembering the matrix is not required here.


From the matrix, we try to learn how a specific user or an item behaves. We
compress the large interaction matrix using dimensional Reduction or using clustering
algorithms. In this type, We fit machine learning models and try to predict how many
ratings will a user give a product. There are several methods:

1. Clustering algorithms

2. Matrix Factorization based algorithm

3. Deep Learning methods

Clustering Algorithms: They normally use simple clustering Algorithms like K-


Nearest Neighbours to find the K closest neighbors or embeddings given a user or an
item embedding based on the similarity metrics used.
REQUIREMENTS

 Language:Python
 Software:GoogleCollaboratory
 Libraries:
o Numpy
o Pandas
o Sklearn
o Seaborn
o Matplotlib
o SciPy
o Sickit-learn

References

1. Stafford SA. Music in the Digital Age: The Emergence of Digital Music and Its
Repercussions on the Music Industry. The Elon Journal of Undergraduate Research
in Communications Vol. 1 No. 2. 2010. 2. Aggarwal CC. Recommender Systems:
The Textbook. 1st ed.: Springer; 2016.
3. Oord Avd, Dieleman S, Schrauwen B. Deep content-based music
recommendation. Advances in Neural Information Processing Systems 26 (NIPS
2013). 2013.
. 4. O’Bryant J. A survey of music recommendation and possible improvements. In ;
2017.5. Choi K, Fazekas G, Sandler M. Automatic Tagging using Deep
Convolutional Neural Network. arXiveprints arXiv:1606.00298. 2016. 6. 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. 7. Ricci F, Rokach L, Shapira B. Recommender
Systems Handbook: Springer Science; 2010. 8. Arditi D. Digital Subscriptions: The
Unending Consumption of Music in the Digital Era. Popular Music and Society. 2017.
9. Song Y, Pearce M, Dixon S. A Survey of Music Recommendation Systems and
Future Perspectives. In The 9th International Symposium on Computer Music
Modeling and Retrieval (CMMR); london. p. 395-410. 10. Bu J, Tan S, Chen C,
Wang C, Wu H, Zhang L, et al. Music recommendation by unified hypergraph:
combining social media information and music content. In MM'10 Proceedings of the
18th ACM international conference on Multimedia; 2010. p. 391-400. 11. Bogdanov
D, Herrera P. How Much Metadata Do We Need in Music Recommendation? A
Subjective Evaluation Using Preference Sets. In 12th International Society for Music
Information Retrieval Conference (ISMIR 2011); 2011. p. 97-102. 12. Ekstrand MD,
Riedl JT, Konstan JA. Collaborative Filtering Recommender Systems. Foundations
and Trends in Human–Computer Interaction. 2010; 4(2): p. 81–173. 13. 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. 14. Defferrard M, Benz K, Vandergheynst P, Xavier
Bresson. FMA: A Dataset For Music Analysis. In 18th International Society for Music
Information Retrieval Conference; 2017. 15. Davis J, Goadrich M. The Relationship
Between Precision-Recall and ROC Curves. In ICML'06 Proceedings of the 23rd
international conference on Machine learning; 2006. p. 233-240.

You might also like