Class: NexosisApi::PredictResponse

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

Overview

Class to hold the parsed response of a prediction request

Since:

  • 1.3.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_id, response_hash) ⇒ PredictResponse

Returns a new instance of PredictResponse.

Since:

  • 1.3.0



5
6
7
8
9
# File 'lib/nexosis_api/predict_response.rb', line 5

def initialize(model_id, response_hash)
  @model_id = model_id
  @predictions = response_hash['data']
  @message = response_hash['messages']
end

Instance Attribute Details

#messagesArray

A list of warning message optionally returned from prediction run

Returns:

  • (Array)

Since:

  • 1.3.0



33
34
35
# File 'lib/nexosis_api/predict_response.rb', line 33

def messages
  @messages
end

#model_idString (readonly)

The unique identifier for the model used to create these predictions

Returns:

  • (String)

Since:

  • 1.3.0



13
14
15
# File 'lib/nexosis_api/predict_response.rb', line 13

def model_id
  @model_id
end

#predictionsArray of Hash

Note:

The result data includes an echo of the data sent to the predict request

The feature data along with predicted target value along with the target column containing the values predicted. [

{
  "feature1": 23.33,
  "target": 2.59
},
{
  "feature1": 15.82,
  "target": 1.75
}

]

Returns:

  • (Array of Hash)

    each row of data as a hash in an array of values

Since:

  • 1.3.0



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

def predictions
  @predictions
end