Music Recommendation System Based on the Continuous Combination of Contextual Information Iman Dolatkia
Fatemeh Azimzadeh
Software Engineering Department University of Science and Culture Tehran, Iran
[email protected]
Scientific Information Database (SID) ACECR Tehran, Iran
[email protected]
Abstract— With the progress of technology in music players, especially in intelligent cell phones, users have access to large archives. Quick and easy selecting favorite music among these large archives becomes one the biggest problems for users. For example, selecting music in a silent forest is different from a crowded street or feelings for listening to music in a morning of a working day is different from an afternoon of a holiday. In this paper, a system has been designed that it collects users’ context information such as weather, temperature, geographical position, etc., and according to a weighted combination of them, it recommends an appropriate music that is a user’s favorite at the moment. Thus, this system includes a rating method that determines how close are music’s context, which have been played before, in the moment’s context and recommend the music that has the most closeness. The result of this research shows that recommendations that this system makes in different conditions, is closed to the user’s choice.
c r
One of the biggest problems of music lovers is to select the appropriate music among the archive that they have on their own device. For example, selecting a music in a silent forest is different from a crowded street, or feelings for listening to music in a morning of a working day is different from an afternoon of a holiday; so a local music recommendation system helps users to select the most sufficient music from their own device‟s archive that matches with their feelings and enjoy their life with listening to that music. Common recommendation systems are collaborative and content-based filtering. Collaborative filtering systems suggests the most sufficient music based on user‟s behavior and likeness among users, and content-based recommendation systems suggest the most sufficient music based on music‟s content (signal) and categorizing them. None of these recommendation systems don‟t consider context. Context includes: “information that shows where you are, who you with are and what‟s around you [1]” and “contextual data that can influence user‟s behavior with system [2]”. In music recommendation systems, context
A
S f
o e
v i h
Keywords— Contextual information; Music recommendation system; Behavior analyze; Music interest’s psychology
I. INTRODUCTION
D I
could be environmental information (e.g. position, time, weather, temperature, amount of light, traffic, etc.), person‟s information (e.g. age, sexuality, culture, present user‟s feelings, etc.) or music‟s information (song„s lyric, song‟s cover) [3]. So using common recommendation systems without considering context, don‟t have the ability to make an appropriate suggestion based on conditions. Because users normally store the songs that they like in their own device, the thing that makes them to choose differently in the circumstances and time is context. In this essay a rating algorithm introduced that with combination of context in the local music recommendation system, it gives the users this ability to choose the sufficient music with their conditions at the moment easily. For checking operation of this system, an android application designed that collects context using the sensors of smart devices. Reports from this application show that users are satisfied with the song that have been selected for them. The rest of this paper is structured as follows. First in section 2 we review some related works in this domain, then in section 3 introduce our methodology. Section 4 provides results of our methodology and finally in section 5 we conclude our works and hint to future works. II. RELATED WORKS The idea of using context in computer programs has been raised since 90s, Reddy and Mascia [4] suggested their music recommendation system called “LifeTrak” offered that a playlist would be presented based on songs on user‟s device and context around him. Environmental information that used by writers of this paper includes geographical position (using the zip code), time(morning, noon, afternoon, night), day of the week, amount of noise (if user is walking) and traffic condition(slow, medium, crowded, if user is driving), temperature (very cold, cold, temperate, hot, very hot) and weather (snowy, rainy, foggy, cloudy, clear and sunny). This context collected from cell phone‟s sensors. To making preferences, user should label his library using the specific labels. For example, user may label cold, very cold and rainy to a song that it means he likes them more in these conditions. System with using the library, labels and context at the
www.SID.ir
moment, rate the songs too. Cai and his co-workers matched the song with the song [5]. They introduced a system called “music sense” that offers users a song that is related with the websites and weblogs that they‟re reading. For this purpose, they consider a collection of words that shows a combination of human feelings, then for all songs (based on song‟s lyric) and pages that user explored these word would be set and finally suggest the songs which are the best match. This idea inspired by Google‟s AdSense, automatically suggest the song that is related to the webpages that user is reading. In this scenario, the text of web pages are context, which based on them, appropriate song would be suggested. The assessment of this research shows acceptable results for that. The other research [6] suggests related songs based on texts that user had created on Internet. Some study [7] recommended according to the context that is collected by user‟s cell phone, user‟s mode changes to one of these categorize: running, walking, sleeping, reading, working and shopping, and according to the song that he played in this condition before, appropriate song would be suggested. In this research used song content analyze to solve the problem of cold start. In some study [8, 9] position applied to suggest a better song, for this operation it asks the user to labels songs and places base on his interest, so according to these labels, appropriate song related with that place would be suggested. Similar paper considered position for a better song suggestion [10], but here user should relate songs to the places directly. The other research [11] applied a tourist help program which designed for mobile, which plays appropriate songs with feelings of the places that tourist is there. For example heroic songs in monuments and light and love music in a painting gallery. III. METHODOLOGY
h c
Table I.context that used in this paper Factor’s range 0 to farthest point 0 to 24 0 to 6 1 to 31 1 to 12 -30 to 50 0 to 100 0 to maximum available amount 0 to maximum available amount 0 to maximum available amount
Factor’s name Geographical place Hour from day Day from week Day from month Month from year temperature humidity Amount of rain in 3 hours Amount of snow in 3 hours Wind‟s speed
3) Factors and songs matrix Each song for the factors in section 3-1 includes SF that music played there. So if n Factors specified each song will have SF1 to SFn factors. So with considering all of the songs (m songs) m*n-dimensional matrix would be as follows:
1 2 3 4 5 6 7 8 9 10
D I
S f F1
o e
iv
A. The mathematical definition of the problem Before defining and discussing the algorithm, it‟s necessary to convert primary data to mathematical and organized data, then with using them the algorithm would be defined like a mathematical problem. 1) Factor With music interest psychology, limits of cell phones and researches have been done so far, context are considered and stored for each song. These contexts called Factor and showed in table 1.
r A
2) Set of Factor (SF) As it noted in the section 1, for choosing appropriate song suitable with present place, context which songs have been played there before is used; so anytime music plays and its user‟s favorite at the moment, all context would be stored as an efficient Metadata in choosing that song. Because only Factors defined in section 3-1 is used, so these data could be separated as related factor content. Each set of values related with a specific Factor called SF. The elements of these sets are unlimited and equal the number of times that their related songs have been played. For example if you consider the factor of hour “f” could be in the range of 0 to 24.Now if for “M” song the corresponding set with this factor includes 14,15, 20, 21, it means that this song have been played 4 times before in these hours and it was user‟s favorite.
F2
F3
…
Fn
M1
SF11
SF12
SF13
…
SF1n
M2
SF21
SF22
SF23
…
SF2n
M3
SF31
SF32
SF33
…
SF3n
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
SFm1
SFm2
SFm3
…
SFmn
Mm
Fig. 1. Factors and songs matrix
As its obvious, each cell belongs to a song and a specific factor and it contains a set of value related to the factor type which shows the number of time that related song has been played. Consequently, each cell of this matrix is a set, it could be better to use a three-dimensional matrix, but because of 2 following reasons it‟s not possible: The size of each matrix‟s row are not the same in different columns necessarily, because for storing context when it determined that a song is user‟s favorite, it may one of the cell phone‟s sensors won‟t be available or user didn‟t give the permission to the application to have access to one of sensors. With this assumption of all rows of a set are equal the size of sets of different rows are not the same, because, necessarily all the songs didn‟t played equally. 4) Current contexts As noted before, for choosing appropriate song in addition of all songs‟ contexts, current contexts are needed, therefore contexts of the moment of selecting song process are shown with “C”. As in section 3-2 only contexts in section 3-1 has
www.SID.ir
5. been specified for current contexts; so the numbers of elements of “C” are equal with Fig. 1 matrix‟s columns.
If density all over the factor‟s range be spread evenly, all the points‟ rate are the same.
According to the expectations that noted, a function would be suggested that has the most closeness to them. In the following, effective factors in a point‟s rate will be discussed. these factors are: 1. Density of the data 2. The amount of closeness to the density of data
B. Architecture of rating algorithm In this section, algorithm of songs rating would be discussed. The process of this algorithm for each song is shown in Fig. 2, as following: 1. First, contexts for the song that selected successfully would be collected for each song. 2. Contexts at the moment of the rating process will be collected by the sensors of cell phone. 3. For each Factor of current context, the amount of closeness to the song‟s context corresponding Factor would be given by “FR” formula and a number from 0 to 1. 4. Summation of “FR”s makes “SFR”. 5. By “SFR” and number of times that the song has been played, song‟s final rate would be achieved. 6. Songs would be organized by their rates and from a user interface will be shown to the user.
1) Data density As seen in the above example, before everything it‟s needed that to identify data density correctly, and then amount of densities or in another word the weight of densities would be determined and by using them an appropriate rate would be given to the point. To determine data density, points next to each other are going to identified and will put in the efficient area category, clustering algorithm based on density (DBSCAN) would be used for this [12]. For using this algorithm following changes have been done: 1. The amount of (MinPts) always considered one to ignore noise data. 2. (ε) or neighborhood radius called similar distance. 3. Clusters would be called efficient Area
D I
S f
But the method of identifying data density is this, that first for each specified factor in section 3-1 a similarity distance would be considered, purpose of similarity distance is a distance factor that if two data of that factor‟s difference is less than this amount, this assumption could be rejected that they have a same value. for example for hour of the day‟s factor, number 1 considered as similarity distance, it means this assumption is that if two songs have been played in a time range less than one hour, they have the same value. Now to determine data density, points that their distance is less than this range would be considered as a data density and would be called effective Area, the exact definition of the effective area is:“A set of points that for each one another point is exist that the distance between these two is less than similarity distance. Effective area of this set is the distance between least to the largest member of the set. Effective area at least is equals with the distance of related factor similarity.”
o e
c r
v i h
Fig. 2. Architecture of rating algorithm
C. The closeness of Ci to the set of SFij’s algorithm The manner of FR function rating should be something that always meet expectations to have a fair comparison, so the conditions that is needed for a fair comparison would be noticed to following function and will be defined to have all these conditions : 1. The points within heavy density would have the maximum rate. 2. More we get away from a density (and do not close to the other one), rate of points would be decreased. 3. If two points have equal distance from two densities, point that is closer to heavier density gets a higher rate. 4. If only in the start and end of the factor‟s range, two densities with same weight exist, the start and end of the range would get the top rate and the middle of the range would have the least rate.
A
(
)
*
+ (
(1)
)
(2)
But this weight for return a number from 0 to 1 would be normalizing with min-max method. According to this that minimum amount of effective area is equal to similar distance, so maximum weight is a condition that all members of the set be gathered in the similar distance, the minimum possible
www.SID.ir
weight is zero. So weight of effective area after normalizing into the range of 0 to 1 with min-max method is: (
)
According to the independence of these two parameters, multiplication of them shows the influence of effective areas on the point: ( ) (6)
(
)
(
)
(3) Consequently, influence summation of all the effective areas on the given point, shows the amount of closeness of that point to the available set pattern:
2) Amount of closeness to the data density After that the data density and their weights have been determined, the point closeness amount should be checked. For calculating the point closeness amount to the effective area, these two methods could be used: 1. Calculating the distance of the point to the edge of effective area. 2. Calculating the distance of the point to the middle of the effective area. According to the definition of similar distance if the difference between two data from one factor is less than similar distance, this assumption could be made that the value of all the points on one effective area are the same and the closeness criterion to this effective area. So it‟s better to use first method which means Calculating the distance of the point to the edge of effective area. The distance of the point to the edge of effective area called D. since the more a point is close to a density, have more rate so it‟s better this formula would be changed somehow that larger number shows the shorter distance. For this purpose this distance would be cut from the total range of the factor. On the other hand this formula would be normalized by min-max method to return an amount from 0 to 1:
(
h c
Because the distance to the closest edge of effective area is criterion, for the points in the range of effective area, distance of 0 is considered, then by using the above formula the amount of closeness to the effective area becomes 1. According to the range of 0 to1 for them, this amount of closeness is the maximum amount that is possible. Following equation shows the amount of closeness for the points in the effective area:
r A
(5)
D. Similar rate formula of one point to the set After weight of effective areas have been specified and also an equation for calculating the distance between different points of the range to the data density, it‟s time to achieve a manner and a formula by using these parameters that is shown by relating a number from 0 to 1. These parameters are: 1. Weight of effective areas 2. The distance of a given point to effective areas
∑
(7)
This formula is the most basic possible condition that naturally has some problems and insufficiency. For this reason in the following sections, its problems would be discussed by using special examples and it will improve to the best condition with checking available solutions. E. Checking special conditions This formula doesn‟t meet the condition number 4 in the section C that is a special condition, it means if only in the beginning and end of the factor‟s range two densities with same weight exist, beginning and end of the range would get maximum rate and middle of the range will have the least rate; but it doesn‟t happen by the formula in the past part, and rate of all of the point would be the same, because: If each x point on the range chosen with amount of d, that the beginning and end of those two densities are with w weight, then rate of all of the points would be the same and will be equals to:
D I
S f
o e
iv (4)
)
(
)
(8)
For better specifying of this subject, pay attention to the following example. Consider the set of EA on the factor of hour, it‟s rang is 0 to 24 and its similar distance is 1. This set only contains two points: one in 0 and another in 24; so we have two effective areas with same weights of 0/5 in the beginning and end of the range. Therefore rate of each point equals to FR=w=0.5. Rate of all of the points would be 0/5 that is so far from our expectation. Our expectation is that points 0 and 24 have the rate of 0/5 and as we get far from these two points the rate should decrease somehow the point 12 that is the middle point should have the least rate. For this purpose if formula gets out of the linear mode and variable of distance gets the power, it because the points those are close to the density to have higher rates. Our expectation is that the rate of middle point 1.4 times larger than the side points, to have a fair comparison. Rate of middle points are equal to: ( )
( )
(9)
The rate of beginning and end points are: (10)
www.SID.ir
With assumption that middle point is 1/n beginning and end point, we‟ve got: (
)
( )
( )
(11)
Considering that the rate of the middle point at least should be 1.4 times larger than beginning and end points, so distance variable goes to power of three. The corrected formula is: (
)
∑
(12)
Rate diagram of past example with corrected formula is shown in the Fig. 3.
D I
o e
Fig. 3. Rate of points in the hour range that only have two data in the beginning and end
By using the corrected formula, in this part different point‟s rate of the range exactly match with the expectations that noted in C would be achieved. The following examples show the formula correctness.
v i h
F. Final rate of a song In the past sections the closeness amount of each current context factors (C) was compare to the factor set and match with each song (SF) and got rated, for each song, different factor rates summation of the song (SFR) could be considered as the final rate of that song ; but there is another problem, the problem is the number of times that each song has been played doesn‟t considered and regardless of the amount of the set, only the closeness of current context of the song would be shown and considered. On the other words, here used the set amount of SF, if few different point in a set supposed to be compared, this subject wouldn‟t be important and the answers were exactly correct, but it supposed to show the closeness of the current context to all of the songs to finally compared to each other, so without considering the set amount of SF, our answers would be completely wrong. For better understanding this subject, consider a condition that a song has been played before one time and the summation of different factor rates is 10, now another song has been played for 10 times and it‟s
A
c r
S f
Fig. 4. Rate of hour domain for 3 different data distribution
SFR achieve to 9. Surely the second condition is more valuable because it has a larger statistical society and suggest a good chance but our formula gives the first one a higher rate. For solving this problem, different factor rates summation of a song (SFR) multiply to the number of its set: (13) But this formula is not complete yet, pay attention to this example: a song that has been played for 100 times and its current position SFR is 6, so this song‟s final rate would be 600. Now consider another song that has been played successfully for 65 times and it‟s current‟s SFR is 9, its final score would be 585 and that is so unfair. In this situation, if a song has few more successful plays, usually gets more rates regardless of song‟s SFR. For solving this problem a simple condition would be considered, the assumption is that songs and current context only have one factor, so with considering this that the maximum rate for each factor is one then their SFR finally would be 1. In the Fig. 5, final rate changes of a
www.SID.ir
Fig. 6. Redrawing of Fig. 5, with formula Fig. 5. Final rate changes of a song that has been played for 10 times and SFR from 0 to 1 with
song that has been played 10 times before, in possible SFR from 0 to 1 with formula has been showed: As its specified, if SFR of the song would be the maximum possible condition it means equal 1, its final rate with considering the above formula is 10*1=10 and decrease to achieve 0 and becomes 10*0=0. Dash lines show the final rate of base condition, base condition is worst or on the other words, is the most illusory condition that the set has the least possible amount and the rates have the most possible amount. So in our example the rate of a song is shown that has only played for one time (least possible amount) and its SFR is 1 (most possible rate) it means: 1*1=1. As it‟s obvious, diagram of rates change in possible SFR (red line) reaches base condition diagram (blue dash lines) in 0/1 ; it means the song that has been played 10 times before would have a higher final rate in the comparison with base condition until it‟s SFR is more than 0/1. So it‟s obvious that according to the above formula if a song played few times more than the others, its final rate would be higher than other songs regardless of the amount of their SFR. For solving this problem, SFR goes to the power to get more important than the times that music has played. so diagram of rates change in possible SFR (red line) it‟s better to reaches base condition diagram (blue dash lines) in 0/5, it means until it‟s rate is more than 0/5 has superiority in the comparison of base condition. So:
D I
( )
( )( )
A
(14)
G. Influence of context that user didn’t like Sometimes it‟s possible that user doesn‟t like the music that is been selected for him or he chose it random. This type of information is really effective in selecting appropriate song and for this reason it‟s better to be stored in the database and then used for selecting the appropriate sing. In the following, points that show the context of this condition would have called negative effective points. After storing negative
S f
o e
v i h
c r
effective points beside positive effective points in the database, the method that used for rating the points so far, is not responsive anymore, for this reason the following method is suggested: When points are separating to effective areas, system ignores the positivity or negativity of the effective points and considers all of them equally. then and after separating the points to the effective areas for calculating the weight of each effective area, number of negative effective points would be minus from positive effective points. You should pay attention to this that the weight of each area is divided by the maximum possible amount to get the results between 0 and 1. but here because the addition of negative effective points and their influence on the weight of effective area, the maximum possible weight change and equals with the maximum amount from maximum weight of positive and negative effective points, in other words : (
)
(
)
(15)
(16) (
(17) ) H. Cycle range factors You may paid attention to some specified factors in part 2-1 that have a cycle range, it means after the end of the range, beginning of the range starts again. Hour factor from day and night, day from month, etc., are in this group from factors. As said before, for achieving to the similar amount of a point to a set of effective points, we need summation of all effective areas on that point. It‟ considerable that for achieving the rate of a point in this group of factors that have a cycle range, is specifying the least distance from the point to effective areas ; it may a point be closer to an effective area to the contrary
www.SID.ir
way than usual way. This condition has a huge influence to the rate of the points in the beginning and the end of the range. IV. RESULTS
issue makes them hopeless from the system, but the novel system in this research recommends suitable music without the user‟s involvement and it collects the data that it needs dynamically. In the system which we designed, closeness of contexts of the song that has been played before, calculates with current context and use them to rate the songs, but the subject that needs research is that various context may influence each other, it means increasing of one factor cause decreasing the other one or the opposite. Also converting this local system for using centrally in the online music stores that have lots of users and it needs more researches. The problem of cold start is one of the system‟s problems that could be discussed in other researches.
So far all the researches that have been done in this field shows that users have more satisfaction when using the systems that use context to suggest music than the random type. For the reason that our system is different from other researches, they couldn‟t be compared with a diagram, for this purpose we need to design an application to use this system and see the users‟ satisfaction by using it. Making such an application with all the specifications that has a good music player need a long time, in another way some factors like month from year and day from moth, etc., shows their influence when application is used for a long time . For this reason we designed an application that only use hour of day, day of the week, and day of the month factors. In this application in addition to possibility to choose a song by user, a bottom designed for playing the appropriate song with the position. Also for collecting the statistics of the application, Google‟s Analytic reporting system is used. The reports show that 54 percent of users are satisfied with the song they choose and 51 percent satisfied when they use our system. This shows that our system is close to users choices. Although with considering other factors and more time for learning this system, this percentage would increase more.
REFERENCES [1]
[2]
[3]
[4]
[5]
iv
r A
h c
D I
S f
o e
V. CONCLUSIONS AND FUTURE WORKS The novel system which recommends music of local repository was implemented and gets user satisfaction. According to the psychology of music interests, limitations of cell phones and researches that have been done so far, we chose the appropriate context and applied them, we collected exactly and continuously the closeness of context that songs have been played there; so if an application uses this system completely, usage of context for a better music suggestion would be acceptable. The most important and superiority of the method in this paper is the usage of context continuously not discretely. The similar works in this field categorize the context and try to match current condition to one of them. For example “Liftrack” specified few categories for each context: time of day (morning, noon, afternoon, night), traffic condition (slow, medium, crowded when user is driving) and weather (snowy, rainy, foggy, cloudy, sunny and clear). Then each data matches with one of these categories, for example temperature is very cold, cold, temperate, hot or very hot and it doesn‟t have any middle mode. Finally, in the time of selecting music tries to match current condition to the one of the categories to find out the similar amount of songs. Naturally, these methods can‟t collect all the feelings from the environment, consequently in this paper context would be stored and checked continuously. Other problem of the systems in this area is that, user involved too much, and this
B. Schilit, N. Adams, and R. Want, "Context-aware computing applications," in Mobile Computing Systems and Applications, 1994. WMCSA 1994. First Workshop on, 1994, pp. 85-90. Q. N. Nguyen, F. Ricci, and D. Cavada, "User preferences initialization and integration in critique-based mobile recommender systems," Proceedings of Artificial Intelligence in Mobile Systems 2004, in conjunction with UbiComp 2004, pp. 7178, 2004. M. Kaminskas and F. Ricci, "Contextual music information retrieval and recommendation: State of the art and challenges," Computer Science Review, vol. 6, pp. 89-119, 2012. S. Reddy and J. Mascia, "Lifetrak: music in tune with your life," in Proceedings of the 1st ACM international workshop on Humancentered multimedia, 2006 ,pp. 25-34. R. Cai, C. Zhang, C. Wang, L. Zhang, and W.-Y. Ma, "Musicsense: contextual music recommendation using emotional allocation modeling," in Proceedings of the 15th international conference on Multimedia, 2007, pp. 553-556. C.-M. Chen, M-.F. Tsai, J.-Y. Liu, and Y.-H. Yang, "Using emotional context from article for contextual music recommendation," in Proceedings of the 21st ACM international conference on Multimedia, 2013, pp. 649-652. X. Wang, D. Rosenblum, and Y. Wang, "Context-aware mobile music recommendation for daily activities," in Proceedings of the 20th ACM international conference on Multimedia, 2012, pp. 99108. M. Braunhofer, M. Kaminskas, and F. Ricci, "Location-aware music recommendation," International Journal of Multimedia Information Retrieval, vol. 2, pp. 31-44, 2013. M. Kaminskas and F. Ricci, "Location-adapted music recommendation using tags," in User Modeling, Adaption and Personalization, ed: Springer, 2011, pp. 183-194. M. Braunhofer, M. Kaminskas ,and F. Ricci, "Recommending music for places of interest in a mobile travel guide," in Proceedings of the fifth ACM conference on Recommender systems, 2011, pp. 253-256. L. Baltrunas, M. Kaminskas, B. Ludwig, O. Moling, F. Ricci, A. Aydin, et al" ,.InCarMusic: Context-Aware Music Recommendations in a Car," in EC-Web, 2011, pp. 89-100. M. Ester, H.-P. Kriegel, J. Sander, and X. Xu, "A density-based algorithm for discovering clusters in large spatial databases with noise," in Kdd, 1996, pp. 226-231.
[6]
[7]
[8]
[9]
[10]
[11]
[12]
www.SID.ir