predict method
Generates a prediction for the observation using the specified ML
Model
.
May throw InvalidInputException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw InternalServerException. May throw PredictorNotMountedException.
Parameter mLModelId
:
A unique identifier of the MLModel
.
Implementation
Future<PredictOutput> predict({
required String mLModelId,
required String predictEndpoint,
required Map<String, String> record,
}) async {
ArgumentError.checkNotNull(mLModelId, 'mLModelId');
_s.validateStringLength(
'mLModelId',
mLModelId,
1,
64,
isRequired: true,
);
ArgumentError.checkNotNull(predictEndpoint, 'predictEndpoint');
_s.validateStringLength(
'predictEndpoint',
predictEndpoint,
0,
2048,
isRequired: true,
);
ArgumentError.checkNotNull(record, 'record');
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);
}