AnnGram vs k-means

Overview

As a set of benchmarks to test whether or not the new AnnGram algorithm is actually working correctly, I’ve been trying to come up with different yet similar methods to compare it too.  Primarily, there are two possibilities:

  • Replace the nGram vectors with another form
  • Process the nGrams using something other than Self-Organizing Maps

I’m still looking through the related literature to decide if there is some way to use something other than the nGrams to feed into the SOM; however, I haven’t been having any luck.  So far, most of my work has been focused on comparing SOM to k-means clustering.

K-Means Clustering

From Wikipedia:

In statistics and machine learning, k-means clustering is a method of cluster analysis which aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean. It is similar to the expectation-maximization algorithm for mixtures of Gaussians in that they both attempt to find the centers of natural clusters in the data.

Essentially, k-means clustering turns a set of data in an n-dimensional space (like the nGram input) into a set of clusters such that similar objects are grouped together.

Does it work?

Long story short: It sort of works.  For the example, I used 25 iterations and 5 clusters because using fewer clusters had not been returning any distinct group.

I say that it work of works because all of the documents in group 0 are by William Blake.  It’s not all of Blake’s work and there is no distinction between the Bible and Shakespeare, but there is at least a little distinction.

For those of you wondering, the single document in each of groups 1, 2, and 4 are because those groups were assigned that particular document to act as their center at some point during the algorithm and it didn’t move.  Thus, those particular documents form the center of their “clusters.”

Result

The results are bad for K-Means clustering and good for my algorithm.  At the very least, it shows that the combination of nGrams and a SOM is superior to nGrams and K-Means clustering.

Sandbox – It’s Alive!

So I haven’t actually updated the Sandbox project for quite some time (December 9th I believe).  Since then, I’ve actually torn out the core of the code and rewritten it to actually be a game, rather than another clone of the general Falling Sand games.  Rather than explain in detail what I’ve done (I’ll get to that later), I’ll start with screenshots of the new version.

Continue reading

高校生の時とマーチングバンド

高校生の時、私の今の活動と高校の活動ことなりました。たとえば、毎日マーチングバンドがありました。マーチングバンドでは、トランペットやチューバやふきました。そして、ピアノをひきました。一年生と二年生の時トランペットをふきまして三年生の時チューバをふきましたて四年生の時ピアノをひきました。

Continue reading