class Datasets::LIBSVM::Record

Attributes

features[R]
label[R]

Public Class Methods

new(label, features) click to toggle source
# File lib/datasets/libsvm.rb, line 10
def initialize(label, features)
  @label = label
  @features = features
end

Public Instance Methods

[](index) click to toggle source
# File lib/datasets/libsvm.rb, line 15
def [](index)
  @features[index]
end
to_h() click to toggle source
# File lib/datasets/libsvm.rb, line 19
def to_h
  hash = {
    label: @label,
  }
  @features.each_with_index do |feature, i|
    hash[i] = feature
  end
  hash
end
values() click to toggle source
# File lib/datasets/libsvm.rb, line 29
def values
  [@label] + @features
end