Class: Tangram::PredictOptions

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

Overview

These are the options passed to ‘predict`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compute_feature_contributions:, threshold: nil) ⇒ PredictOptions

Returns a new instance of PredictOptions.



25
26
27
28
# File 'lib/tangram/tangram.rb', line 25

def initialize(compute_feature_contributions:, threshold: nil)
  @threshold = threshold
  @compute_feature_contributions = compute_feature_contributions
end

Instance Attribute Details

#compute_feature_contributionsObject (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/tangram/tangram.rb', line 24

def compute_feature_contributions
  @compute_feature_contributions
end

#thresholdObject (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/tangram/tangram.rb', line 22

def threshold
  @threshold
end

Instance Method Details

#to_json(*args) ⇒ Object



29
30
31
# File 'lib/tangram/tangram.rb', line 29

def to_json(*args)
  {'threshold' => @threshold, 'compute_feature_contributions' => @compute_feature_contributions}.to_json(*args)
end