Normalizer
Normalizer is a tool for normalizing your data.
Installation
gem sources -a http://gemcutter.org
sudo gem install normalizer
Usage
To normalize data that you already have the min/max of:
a = Normalizer.new(:min => [0], :max => [10])
a.normalize([5])
#=> [0.5]
b = Normalizer.new(:min => [0, 0], :max => [10, 10])
b.normalize([5, 5])
#=> [0.5, 0.5]
To find the min/max of your current data:
data = [[0, 1, 2, 3, 4], [10, 11, 12, 13, 14]]
Normalizer.find_min_and_max(data)
#=> [[0, 1, 2, 3, 4], [10, 11, 12, 13, 14]]
Copyright
Copyright © 2009 reddavis. See LICENSE for details.