Class: Jubatus::Classifier::LabeledDatum
- Inherits:
-
Object
- Object
- Jubatus::Classifier::LabeledDatum
- Includes:
- Jubatus::Common
- Defined in:
- lib/jubatus/classifier/types.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(label, data) ⇒ LabeledDatum
constructor
A new instance of LabeledDatum.
- #to_msgpack(out = '') ⇒ Object
- #to_s ⇒ Object
Methods included from Jubatus::Common
Constructor Details
#initialize(label, data) ⇒ LabeledDatum
Returns a new instance of LabeledDatum.
47 48 49 50 |
# File 'lib/jubatus/classifier/types.rb', line 47 def initialize(label, data) @label = label @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
71 72 73 |
# File 'lib/jubatus/classifier/types.rb', line 71 def data @data end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
71 72 73 |
# File 'lib/jubatus/classifier/types.rb', line 71 def label @label end |
Class Method Details
.from_msgpack(m) ⇒ Object
57 58 59 60 |
# File 'lib/jubatus/classifier/types.rb', line 57 def LabeledDatum.from_msgpack(m) val = TYPE.from_msgpack(m) LabeledDatum.new(*val) end |
Instance Method Details
#to_msgpack(out = '') ⇒ Object
52 53 54 55 |
# File 'lib/jubatus/classifier/types.rb', line 52 def to_msgpack(out = '') t = [@label, @data] return TYPE.to_msgpack(t) end |
#to_s ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/jubatus/classifier/types.rb', line 62 def to_s gen = Jubatus::Common::MessageStringGenerator.new gen.open("labeled_datum") gen.add("label", @label) gen.add("data", @data) gen.close() return gen.to_s end |