Method: FeatureSet::DataSet#output_numeric_arff
- Defined in:
- lib/feature_set/data_set.rb
#output_numeric_arff(io) ⇒ Object
This only knows how to output arfs with true/false classes and all numeric attributes. Additionally, every row must have the same attributes.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/feature_set/data_set.rb', line 62 def output_numeric_arff(io) keys = features.first.keys io.puts "@RELATION Data" keys.each do |key| io.puts "@ATTRIBUTE #{key} NUMERIC" unless key == :class end io.puts "@ATTRIBUTE class {false,true}" io.puts "@DATA" features.each do |feature| io.puts keys.map { |k| k == :class ? feature[k].to_s : feature[k].to_f }.join(",") end end |