Class: Tangram::BinaryClassificationPredictOutput
- Inherits:
-
Object
- Object
- Tangram::BinaryClassificationPredictOutput
- Defined in:
- lib/tangram/tangram.rb
Overview
‘predict` outputs `BinaryClassificationPredictOutput` when the model’s task is binary classification.
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
This is the name of the predicted class.
-
#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.
-
#probability ⇒ Object
readonly
This is the probability the model assigned to the predicted class.
Instance Method Summary collapse
-
#initialize(class_name:, probability:, feature_contributions:) ⇒ BinaryClassificationPredictOutput
constructor
A new instance of BinaryClassificationPredictOutput.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(class_name:, probability:, feature_contributions:) ⇒ BinaryClassificationPredictOutput
Returns a new instance of BinaryClassificationPredictOutput.
57 58 59 60 61 |
# File 'lib/tangram/tangram.rb', line 57 def initialize(class_name:, probability:, feature_contributions:) @class_name = class_name @probability = probability @feature_contributions = feature_contributions end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
This is the name of the predicted class.
52 53 54 |
# File 'lib/tangram/tangram.rb', line 52 def class_name @class_name end |
#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.
56 57 58 |
# File 'lib/tangram/tangram.rb', line 56 def feature_contributions @feature_contributions end |
#probability ⇒ Object (readonly)
This is the probability the model assigned to the predicted class.
54 55 56 |
# File 'lib/tangram/tangram.rb', line 54 def probability @probability end |
Instance Method Details
#to_json(*args) ⇒ Object
62 63 64 |
# File 'lib/tangram/tangram.rb', line 62 def to_json(*args) {'class_name' => @class_name, "probability" => @probability}.to_json(*args) end |