JigneshPrajapati18 commited on
Commit
0b0218b
Β·
verified Β·
1 Parent(s): be4b485

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -1
README.md CHANGED
@@ -1,3 +1,122 @@
 
 
 
 
 
 
1
  ---
2
- license: mit
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🎡 Music Preference Classification using Spotify Audio Features
2
+
3
+ ## πŸ“„ Project Overview
4
+
5
+ This project aims to classify whether a song is **liked** or **disliked** based on its audio features from Spotify. The dataset includes a curated collection of tracks categorized by personal music taste, and machine learning models are used to identify patterns that predict preference.
6
+
7
  ---
8
+
9
+ ## πŸ“š Table of Contents
10
+
11
+ 1. [Playlist Creation](#1-🎼-playlist-creation)
12
+ 2. [Data Collection](#2-πŸ“Š-data-collection)
13
+ 3. [Features Description](#3-🎡-features-description)
14
+ 4. [Target Variable](#4-πŸ“ˆ-target-variable)
15
+ 5. [Project Structure](#5-πŸ“‚-project-structure)
16
+ 6. [Usage](#6-πŸš€-how-to-use)
17
+
18
  ---
19
+
20
+ ## 1. 🎼 Playlist Creation
21
+
22
+ ### Liked Songs (100 tracks):
23
+
24
+ * Mainly French Rap
25
+ * Some American Rap, Rock, Electro
26
+
27
+ ### Disliked Songs (95 tracks):
28
+
29
+ * 25 Metal (e.g. Cannibal Corpse)
30
+ * 20 Disliked Rap (e.g. PNL)
31
+ * 25 Classical
32
+ * 25 Disco
33
+
34
+ > Pop songs are excluded as the user is neutral about them.
35
+
36
+ ---
37
+
38
+ ## 2. πŸ“Š Data Collection
39
+
40
+ ### Step-by-step:
41
+
42
+ #### 2.1 Get Playlist Track IDs
43
+
44
+ * Spotify API: `Get a Playlist's Items`
45
+ * Fields: `items(track(id,name))`
46
+ * Output saved to: `ids/yes.py`, `ids/no.py`
47
+
48
+ #### 2.2 Convert JSON to Track IDs
49
+
50
+ * Script: `ids/ids_to_data.py`
51
+ * Output: Comma-separated string of track IDs
52
+
53
+ #### 2.3 Fetch Audio Features
54
+
55
+ * Spotify API: `Get Audio Features for Several Tracks`
56
+ * Output Files:
57
+
58
+ * `data/good.json`
59
+ * `data/dislike.json`
60
+
61
+ ---
62
+
63
+ ## 3. 🎡 Features Description
64
+
65
+ Each track is represented by 13 Spotify audio features:
66
+
67
+ | Feature | Type | Description |
68
+ | ------------------ | ----------- | ------------------------------------ |
69
+ | `acousticness` | float (0–1) | Likelihood track is acoustic |
70
+ | `danceability` | float (0–1) | Suitability for dancing |
71
+ | `duration_ms` | int | Track length in ms |
72
+ | `energy` | float (0–1) | Intensity/activity level |
73
+ | `instrumentalness` | float (0–1) | Likelihood of no vocals |
74
+ | `key` | int (0–11) | Musical key (0 = C, 1 = C#/Db, etc.) |
75
+ | `liveness` | float (0–1) | Probability of live performance |
76
+ | `loudness` | float (dB) | Average loudness |
77
+ | `mode` | int (0/1) | 1 = major, 0 = minor |
78
+ | `speechiness` | float (0–1) | Presence of spoken words |
79
+ | `tempo` | float | Tempo in BPM |
80
+ | `time_signature` | int | Beats per measure |
81
+ | `valence` | float (0–1) | Musical positiveness |
82
+
83
+ ---
84
+
85
+ ## 4. πŸ“ˆ Target Variable
86
+
87
+ | Column | Type | Description |
88
+ | ------- | ---- | ----------------------- |
89
+ | `liked` | int | 1 = Liked, 0 = Disliked |
90
+
91
+ ---
92
+
93
+
94
+ ---
95
+
96
+ ## 5. πŸš€ How to Use
97
+
98
+ 1. **Install dependencies:**
99
+
100
+ ```bash
101
+ pip install -r requirements.txt
102
+ ```
103
+
104
+ 2. **Convert playlist JSON to track IDs** using `ids_to_data.py`
105
+
106
+ 3. **Fetch features from Spotify API** using the ID strings
107
+
108
+ 4. **Run EDA and train models** in Jupyter notebooks
109
+
110
+ 5. **Save and evaluate models**
111
+
112
+ ---
113
+
114
+ ## πŸ”Ή Notes
115
+
116
+ * Requires a valid **Spotify Developer token**.
117
+ * Fully customizable to user preferences.
118
+ * Great example of personalized ML using real-world API data.
119
+
120
+ ---
121
+
122
+ Feel free to fork, modify, or contribute to this music recommendation project!