Docsity

Python Data Science Project: Music Genre Clustering with Hierarchical Clustering - Prof. K, Schemes and Mind Maps of Database Programming

Partial preview of the text

Download Python Data Science Project: Music Genre Clustering with Hierarchical Clustering - Prof. K and more Schemes and Mind Maps Database Programming in PDF only on Docsity!

SRM INSTITUTE OF SCIENCE & TECHNOLOGY

VADAPALANI CAMPUS

College of Engineering and Technology

Department of Electronics and Communication Engineering

18ECE372J-PYTHON FOR DATA SCIENCES

PORTFOLIO REPORT

NAME : ABHISHEK K S

REG. NUMBER : RA

YEAR / SEM : III/V

BONAFIDE CERTIFICATE

Register No: RA2011053040007 Date:

Certified to be the bonafide record of work done by ABHISHEK K S of III year B.Tech in Electronics and Communication Engineering with specialization in Data Science branch in SRM Institute of Science and Technology, Vadapalani Campus for the laboratory 18ECE372J – Python for Data Sciences during the academic year 2022-2023.

Date: Lecturer-in-charge Head of the Department

Submitted for University Examination held in of SRM Institute of Science and Technology, Vadapalani Campus.

Date: Examiner- I Examiner- II

MINI PROJECT

CONTENT

S.No. Title of the Experiment Page No.

1 Abstract 5

2 Background 6

3 Methodology 7

3 Implementation 9

4 Results and output 10

5 Conclusion 12

6 Reference 12

ABSTRACT

The classification and clustering of audio and music represents a significant focus for many researchers, many motivated by the ubiquity of such clustering in content recommendation algorithms, as well as a push to improve general audio recognition software. Several content-hosting sites have drawn scrutiny for the perceived quality (or lack thereof) of their recommendation algorithms, and the spread of voice- controlled clearly demonstrate the recent push to improve the quality of automated audio analysis.

There are also active investigations in the use of stylistic analysis to settle disputes of authorship or IP. In these cases, algorithms are applied to compare the similarities between contested works and those by all potential true authors. Additionally, many popular methods rely on large pre-labeled databases for training, which may not always be reliable or available. To further these efforts, this thesis aims to investigate deeper into the utility of two approaches – the K-Means and Hierarchical clustering algorithms – for the purposes of music classification and insight. Both algorithms are 'unsupervised' - they operate without an initial set of labeled data, which makes them more versatile than the popular supervised methods and means they may be used to generate initial datasets for rapid automated training of supervised methods.

The two algorithms will be applied to a collection of songs to evaluate how accurately they can gather songs of like 1 genre into the same cluster. These algorithms will then be compared against the classification results for a competing method, the K-Nearest Neighbors algorithm. In this way, this thesis aims to determine their effectiveness for the task of genre clustering, how this effectiveness can be improved, as well as the properties that may make these methods preferable to existing alternatives.

METHODOLOGY

Hierarchical Clustering

As an alternative to other methods, the hierarchical approach instead initializes each sample as being its own ‘cluster’, and then iteratively joins the nearest two clusters until all clusters are either joined into a single super-cluster or are a requisite distance away from each other. Because of this process of gradually joining clusters (as opposed to splitting them up), this technique is considered ‘bottom-up’ or ‘agglomerative’ clustering.

Unlike K-Means clustering, Hierarchical clustering has no requirement of foreknowledge of the cluster count. In addition, as the sub-clusters to any given cluster can be visualized on a dendrogram, this method allows it to evaluate sub- genre relationships and evaluate the closeness of any two genres (and, naturally, their constituent songs).

There are mainly two types of hierarchical clustering:

  1. Agglomerative hierarchical clustering:

Merging or adding clusters at each step is known as agglomerative or additive hierarchical clustering.

  1. Divisive Hierarchical clustering:

Starting with a single cluster and assigning all points to that cluster.

To get the number of clusters for hierarchical clustering, we make use of an awesome

concept called a Dendrogram.

A dendrogram is a tree-like diagram that records the sequences of merges or splits.

For this experiment, the features deemed potentially relevant were the eight highlevel audio features from the Spotify API as well as the means and standard deviations of first 13 MFCCs. These features were then used as traits in a genetic algorithm set to score its populations’ fitness using k-NN classification for scoring in order to determine the optimal features from those available.

This was repeated for varied five different maximum feature counts (30, 20, 15, 10, and

  1. in order to best establish the optimal feature set. Each iteration of this genetic algorithm was applied with a population equal to ten times the maximum feature count and 50 generations of evolution.

A corpus of the 5,700 tracks from the FMA dataset were then assembled from the 6 most populous genres for which the dataset had complete information. This body of data was then clustered using both the K-Means and Hierarchical approach, as well classified using a k-NN approach with five different K-values.

These K-values were set at 1, 5, 10, 50, and 100, in order to capture the accuracy of the approach at varied orders of magnitude. As K-Means and Hierarchical algorithms are both unsupervised clusterers, they do not directly label the classes of their final cluster outputs, so the FMI is used as a metric to measure the accuracy of all experimental algorithms.

Once the ideal number of features has been identified, the k-NN algorithm was then run at decreasing proportions of training to testing data, with the goal of determining its behavior as its training data decreases.

OUTPUT AND RESULT

COURSE

CONTENT

S.No. Title Page No.

(^1) Course contents 14

(^2) certificate 16

Python For Data Science

Duration : 4 Weeks

Course Contents

Week 1

Introduction to Python

Introduction to Spyder

Setting working Directory

Creating and saving a script file

File execution, clearing console, removing variables from environment,

Clearing environment

Commenting script files

Variable creation

Arithmetic and logical operators

Data types and associated operations

Week 2

Sequence data types and associated operations: strings, lists, arrays,

tuples, dictionary, sets, range

NumPy

Week 3

Pandas dataframe and dataframe related operations on Toyota Corolla

dataset

Data visualization on Toyota Corolla dataset using matplotlib and

seaborn libraries

Control structures using Toyota Corolla dataset

Function

Certificate