ClusterEval
Evaluates clusterings of a dataset using a variety of scores.
Installation
Add this line to your application's Gemfile:
gem 'cluster_eval'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cluster_eval
Note, you will need a version of g++ installed that is compatible with C++11.
Usage
This can be used as a library, or through the installed command line program cluster_eval
.
$ cluster_eval help eval
Usage:
cluster_eval eval [options]
Options:
-a, [--cluster-file-a=CLUSTER_FILE_A] # cluster file A
-b, [--cluster-file-b=CLUSTER_FILE_B] # cluster file B
-y, [--type=TYPE] # type of index to compute
The type
argument specifies the index to compute either the Rand index, Jaccard index, Fowlkes-Mallows index, adjusted Rand index, or all.
It can take on values of: [rand/jaccard/fm/adj_rand/all]
Each cluster file must contain two columns of integers, the first column representing the sample ID, the second column the cluster ID. The sample IDs need not be sorted, but must contain all sample IDs from 0 to n samples.
For example if we have two files clust_a.tab and clust_b.tab, we could run the following:
$ cluster_eval eval -a clust_a.tab -b clust_b.tab -y rand
0.643
$ cluster_eval eval -a clust_a.tab -b clust_b.tab -y jaccard
0.286
$ cluster_eval eval -a clust_a.tab -b clust_b.tab -y fm
0.456
$ cluster_eval eval -a clust_a.tab -b clust_b.tab -y adj_rand
0.200
$ cluster_eval eval -a clust_a.tab -b clust_b.tab -y all
rand jaccard fm adj_rand
0.643 0.286 0.456 0.200
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork it ( https://github.com/[my-github-username]/cluster_eval/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request