Class: Jubatus::Regression::ScoredDatum

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/jubatus/regression/types.rb

Constant Summary collapse

TYPE =
TTuple.new(TFloat.new, TDatum.new)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

check_type, check_types

Constructor Details

#initialize(score, data) ⇒ ScoredDatum

Returns a new instance of ScoredDatum.


15
16
17
18
# File 'lib/jubatus/regression/types.rb', line 15

def initialize(score, data)
  @score = score
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data


39
40
41
# File 'lib/jubatus/regression/types.rb', line 39

def data
  @data
end

#scoreObject (readonly)

Returns the value of attribute score


39
40
41
# File 'lib/jubatus/regression/types.rb', line 39

def score
  @score
end

Class Method Details

.from_msgpack(m) ⇒ Object


25
26
27
28
# File 'lib/jubatus/regression/types.rb', line 25

def ScoredDatum.from_msgpack(m)
  val = TYPE.from_msgpack(m)
  ScoredDatum.new(*val)
end

Instance Method Details

#to_msgpack(out = '') ⇒ Object


20
21
22
23
# File 'lib/jubatus/regression/types.rb', line 20

def to_msgpack(out = '')
  t = [@score, @data]
  return TYPE.to_msgpack(t)
end

#to_sObject


30
31
32
33
34
35
36
37
# File 'lib/jubatus/regression/types.rb', line 30

def to_s
  gen = Jubatus::Common::MessageStringGenerator.new
  gen.open("scored_datum")
  gen.add("score", @score)
  gen.add("data", @data)
  gen.close()
  return gen.to_s
end