Class: Datarobot::AiApi::Output
- Inherits:
-
Object
- Object
- Datarobot::AiApi::Output
- Defined in:
- lib/datarobot/ai_api/output.rb
Instance Attribute Summary collapse
-
#ai_id ⇒ Object
readonly
Returns the value of attribute ai_id.
-
#evaluation ⇒ Object
readonly
Returns the value of attribute evaluation.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#name ⇒ Object
Returns the value of attribute name.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
-
.create(ai_id:, learning_session_id:, output_name:) ⇒ Datarobot::AiApi::Output
Creates a new output on the given target for a given dataset.
Instance Method Summary collapse
-
#features ⇒ Array
gets all feature metadata for learned features of the associated dataset.
-
#initialize(options = {}) ⇒ Output
constructor
Given a parsed response body from the API, will create a new ouptut object.
-
#set_from_options(options = {}) ⇒ void
Takes a response body from the API.
Constructor Details
#initialize(options = {}) ⇒ Output
Given a parsed response body from the API, will create a new ouptut object
8 9 10 11 |
# File 'lib/datarobot/ai_api/output.rb', line 8 def initialize( = {}) () @features = nil end |
Instance Attribute Details
#ai_id ⇒ Object (readonly)
Returns the value of attribute ai_id.
5 6 7 |
# File 'lib/datarobot/ai_api/output.rb', line 5 def ai_id @ai_id end |
#evaluation ⇒ Object (readonly)
Returns the value of attribute evaluation.
5 6 7 |
# File 'lib/datarobot/ai_api/output.rb', line 5 def evaluation @evaluation end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
5 6 7 |
# File 'lib/datarobot/ai_api/output.rb', line 5 def links @links end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/datarobot/ai_api/output.rb', line 4 def name @name end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/datarobot/ai_api/output.rb', line 5 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
4 5 6 |
# File 'lib/datarobot/ai_api/output.rb', line 4 def target @target end |
Class Method Details
.create(ai_id:, learning_session_id:, output_name:) ⇒ Datarobot::AiApi::Output
Creates a new output on the given target for a given dataset
assocaite this output with
37 38 39 40 41 42 43 44 |
# File 'lib/datarobot/ai_api/output.rb', line 37 def self.create(ai_id:, learning_session_id:, output_name:) req_body = {learningSessionId: learning_session_id, outputName: output_name} Datarobot::AiApi.request_endpoint("/aiapi/ais/#{ai_id}/outputs/", method: "put", body: req_body) do |data| output = new(data) output.name = output_name output end end |
Instance Method Details
#features ⇒ Array
gets all feature metadata for learned features of the associated dataset
50 51 52 53 54 55 |
# File 'lib/datarobot/ai_api/output.rb', line 50 def features raise "no ai id" unless @ai_id Datarobot::AiApi.request_endpoint("/aiapi/ais/#{@ai_id}/outputs/#{@name}/features") do |data| @features = data["features"] end end |
#set_from_options(options = {}) ⇒ void
This method returns an undefined value.
Takes a response body from the API. Will set all output attributes from the response body
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datarobot/ai_api/output.rb', line 18 def ( = {}) # one-liner replacement for `stringify_keys` = .collect{|k,v| [k.to_s, v]}.to_h @name ||= .dig("name") @target ||= .dig("target") @source ||= .dig("source") @links ||= .dig("links") @ai_id ||= .dig("aiId") @evaluation ||= Datarobot::AiApi::Evaluation.new(.dig("evaluation") || {}) end |