MachineLearning / Client / predict

predict#

MachineLearning.Client.predict(**kwargs)#

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.

See also: AWS API Documentation

Request Syntax

response = client.predict(
    MLModelId='string',
    Record={
        'string': 'string'
    },
    PredictEndpoint='string'
)
Parameters:
  • MLModelId (string) –

    [REQUIRED]

    A unique identifier of the MLModel.

  • Record (dict) –

    [REQUIRED]

    A map of variable name-value pairs that represent an observation.

    • (string) –

      The name of a variable. Currently it’s used to specify the name of the target value, label, weight, and tags.

      • (string) –

        The value of a variable. Currently it’s used to specify values of the target value, weights, and tag variables and for filtering variable values.

  • PredictEndpoint (string) – [REQUIRED]

Return type:

dict

Returns:

Response Syntax

{
    'Prediction': {
        'predictedLabel': 'string',
        'predictedValue': ...,
        'predictedScores': {
            'string': ...
        },
        'details': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) –

    • Prediction (dict) –

      The output from a Predict operation:

      • Details - Contains the following attributes: DetailsAttributes.PREDICTIVE_MODEL_TYPE - REGRESSION | BINARY | MULTICLASS DetailsAttributes.ALGORITHM - SGD

      • PredictedLabel - Present for either a BINARY or MULTICLASS MLModel request.

      • PredictedScores - Contains the raw classification score corresponding to each label.

      • PredictedValue - Present for a REGRESSION MLModel request.

      • predictedLabel (string) –

        The prediction label for either a BINARY or MULTICLASS MLModel.

      • predictedValue (float) –

        The prediction value for REGRESSION MLModel.

      • predictedScores (dict) –

        Provides the raw classification score corresponding to each label.

        • (string) –

          • (float) –

      • details (dict) –

        Provides any additional details regarding the prediction.

        • (string) –

          Contains the key values of DetailsMap:

          • PredictiveModelType - Indicates the type of the MLModel.

          • Algorithm - Indicates the algorithm that was used for the MLModel.

          • (string) –

Exceptions

  • MachineLearning.Client.exceptions.InvalidInputException

  • MachineLearning.Client.exceptions.ResourceNotFoundException

  • MachineLearning.Client.exceptions.LimitExceededException

  • MachineLearning.Client.exceptions.InternalServerException

  • MachineLearning.Client.exceptions.PredictorNotMountedException