Data Prep

Data Prep is a gem that makes extracting: training, testing and validation data nice and simple.

All you have to do is give it your data and Data Prep will try to spread your classes as evenly as possible in a 50:25:25 (training, testing, validation) split.

Example

ham = [[1, 0.5]] * 20
spam = [[0, 0.2]] * 20
data_prep = DataPrep.new(1 => ham, 0 => spam)

data_prep.testing.size
   #=> 10
data_prep.validation.size
   #=> 10
data_prep.training.size
   #=> 20

# To make training easy, Data Prep places the data's class
# along side the piece of data

data_prep.training[0].inspect
   #=> [[1, 0.5], [1]] == [[data], [output]]

Copyright © 2009 Red Davis. See LICENSE for details.