Class: ModelFox::PredictOptions
- Inherits:
-
Object
- Object
- ModelFox::PredictOptions
- Defined in:
- lib/modelfox/modelfox.rb
Overview
These are the options passed to ‘predict`.
Instance Attribute Summary collapse
-
#compute_feature_contributions ⇒ Object
readonly
Computing feature contributions is disabled by default.
-
#threshold ⇒ Object
readonly
If your model is a binary classifier, use this field to make predictions using a threshold chosen on the tuning page of the app.
Instance Method Summary collapse
-
#initialize(compute_feature_contributions:, threshold: nil) ⇒ PredictOptions
constructor
A new instance of PredictOptions.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(compute_feature_contributions:, threshold: nil) ⇒ PredictOptions
Returns a new instance of PredictOptions.
25 26 27 28 |
# File 'lib/modelfox/modelfox.rb', line 25 def initialize(compute_feature_contributions:, threshold: nil) @threshold = threshold @compute_feature_contributions = compute_feature_contributions end |
Instance Attribute Details
#compute_feature_contributions ⇒ Object (readonly)
Computing feature contributions is disabled by default. If you set this field to ‘true`, you will be able to access the feature contributions with the `feature_contributions` field of the predict output.
24 25 26 |
# File 'lib/modelfox/modelfox.rb', line 24 def compute_feature_contributions @compute_feature_contributions end |
#threshold ⇒ Object (readonly)
If your model is a binary classifier, use this field to make predictions using a threshold chosen on the tuning page of the app. The default value is ‘0.5`.
22 23 24 |
# File 'lib/modelfox/modelfox.rb', line 22 def threshold @threshold end |
Instance Method Details
#to_json(*args) ⇒ Object
29 30 31 |
# File 'lib/modelfox/modelfox.rb', line 29 def to_json(*args) {'threshold' => @threshold, 'compute_feature_contributions' => @compute_feature_contributions}.to_json(*args) end |