Class: LabelsFromUCI

Inherits:
Object
  • Object
show all
Defined in:
lib/data_frame/labels_from_uci.rb

Overview

Turns out, this isn’t very useful. So…oh well. By the way, the code I’m talking about is found here: archive.ics.uci.edu/ml/ And to use this class: require ‘lib/data_frame/labels_from_uci’ df = LabelsFromUCI.data_frame ‘archive.ics.uci.edu/ml/machine-learning-databases/communities/communities.names’ df.import(‘archive.ics.uci.edu/ml/machine-learning-databases/communities/communities.data’)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ LabelsFromUCI

Returns a new instance of LabelsFromUCI.



29
30
31
32
33
# File 'lib/data_frame/labels_from_uci.rb', line 29

def initialize(url)
  @url = url
  open(url) { |f| @contents = f.read }
  process_labels
end

Instance Attribute Details

#contentsObject (readonly)

Returns the value of attribute contents.



27
28
29
# File 'lib/data_frame/labels_from_uci.rb', line 27

def contents
  @contents
end

#labelsObject (readonly)

Returns the value of attribute labels.



27
28
29
# File 'lib/data_frame/labels_from_uci.rb', line 27

def labels
  @labels
end

#urlObject (readonly)

Returns the value of attribute url.



27
28
29
# File 'lib/data_frame/labels_from_uci.rb', line 27

def url
  @url
end

Class Method Details

.data_frame(url) ⇒ Object



21
22
23
24
# File 'lib/data_frame/labels_from_uci.rb', line 21

def data_frame(url)
  lfu = new(url)
  DataFrame.new(lfu.labels)
end

.process(url) ⇒ Object



16
17
18
19
# File 'lib/data_frame/labels_from_uci.rb', line 16

def process(url)
  lfu = new(url)
  lfu.labels
end