Class: Datasets::Mushroom
Defined Under Namespace
Classes: Record
Instance Attribute Summary
Attributes inherited from Dataset
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize ⇒ Mushroom
constructor
A new instance of Mushroom.
Methods inherited from Dataset
Constructor Details
#initialize ⇒ Mushroom
Returns a new instance of Mushroom.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/datasets/mushroom.rb', line 33 def initialize super() .id = "mushroom" .name = "Mushroom" .url = "https://archive.ics.uci.edu/ml/datasets/mushroom" .licenses = ["CC-BY-4.0"] .description = lambda do read_names end end |
Instance Method Details
#each ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/datasets/mushroom.rb', line 44 def each return to_enum(__method__) unless block_given? open_data do |csv| csv.each do |row| next if row[0].nil? record = Record.new(*row) record.members.each do |member| record[member] = CONVERTERS[member][record[member]] end yield(record) end end end |