Major Project Chapter 6 – Some Promising Results

Upon successfully training my Doc2vec model (thanks to this blog post), I have gained some promising results, after training on a large corpus (555 reviews) – for example if I had been listening to 1: . It would have recommended me 2: as the most cosine similar. Which is a nice recommendation I think.

Comparing different examples – I think it’s only vectorising the first paragraph in the review, so next I need to concatenate the paragraphs. Additionally it has a lovely capability of analysing sentiment – if we look at the first paragraph from the prior example:
This is all about Dvorak’s chamber music, and if you doubt me, just listen to the slow movement of the Cello Concerto: Jean-Guihen Queyras and the Prague Philharmonia in rapt communication…we’re just eavesdroppers on an intimate conversation. In the outer movements Queyras’s instinctive musicianship and ravishingly beautiful tone are bewitching, and Belohlavek follows every imaginative twist and turn in his soloist’s phrasing; they’re glued together like the finest ballroom dancers.
Long-term fans of [Sigur Ros] ( could be forgiven for feeling a little nervous about Jonsi Birgisson’s new project. The quartet he usually fronts possess many admirable qualities, but their international success owes much to a mystique greatly enhanced by lyrics that are gobbledegook to most. Singing in Icelandic has the useful effect of making you sound like the house band from a science fiction film, an in-built benefit Birgisson has decided to eschew with his first solo record, which is sung mostly in English. If the Sigur Ros spell is ever to be broken, this might be the moment.

You can see here that these paragraphs are imaginative and descriptive.

Perhaps the most(surprisingly) challenging task was to extract the review text and exporting to separate, training .txt files in batch. I tried a piece of software but it wanted me to pay for it, so I thought i’d have a go at writing my own Python script. Many thanks to this blog post, I was able to semi-successfully implement it. My code so far manages to do it in batch per folder, but lacks the ability to iterate through folders and sub-folders, although my logic dictates it should do this… part of the challenge is dealing with some fairly odd hexadecimal directory organisation.

Things to fix:

  1. Get script to batch iterate through all review directories within the JSON dump(s).
  2. Concatenate multiple paragraphs.

Thoughts about text summarisation

Mick and I have been discussing text summarisation as previously mentioned – I have been doing some research, and I think it will not be necessary as key words, such as names of artists, tracks etc. will most likely not be included in the summarisation which are very important in having a Collaborative Filtering type influence on the model. I am doing some cleaning from NLTK toolkit before training my Doc2vec model, so I think it would be more useful to optimise this instead (which in a way, is a form of text summarisation).

Thanks for reading, more progress next week!


Major Project Chapter 5 – A Vector Space Comparison

This week i’ve been working on using Doc2Vec with CritiqueBrainz reviews, to try and get a good dimension of semantic similarity, from which to serve recommendations from a given track. So far seems to be working, sort of. For a good introduction to the workings of Doc2Vec see this post.

The Process

I’ve been working with the CritiqueBrainz JSON dumps from late 2016, this is a large corpus of reviews from which I can train my Doc2Vec model and then get a Cosine similarity between two reviews and thus 2 releases / pieces of music.

Improving it

Mick has suggested to use Text-Summarisation in order to get rid of superfluous information and thus have a more focused and possibly more successful/efficient vector space for each review.


Major Project Chapter 4 – Reaching the Docker

Last week, I had fun learning about the package manager – Docker, whilst trying to access the CritiqueBrainz database in order to get reviews for my Doc2Vec model, I hacked about for 2 days unsuccessfully, only to be sent the JSON dumps for the reviews, so now on to that. I realise that I was probably not the only one finding the Documentation a bit cryptic and hard to understand, hence the pull request which the developers opened a day prior to my work.

This week i’ll be focusing on training and testing my Doc2Vec model with the JSON review data for the first iteration of the MRS.

Major Project Chapter 3 – Igor’s Cousin: 256

This week I have been following this tutorial which Mick recommended to set up my own server on the University’s network. I have been successful in setting up my own stack on top of Ubuntu 16 and serving HTML via Python and MongoDB, this is all very exciting. When I run the server via terminal, it can be found here.

The next step is to fill up a Mongo database with music releases from CritiqueBrainz. This way I can utilise cosine similarity of the reviews using a pre-trained model (with rich semantic knowledge), and thus create a good one-dimensional semantic data space, and can then begin to serve recommendations based on distance in this dimension (a line of similarity). In the future, if this method proves successful, I can enrich the amount of data available by utilising Beautiful Soup to scrape Allmusic reviews.

And so concludes Chapter 2 of our story. We will now travel to other worlds and dimensions on our Python.

Major Project Chapter 2 – The Adventures of Cron and Igor

Meeting with supervisor Mick #1: Get python processes running on Igor automatically. This will be the goal for this week.

For my 2nd blog post I’ll be telling the tale of Cron from Unix, and Igor from Goldsmiths, and the mystery of how they will work together communicating in the language of the Python.

Cron and crontab

The software utility cron is a time-based job scheduler in Unix-like OS [1]. I’ll be using it for batch scheduling in the back-end of my MRS. Essentially what I need it to do is make GET requests to an API backend like Rap Genius, so that I can process the data and fill a database with cosine similarity from Doc2Vec so I can start getting meaningful distances in a 1 dimensional semantic data space.

I have managed to get cron scheduling python scripts on my Igor user space like so:

[jkirt001@igor ~]$ crontab -l

*/10 * * * * /usr/bin/python ~/public_html/MajorProj/

For more information on Cron see the useful quick reference guide here [2].

Mick meeting #3: Create own web server on igor and start serving HTML with python.




BSc Major Project in Music Computing Chapter 1 – Plan of Action

Welcome, this is my 1st blog post for my BSc Major Project. I’ll be outlining my aims and plan of action for the project, entitled: Data & AI in Music Recommendation, Discovery and Exploration.

I have been researching popular applications such as Spotify, Youtube and Discogs to consider the state of the art approaches to AI/Machine Learning based Music Recommendation Systems (MRS) and assisted music exploration. I have also been researching new and – in my opinion – underused methods in this field; such as Swarm Intelligence, to consider how I can offer a competitive alternative to the current state of the art systems and add to the current research. [1,2,3]

There has been a great deal of prior research in MRS; Schedl et al., in their paper “Current Challenges and Visions in Music Recommender Systems Research”, states that: “such systems are still far from being perfect and frequently produce unsatisfactory recommendations. This is partly because of the fact that users’ tastes and musical needs are highly dependent on a multitude of factors” [1]. I plan to address the issue of personalisation by using algorithms and methods that have a good social and psychological basis. I am well aware that the variance in users tastes of large statistical significance, therefore I will further evaluate my approach by iterative user testing– after implementations and alterations of the core recommendation system. One of my core questions being: what defines a ‘good’ recommendation? For my intents and purposes; I will define and thus evaluate the success of the algorithm by the ratings of my users for the generated recommendations, with a 5 point ‘star’ rating system.

I propose to create an MRS, and furthermore, an explorative web application; that can be used by music enthusiasts, DJs and producers to find new, personalised recommendations. Further more, there is an opportunity to create a UI where the user can explore further the resultant data space from the MRS. 

“What do you mean ‘resultant data space’?”

Dimensionality reduction needs to be applied in order to successfully create a meaningful distance, whereby the closest items are the best recommendations from the current item. Simultaneously, this is very useful for the latter part of my project (if I have time)– whereby I will be finding the shortest paths between 2 tracks and visualising the resultant path to the user.

In the multi-dimensional hybrid data space (weighted compound features based on metadata, user data and possibly acoustic data). MDS/TSNEE/UMAP will be tested out to see which performs best based on the quality of the recommendations. See Leon’s blog post for more details (comparing UMAP, t-SNE and PCA).

One of the most important reasons for the reduction in a large number of dimensions is the so called ‘Curse of Dimensionality’, in summary: when the dimensionality increases, the volume of the space increases su h that the available data become sparse. And therefore these Euclidean distances that I will be relying on will become harder to deal with. A large portion of the work that needs to be done here is also experimenting with feature weighting (which is largely dependent on user preferences) such that distances between tracks are most meaningful to that user.

Semantic Analysis using Doc2Vec/Word2Vec

I plan to create a small set of features based on semantics, for this I will be using doc2vec/word2vec to extract a similarity measure between 2 tracks qualitative, semantic information. For this, I will use lyric websites like Rapgenius and a review website such as Allmusic/MusicBrainz; for which I can scrape the text using Beautiful Soup, or obtain it through the APIs. This will create a great way of describing where songs fit into a low dimensional, semantic data space. Most probably an efficient feature engineering method, as opposed to using multidimensional acoustic data space. With enough time however I will experiment with high level acoustic features (e.g Danceability, Tonality) to include into the overarching compound feature/data space.

Running the System on a Server

To execute theses processes I will be running Python as scripts on a server, and serve the results in HTML to be analysed and visualised. I will be working for the duration of this project on my University’s server: Igor. This saves time and money over setting up AWS and such related services.


[1]  M. Schedl, H. Zamani, C. Chen, Y. Deljdoo, M. Elahi, “Current Challenges and Visions in Music Recommender Systems Research”, Conference 2017, Washington, DC, USA.

[2] P. Covington, J. Adams, E. Sargin, “Deep Neural Networks for YouTube Recommendations”, in Proceedings of the 10th ACM Conference on Recommender Systems – RecSys ’16 (ACM Press, New York, New York, USA, 2016;, pp. 191–198


Ant Colony Optimisation in Music Exploration and Natural Computing Jokes

In this post I will be exploring ACO in relation to a particular application of the Travelling Salesman Problem, for music exploration between items in an existing collection, and items that have been recommended by a system.

The Task:

A user is presented with items in their collection, and can immediately see the recommendations in relevant distance to items in their collection. Then, upon browsing to a new item, a new graph/map is visualised, showing the most important features as relevant to the user preferences (heavily weighted features being graphed) and displaying a network of music releases as nodes, with edges displaying the name and possibly value of the features which connect the recommendation or collection item set of items in-between.

The starting node would be an existing item in a users collection, and the final destination is a recommended item of the users choice.

Thus, a visual data space is presented, to which a user can explore and learn about new music, ‘joining the dots’ between music releases. This, in essence, takes part of the Machine Learning algorithm out of the ‘black-box’ and presents it alongside the results to the user. There could also be an opportunity to implement an evaluation system for the RecSys, where users can say if they like or dislike a recommendation, or further; if they like or dislike how the recommendation has been made, thus allowing the Machine Learning algorithm to improve and adapt accordingly.  A large part of work for this task will be finding the best way of visualising the multidimensional feature space in 2 or 3 dimensions. Dimensionality reduction techniques such as TSNEE/MDS/UMAP will be very useful for this. I would like to incorporate release artworks for each item in the visual space, which I believe will add to the immersivity and attractiveness of the application.

Thus, we can see the paths that the ants, have taken, via the deposition of their pheromones, and parameterise their exploration based on a users input!

The Final Blog Post

As this is my final blog post for the Natural Computing module, I will be evaluating what I’ve learned and what I would still like to learn in the topic which was not covered in class. The best things I’ve learned would likely be the wonders of dimensionality, optimisation and simulated collective intelligence. I am a scientist at the core, and the content has been very intellectually stimulating to me.

I would like to learn more about Natural Computing techniques as applied in the field of Machine Learning, how they interact with Data Science and compare with widely popular models like Neural Networks. It has also come to my attention that Neural Networks are an attempt at simulating a natural model of cognition, and therefore could fit under the umbrella of Natural Computing. As humanity delves further into the depths of Artificial Intelligence, we will with no doubt draw from nature as a bountiful, seemingly endless and wonderful source of inspiration.

And now on to some Natural Computing jokes:

  1. A fly walks into a bar. It checks if its best neighbour also walked into that bar. If so, all the flies drink at that bar. All the humans leave.
  2. What kind of ants are very learned? Pedants!
  3. What do you call an ant who can’t speak? A mutant (mute ant).
  4. How can you better understand genetics in cold weather? Put your codon!     source:
  5. Why did the chicken cross the road? Darwin: ‘It was the logical next step after coming down from the trees. He was the fittest chicken.’

Thanks for reading! This is the ninth and final part in a series of blogs for the Natural Computing module at Goldsmiths, University of London.