Sha256: 50ae812759e0d469a3b4cb27f4f6e9e63c9adee66557bb4464cec6225fb08804

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

  #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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glm-0.0.2 examples/prepare.rb
glm-0.0.1 examples/prepare.rb
glm-0.0.0 examples/prepare.rb