<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by nsiicm on Medium]]></title>
        <description><![CDATA[Stories by nsiicm on Medium]]></description>
        <link>https://medium.com/@nsiicm0?source=rss-10c67081f611------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SSKxRUx92iXiU7_osEYWWw.png</url>
            <title>Stories by nsiicm on Medium</title>
            <link>https://medium.com/@nsiicm0?source=rss-10c67081f611------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:00:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nsiicm0/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spot-On: A way to organize Spotify playlists.]]></title>
            <link>https://nsiicm0.medium.com/spot-on-a-way-to-organize-spotify-playlists-c792ee8ade74?source=rss-10c67081f611------2</link>
            <guid isPermaLink="false">https://medium.com/p/c792ee8ade74</guid>
            <category><![CDATA[music]]></category>
            <category><![CDATA[spotify]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[nsiicm]]></dc:creator>
            <pubDate>Sat, 20 Jul 2019 14:41:07 GMT</pubDate>
            <atom:updated>2019-07-20T14:41:07.715Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*GOawfJEcYZUsor7nOoua1w.png" /><figcaption>An example of a playlist profile. This describes the type of music within a playlist.</figcaption></figure><h3>Project definition</h3><h4>Problem &amp; motivation</h4><p>Anybody who uses Spotify (or any other music software) has come across playlists. Playlists are the way to store various tracks in a single list, so you can come back at a later stage for your favorite song. Lists usually tend to get cluttered over time. So do also Spotify playlists.</p><p>Have you ever been on a morning commute, rocking your favorite songs and then suddenly the next song queuing up just blew your tune because it just does not quite fit? The Spot-On-Playlist-Organizer solves this problem by decluttering playlists and reorganizing a given playlist into multiple smaller ones. It takes various features of your tracks into account to group (cluster) them. The goal hereby is to group similar tracks into playlists.</p><h4>Metrics</h4><p>Obviously, there is no right or wrong when it comes to music. Some people think two individual tracks go well together, whereas others think of this as complete nonsense. Hence, aggregating music is highly subjective. This is also a reason why this is a classic unsupervised machine learning problem.</p><p>How do you cluster music and make sure the clusters are good? We can obviously not judge the correctness of the clusters. But we do can judge the quality of a cluster. In this project I used the “<a href="https://scikit-learn.org/stable/modules/generated/sklearn.metrics.silhouette_score.html">silhouette score</a>”.</p><p>The silhouette score judges a cluster by how well a data point fits into that cluster and not in the other ones. In other words, it answers the question: Is this point in here in the best possible cluster?</p><h3>Analysis</h3><h4>Exploration</h4><p>An in-depth data exploration can be found on my Github profile: <a href="https://github.com/nsiicm0/Spot-On-Playlist-Organizer/blob/v0.1/data_exploration.ipynb">https://github.com/nsiicm0/Spot-On-Playlist-Organizer/blob/v0.1/data_exploration.ipynb</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*xfBFmA8IKl6XmFqhfv0BiQ.png" /><figcaption>Correlation matrix of the features used for the clustering.</figcaption></figure><p>I used various audio features provided by Spotify. After our cleaning and processing almost none of the features really correlate, which is good for our clustering.</p><h3>Methodology</h3><h4>Implementation</h4><p>The application can be found on my Github profile along with instructions on how to run it: <a href="https://github.com/nsiicm0/Spot-On-Playlist-Organizer">https://github.com/nsiicm0/Spot-On-Playlist-Organizer</a></p><p>In the following lines, this application is being referred to as the “reference application”.</p><h3>Results</h3><p>In our reference application I used a special kind of playlist. The playlists consists (at the point of posting) of roughly 1000 tracks. This playlist is sourced by the weekly generated “Your mix of the week”-playlist by Spotify. So the tracks in the playlist are all highly similar, otherwise Spotify would not recommend them to us. However, my personal music taste sways between Rock tracks and EDM (electronic dance music). This paints a funny picture in the aggregated playlist. One week Spotify recommends me electronic music (softer and harder tracks) and on another week Spotify recommends me rock music (more or less similar tracks).</p><p>How does the data look like?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*H_jpg_jDH3Nchwl_1ppPQw.png" /><figcaption>Initial playlist.</figcaption></figure><p>Judging by the knowledge of my music taste, I would say you can see on the left side of the image all the “electronic music” and on the right side all the “rock music”.</p><h4>Evaluation and justification</h4><p>Various clustering methods were used for this project.</p><ul><li>kMeans</li><li>DBSCAN</li><li>AffinityPropagation</li></ul><p><strong>kMeans:<br></strong>The reference application implements kMeans as the “not sophisticated” clustering algorithm. kMeans was used with the elbow method to determine the appropriate amount of clusters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*LyN8Djv9emWv7ziSRucFVQ.png" /><figcaption>Elbow curve for kMeans</figcaption></figure><p>As we can see in the above picture, the elbow curve does not quite well show an appropriate k (amount of clusters). For our reference application I opted for k=2, as this is a good amount of playlists and given the knowledge of the playlist at hand this seems like a good choice. The results are quite well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*Eb89481V6TwpmvwpD2ozJw.png" /><figcaption>Results of kMeans on our playlist.</figcaption></figure><p>The clustering result of kMeans looks like an almost near perfect clustering algorithm. There are two things that made me consider further clustering methods:</p><ul><li>The plot was generated using the first two principal components. This means that there are 10 other principal components (in our case), which could describe the data even more. This also means that if wewere to look at other components, the clustering will probably not be as perfect as it seems.</li><li>Obviously, in music clustering there is no right or wrong, and in the end I have to be satisfied with the playlists. By listening to the playlists, I wasn’t quite happy with the result.</li></ul><p><strong>DBSCAN:</strong></p><p>DBSCAN is an unsupervised clustering algorithm. It finds the right amount of clusters during execution. For our experiment I used grid search cross validation with the silhouette score as the performance metric to determine the perfect configuration for the algorithm. The results were rather bad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*6E0Jix94y1tcNAM18XuNeA.png" /><figcaption>DBSCAN results.</figcaption></figure><p>If you look closely, we can recognize two classes of clusters (red and cyan). Unfortunately, this isn’t what we were looking for. Thus, I abandoned the DBSCAN algorithm as it might not fit so well onto our problem.</p><p><strong>Affinity Propagation:</strong></p><p>Affinity Propagation is another unsupervised clustering algorithm and implemented as the “sophisticated” clustering algorithm in the reference application. Again, I used grid search cross validation with the silhouette score as the performance metric to determine the perfect configuration for the algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*0eHX63vBdDghyWMZzSjBOw.png" /><figcaption>AffinityPropagation results.</figcaption></figure><p>This plot looked promising for our playlist. We can recognize some clear clusters and judging by the knowledge of the domain, the result seems quite well. I said before that Spotify recommends me softer and harder electronic tracks and rather similar rock tunes. Hence, I would expect at least 3 clusters to be found in the dataset. This is clearly the case in this example. Plus I also get another cluster of outliers.</p><p>Judging by the results above and my subjective impression of the generated playlists, I would consider AffinityPropagation a good fit for the playlist at hand.</p><h3>Conclusion</h3><h4>Reflection</h4><p>In this project I implemented an application which allows me to extract tracks from a playlist on Spotify. The data is then being used to find similar tracks and cluster them in new playlists.</p><p>To me it was surprising how well the whole idea worked out. Thanks to a previous project, I already had some knowledge on how Spotify presents data to developers.</p><p>During my project I struggled a bit after I saw the results of kMeans and DBSCAN. It took me a while to come across AffinityPropagation. I also had some troubles understanding the clustering results. In hindsight, it is obvious, that the data at hand sources from a special kind of playlist. The playlist consists of tracks recommended by Spotify. Thus, the already fit a certain profile, elsewise Spotify would not recommend them to me. If I had found a significant amount of clusters, I would have effectively broken the Spotify recommendation engine, which I doubt I would be able to do.</p><p>Given the circumstances, I am really happy with the result.</p><h4>Improvement</h4><p>I do see room for improvement in this application for the following topics:</p><ul><li>Proper implementation (not relying on spotipy) and robust access to the API.</li><li>Further features to be included in the clustering. Currently, we are using features provided by Spotify (pre-engineered). Spotify offers an API for audio analysis, which would allow for custom feature engineering. This would allow for fine grained feature engineering.</li></ul><h3>Disclaimer</h3><p>This project was submitted as part of the <a href="https://eu.udacity.com/course/data-scientist-nanodegree--nd025">Udacity Data Science Nanodegree</a>. It served as the capstone project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c792ee8ade74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get into Spotify’s Annual Top 100 List]]></title>
            <link>https://nsiicm0.medium.com/how-to-get-into-spotifys-annual-top-100-list-f81df826cb9f?source=rss-10c67081f611------2</link>
            <guid isPermaLink="false">https://medium.com/p/f81df826cb9f</guid>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[nsiicm]]></dc:creator>
            <pubDate>Thu, 11 Apr 2019 20:57:18 GMT</pubDate>
            <atom:updated>2019-04-13T09:54:41.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*WOqL0VERQ5idNG2nyUPX7A.png" /><figcaption>Feature importance of Top 100 Tracks</figcaption></figure><p>Recently, I stumbled across a <a href="https://www.kaggle.com/alexbonella/complete-analysis-top-100-spotify-tracks-of-2018">small* dataset</a> on Kaggle, which consists of metadata for tracks of the 2018 Spotify Top 100 list. At first glance, it was one of those “swipe-left” kinda datasets. The second I closed the browser tab, I was like “what the heck”, let’s dive into this small dataset and see what it has to reveal.</p><p><em>(*By small, I mean really small — like 16 features x 100 rows.)</em></p><p>By taking a closer look at the dataset we can distill the following feature groups (defined by me):</p><ul><li>Track metadata (i.e. Name, Spotify URL, Artist)</li><li>Track dynamics (i.e. Key, Mode, Tempo, etc.)</li><li>Track features (i.e. danceability, liveness, etc.)</li></ul><p>I will have a closer look at each of these groups. The following lines describe some of the highlights which I encountered during my analysis.</p><h3>What can potentially be learned from such a small dataset?</h3><p>I am quite the music enthusiast, therefore, I am interested in all kinds of facts about music. Here are some possible outcomes or goals I am trying to answer:</p><ol><li><strong>Which artists and what kind of tracks are in the Top 100?</strong><br>Who are they? How many tracks are in the Top 100 for each artist?<br>What kind of tracks are in the Top 100 in terms of track dynamics?</li><li><strong>What does it take to get into the Top 100?</strong><br>What should a track have in terms of track features? What should it not have?</li><li><strong>Where is the sweet spot of track features to be in the Top 100?</strong><br>Can we recognize a certain pattern?</li></ol><p>These were the questions I tried to answer in order to get a good understanding of the dataset.</p><h3>Which artists and what kind of tracks are in the Top 100?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*ZiJNkrYUMJgwFb3Vz792ng.png" /><figcaption>Top 10 Artists in terms of 2018 Top 100 entries</figcaption></figure><p>Apart from a few artists having multiple Top 100 entries, there cannot be much distilled from the name or genre of a track. With my basic knowledge of mainstream music and without adding any additional data to the dataset, I would say the Top 100 is not pure EDM or Rap or Pop or whatever.</p><p>By looking at the other track dynamics attributes, we cannot distill much from them, apart from the ‘Key’-feature (yes, it is actually called ‘key’).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*5QIkXgIUU45PufukstAoDw.png" /><figcaption>The number of tracks by key</figcaption></figure><p>This plot shows the amount of tracks in the Top 100 grouped by their ‘Key’. This is actually quite interesting. The ‘Key’ of a roughly translates to the mood of a track. Thus, we can to a certain degree determine whether a track is happy and upbeat or rather sad and dark.</p><p>By consulting the <a href="https://www.wmich.edu/mus-theo/courses/keys.html">internet</a> to find out what each key stands for in terms of mood or characteristics, I found the following for the two extremes (C# and D#):</p><ul><li>C#: Penitential lamentation, intimate conversation with God, the friend and help-meet of life[…]</li><li>D#: […] If ghosts could speak, their speech would approximate this key.</li></ul><p>By looking at these assessments and also by browsing through the other keys, I have to admit that it makes total sense when looking at the distributions in the Top 100.</p><h3>What does it take to get into the Top 100?</h3><p>This question tries to answer how the tracks are perceived. Are tracks rather acoustic? Or live recordings? Or danceable? Or loud? and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*wHW_7_7M32gGXaH5sDbNKw.png" /><figcaption>Heatmap of feature correlation</figcaption></figure><p>Before I got started, I tried to get a rough understanding on how the features are linked. We can tell, by looking at the plot, that not many features correlate. A few features to take a closer look are called: energy, key, loudness, valence.</p><p>Most of the features in the dataset were on some sort of a scale. As part of my analysis I tried to normalize them and classify in -1 (lower 33% of scale), 0 (everything else), 1 (upper 33% of scale). The features were normalized using MinMaxNormalization. So tracks having a score of 0.22 will get assigned a -1 for that feature. The idea behind this, is to make them easier plotable and countable. A -1 can be interpreted as “not important” whereas a 1 should be interpreted as “important”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*kQ9lXT4vxrzzGomVZglK0w.png" /><figcaption>Encoded features</figcaption></figure><p>By looking at the plots above, we can tell that features such as ‘instrumentalness’, ‘liveness’, ‘speechiness’ are really not important or could potentially be a deal breaker for a track to be in the Top 100.</p><h3>Where is the sweet spot of track features to be in the Top 100?</h3><p>So where is the sweet spot then? What does a track need to have or need to be in order to show up in the Top 100?</p><p>One way of answering this question is by putting all of the previously learned things together:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*WOqL0VERQ5idNG2nyUPX7A.png" /><figcaption>Feature importance of Top 100 tracks</figcaption></figure><p>By counting the amount of -1, 0 and 1 for each feature, we can determine which classification occurs the most. The results of this calculation is then plotted in the chart above.</p><p>This radar chart (or spider) shows two important things. Sidenote: The plot does not show whether tracks with this features exists or not. The plot rather shows what kind of features are common in the tracks.</p><ol><li>Loud, energetic, danceable and rather happy tracks are in the Top 100.</li><li>Speechy, acoustic, instrumental or live tracks are not really featured in the Top 100.</li></ol><p><strong>So long story short:<br></strong>If you want to get in the Top 100, make something loud, danceable, energetic and happy. Try to avoid instrumental or acoustic tracks, also do not think that a live recording of your track will make it to the Top 100.</p><p>I hope you guys enjoyed reading through my analysis. If you would like to learn more, I would recommend you <a href="https://github.com/nsiicm0/Spotify-2018-Top-100-Analysis/blob/master/Write%20A%20Data%20Science%20Blog%20Post.ipynb">my full jupyter notebook</a>.</p><p>More details on <a href="https://github.com/nsiicm0/Spotify-2018-Top-100-Analysis">https://github.com/nsiicm0/Spotify-2018-Top-100-Analysis</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f81df826cb9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>