predict method

Future<PredictOutput> predict({
  1. required String mLModelId,
  2. required String predictEndpoint,
  3. required Map<String, String> record,
})

Generates a prediction for the observation using the specified ML Model.

Note: Not all response parameters will be populated. Whether a response parameter is populated depends on the type of model requested.

May throw InternalServerException. May throw InvalidInputException. May throw LimitExceededException. May throw PredictorNotMountedException. May throw ResourceNotFoundException.

Parameter mLModelId : A unique identifier of the MLModel.

Implementation

Future<PredictOutput> predict({
  required String mLModelId,
  required String predictEndpoint,
  required Map<String, String> record,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonML_20141212.Predict'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MLModelId': mLModelId,
      'PredictEndpoint': predictEndpoint,
      'Record': record,
    },
  );

  return PredictOutput.fromJson(jsonResponse.body);
}