Project

normalizer

0.0
No commit activity in last 3 years
No release in over 3 years
Tool for normalizing data
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

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]]

You can also use a buffer on the max/min by setting a buffer in standard deviations:

data = [[0, 0, 0, 0, 0], [10, 10, 10, 10, 10]]
Normalizer.find_min_and_max(data, :std => 3)
  #=> [[-21.2132034355964, -21.2132034355964, -21.2132034355964, -21.2132034355964, -21.2132034355964], [31.2132034355964, 31.2132034355964, 31.2132034355964, 31.2132034355964, 31.2132034355964]]

On a project I’m currently working on I need to know whether data has gone past the max/min amount:

a = Normalizer.new(:min => [0], :max => [10])
a.normalize([50])
a.breaks_boundary?
  #=> true

Thanks¶ ↑

David Richards (blog.tegugears.com/)

Copyright © 2009 Red Davis. See LICENSE for details.