-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.html
108 lines (91 loc) · 6.71 KB
/
model.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>CS109 Spotify Project</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/logo-nav.css" rel="stylesheet">
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">
<img src="spotify4.png" width="100" height="30" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<li class="nav-item">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="literaturereview.html">Literature Review</a>
</li>
<li class="nav-item">
<a class="nav-link" href="eda.html">EDA</a>
</li>
<li class="nav-item">
<a class="nav-link" href="model.html">Model</a>
</li>
<li class="nav-item">
<a class="nav-link" href="results.html">Results</a>
</li>
<li class="nav-item">
<a class="nav-link" href="conclusion.html">Conclusion</a>
</li>
<li class="nav-item">
<a class="nav-link" href="citations.html">References</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page Content -->
<div class="container">
<h1 class="mt-5">Model</h1>
<!-- <p>The logo in the navbar is now a default Bootstrap feature in Bootstrap 4! Make sure to set the width and height of the logo within the HTML. For best results, it's recommended that you use an SVG image as your logo.</p>
<img style="padding: 0 15px float: left," src="graph.png" width="599" height="442" align=”right” alt=""> The logo in the navbar is now a default Bootstrap feature in Bootstrap 4! Make sure to set the width and height of the logo within the HTML. For best results, it's recommended that you use an SVG image as your logo. -->
<p>
We have two baselines:
</p>
<ol>
<li>
<u>Random baseline</u>: for n total guesses, randomly select n songs from the set as predictions.
</li>
<li>
<u>Mode baseline</u>: Select the top n most popular songs in the dataset based on number of appearances in playlists where n is the number of guesses we allow the model to make. For example, when n=1, we guess the most popular song, “HUMBLE.” by Kendrick Lamar.
</li>
</ol>
<p>
To improve on these baselines, we first attempted to use word embedding techniques to find the relationships between songs. Word embeddings map words to vectors to find relationships between different words (and therefore determine their contextual significance). We attempted to do something similar by treating each song as a word and each playlist as a sentence to create a Doc2Vec model. However, we found that the data was too sparse to make for an effective model. For the language problem, the number of words is on a magnitude of hundreds of thousand; the Oxford English Dictionary, for instance, has 170,000 words. At least in the general sense of the problem, there are a nearly infinite number of sentences out there to train off. With the playlist problem there are over 2 million songs but only 1 million playlists from which to train. This meant there was simply not enough data per song to find relationships and generate effective predictions.
</p>
<p>
We then turned to collaborative filtering. Collaborative filtering uses a playlist by song matrix: every row represents a playlist and every column represents a song. Matrix[i,j] is then defined as 1 if playlist i contains song j and 0 otherwise. Given this formulation, we can then think about the similarity between two songs as a function of cosine similarity between their respective vectors. If two songs are present in the same playlists, their column vectors will be very similar, and thus the cosine similarity between them will be high. To actually generate a new song for a playlist, we compared every other song in the dataset to every song in the playlist, and chose the song that was closest on average to each song in the playlist, using cosine similarity as our distance metric. This method functions independent of order, which suits our focus on general, batched recommendations instead of automatic playlist generation that flows continuously from song to song. We trained our model on 300,000 playlists (~⅓ the whole playlist set) and tested on 10,000 playlists. Training generally took 15 minutes and predictions took 30-45 minutes per set of 10,000, with some variance based on the number of guesses allowed and the number of input songs.
</p>
<p>
We also played with some prior assumptions about the usefulness of number of followers in weighting a model. During data exploration, we theorized that the most popular playlists have important insights into listener preference and therefore should actually be given more weight in future models. We attempted to leverage this insight by adding duplicate playlists for popular playlists. We took a separate training sample of 100,000 playlists and duplicated a playlist for every follower it had. This increased the “size” of that training set to 240,000 playlists (the average playlist has 2.4 followers). As we discuss in the results section, however, this did not increase accuracy and in fact decreased it, likely due to overfitting.
</p>
</div>
<!-- /.container -->
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<footer class="py-5 bg-dark">
<div class="container">
<p class="m-0 text-center text-white">Template from Startbootstrap.com Logonav design </p>
<p class="m-0 text-center text-white">By David Gibson and Theo Lebryk</p>
<p class="m-0 text-center text-white">Group #53</p>
</div>
<!-- /.container -->
</footer>
</body>
</html>