Class: Datasets::Hepatitis

Inherits:
Dataset
  • Object
show all
Defined in:
lib/datasets/hepatitis.rb

Defined Under Namespace

Classes: Record

Instance Attribute Summary

Attributes inherited from Dataset

#metadata

Instance Method Summary collapse

Methods inherited from Dataset

#clear_cache!, #to_table

Constructor Details

#initializeHepatitis

Returns a new instance of Hepatitis.


161
162
163
164
165
166
167
168
169
# File 'lib/datasets/hepatitis.rb', line 161

def initialize
  super()
  @metadata.id = "hepatitis"
  @metadata.name = "Hepatitis"
  @metadata.url = "https://archive.ics.uci.edu/ml/datasets/hepatitis"
  @metadata.description = lambda do
    read_names
  end
end

Instance Method Details

#eachObject


171
172
173
174
175
176
177
178
179
180
# File 'lib/datasets/hepatitis.rb', line 171

def each
  return to_enum(__method__) unless block_given?

  open_data do |csv|
    csv.each do |row|
      record = Record.new(*row)
      yield(record)
    end
  end
end