GithubHelp home page GithubHelp logo

shmam / venn Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 33.01 MB

πŸ‘¨β€πŸŽ€Graph partition tool to find subsets of related artists using @spotify API

License: MIT License

Python 100.00%
spotify-api python numpy

venn's Introduction

Venn

Build Status

About

The Spotify Web API is a great resource for pulling data about musical artists, especially a list of related artists. While this is helpful for discovering new music, it can also be used to identify seperate factions of artists within this inital grouping.

GitHub Logo

First a grouping of artists is treated like a digraph, where an arc spans from artist a to artist b if Spotify says artist b is in artist's a's related artists list. Using this Graph G, we then partition this into two distinct subgraphs (G1 and G2) where the number of edges kept is maximized.

digraph

The method for determining this graph partition was initally found by M. Newman in his paper Finding community structure in networks using the eigenvectors of matrices. This is a very extensive process that has been reduced to a functional algorithm:

  1. Find adjanceny matrix (A) of G, and degree vector (d) of A
  2. Find the probability matrix (P) where p(i,j) β‰ˆ (d[i] * d[j]) / βˆ‘d
  3. Compute the modular matrix M: M = A - P
  4. Find eigenvectors V from the eigen decomposition of M
  5. Looking at the first column in V, if the value is negative that row is in one group and if positive that row is in the other group

Usage

Run this tool through the command line in a virtual env, with the inital artist's name in single quotes

$ python request.py '<artist_name>'

Auto Installation

Make use of cool pip features, and automatically install relevant dependencies with pip install -r requirements.txt

Then run the create and run the virtual enviroment

$ virtualenv -p python3 myvenv
$ source myvenv/bin/activate

Manual Installation:

  1. Make sure you have installed virtualen, or if not then run pip install virtualenv
  2. Creating the python three virtual enviroment virtualenv -p python3 myvenv[]
  3. Start the enviroment source myvenv/bin/activate
  4. Install the pyton requests package pip install requests
  5. Install numpy pip install numpy

Credit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.