Class: Datarobot::AiApi::Prediction

Inherits:
Object
  • Object
show all
Defined in:
lib/datarobot/ai_api/prediction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Prediction

Takes a response body from the API. Will set all prediction attributes from the response body

Parameters:

  • options (Hash) (defaults to: {})

    A parsed response body



10
11
12
13
14
15
16
17
# File 'lib/datarobot/ai_api/prediction.rb', line 10

def initialize(options={})
  # one-liner replacement for `stringify_keys`
  options = options.collect{|k,v| [k.to_s, v]}.to_h

  @prediction = options.dig("prediction")
  @row_id = options.dig("rowId")
  @data = options.dig("data")
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/datarobot/ai_api/prediction.rb', line 4

def data
  @data
end

#predictionObject (readonly)

Returns the value of attribute prediction.



4
5
6
# File 'lib/datarobot/ai_api/prediction.rb', line 4

def prediction
  @prediction
end

#row_idObject (readonly)

Returns the value of attribute row_id.



4
5
6
# File 'lib/datarobot/ai_api/prediction.rb', line 4

def row_id
  @row_id
end