Class: ModelFox::RegressionPredictOutput

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

Overview

‘predict` outputs `RegressionPredictOutput` when the model’s task is regression.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, feature_contributions:) ⇒ RegressionPredictOutput

Returns a new instance of RegressionPredictOutput.



40
41
42
43
# File 'lib/modelfox/modelfox.rb', line 40

def initialize(value:, feature_contributions:)
  @value = value
  @feature_contributions = feature_contributions
end

Instance Attribute Details

#feature_contributionsObject (readonly)

If computing feature contributions was enabled in the predict options, this value will explain the model’s output, showing how much each feature contributed to the output.



39
40
41
# File 'lib/modelfox/modelfox.rb', line 39

def feature_contributions
  @feature_contributions
end

#valueObject (readonly)

This is the predicted value.



37
38
39
# File 'lib/modelfox/modelfox.rb', line 37

def value
  @value
end

Instance Method Details

#to_json(*args) ⇒ Object



44
45
46
# File 'lib/modelfox/modelfox.rb', line 44

def to_json(*args)
  {'value' => @value}.to_json(*args)
end