:doc:`MachineLearning <../../machinelearning>` / Client / predict

*******
predict
*******



.. py:method:: 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 <https://docs.aws.amazon.com/goto/WebAPI/machinelearning-2014-12-12/Predict>`_  


  **Request Syntax**
  ::

    response = client.predict(
        MLModelId='string',
        Record={
            'string': 'string'
        },
        PredictEndpoint='string'
    )
    
  :type MLModelId: string
  :param MLModelId: **[REQUIRED]** 

    A unique identifier of the ``MLModel``.

    

  
  :type Record: dict
  :param Record: **[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.

        

      


  :type PredictEndpoint: string
  :param PredictEndpoint: **[REQUIRED]** 

  
  
  :rtype: 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**
  
  *   :py:class:`MachineLearning.Client.exceptions.InvalidInputException`

  
  *   :py:class:`MachineLearning.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`MachineLearning.Client.exceptions.LimitExceededException`

  
  *   :py:class:`MachineLearning.Client.exceptions.InternalServerException`

  
  *   :py:class:`MachineLearning.Client.exceptions.PredictorNotMountedException`

  