Class: ModelFox::RegressionPredictOutput
- Inherits:
-
Object
- Object
- ModelFox::RegressionPredictOutput
- Defined in:
- lib/modelfox/modelfox.rb
Overview
‘predict` outputs `RegressionPredictOutput` when the model’s task is regression.
Instance Attribute Summary collapse
-
#feature_contributions ⇒ Object
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.
-
#value ⇒ Object
readonly
This is the predicted value.
Instance Method Summary collapse
-
#initialize(value:, feature_contributions:) ⇒ RegressionPredictOutput
constructor
A new instance of RegressionPredictOutput.
- #to_json(*args) ⇒ Object
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_contributions ⇒ Object (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 |
#value ⇒ Object (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 |