dlemphers-rmn/exercises — pull request #14 by ypandit (2014-04-07 07:17:15+00:00)
Title: ML exercise (YP)

* Each `function` has a `docstring` that explains what the function does. Following is just an overview of the approach/code for each task

1. Task 1
* A `preprocess` function for sentence and word tokenizer, stop word and punctuation removal
* `nltk.FreqDist()` for counting most and least popular term in documents
* For identifying types of guitars
* Custom logic to get accurate results, since the data is a finite list
* Use of bigram collocator to find ngrams with 'guitar', where association from corpus is measured by PMI
2. Task 2
* Groups in document
* Use of kMeans clustering to identify groups. (_Smaller sample considered due to `MemoryError` on my laptop_)
* [Elbow method](http://en.wikipedia.org/wiki/Determining_the_number_of_clusters_in_a_data_set#The_Elbow_Method) to identify the best `k` for kMeans Ref: `task2_kmeans_v1.png` for change in %variance by `k`
* Topics in document
* SVD decompositon using `sklearn.decomposition.TruncatedSVD`; latent semantic analysis
* Used the `gensim` package for LDA (which can be slightly better than LSA)
3. Task 3
* Few helper methods for loading data, preprocessing and feature extraction
* chi-sqaure feature selection
* Comparison of different classifiers with mean ROC plots from 10-fold cross validation of each classifier. This also tests the performance of classifiers on a randomly selected subset of the labelled dataset
* Simple function that returns the classifier object (that can be pickled). Classifier is selected from `task3_roc_v3.png`. `AUC` is considered for better performance than the accuracy score returned by the `API`, since `AUC` is over all data points

#### Tests

* Tests are for custom functions I wrote for loading and preprocessing data.
* I also setup travis-ci for the repo for continuous integration (`ml/readme.md`)