#It just loads iris data as a 2-d array, rows being samples, columns 0...n-1 being flaot-valued features and column n-1 being target {0,1} def load_iris ifile = File.open( File.join("data","iris.data")) iris = ((ifile.readlines.map {|l| fields = l.chomp.split(pattern=",") fields }).select {|fields| fields[4] != "Iris-virginica" && fields != []}).map {|fields| fields[4] = (fields[4] == "Iris-setosa") ? 1 : 0 fields.map{|f| f.to_f}} ifile.close return iris end