
    E                     v    S r  " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S	 S
\5      rg)zFInterfaces and other classes for providing custom code for prediction.c                   .    \ rS rSrSrS r\S 5       rSrg)Model   a  A Model performs predictions on a given list of instances.

The input instances are the raw values sent by the user. It is the
responsibility of a Model to translate these instances into
actual predictions.

The input instances and the output use python data types. The input
instances have been decoded prior to being passed to the predict
method. The output, which should use python data types is
encoded after being returned from the predict method.
c                     [        5       e)a  Returns predictions for the provided instances.

Instances are the decoded values from the request. Clients need not worry
about decoding json nor base64 decoding.

Args:
  instances: A list of instances, as described in the API.
  **kwargs: Additional keyword arguments, will be passed into the client's
      predict method.

Returns:
  A list of outputs containing the prediction results.

Raises:
  PredictionError: If an error occurs during prediction.
NotImplementedErrorself	instanceskwargss      9lib/third_party/ml_sdk/cloud/ml/prediction/_interfaces.pypredictModel.predict   s    " 
    c                     [        5       e)ab  Creates a model using the given model path.

Path is useful, e.g., to load files from the exported directory containing
the model.

Args:
  model_path: The local directory that contains the exported model file
      along with any additional files uploaded when creating the version
      resource.

Returns:
  An instance implementing this Model class.
r   cls
model_paths     r   	from_pathModel.from_path1   s     
r    N)	__name__
__module____qualname____firstlineno____doc__r   classmethodr   __static_attributes__r   r   r   r   r      s     
 &    r   r   c                   *    \ rS rSrSrS rS rS rSrg)PredictionClientC   ad  A client for Prediction.

No assumptions are made about whether the prediction happens in process,
across processes, or even over the network.

The inputs, unlike Model.predict, have already been "columnarized", i.e.,
a dict mapping input names to values for a whole batch, much like
Session.run's feed_dict parameter. The return value is the same format.
c                     g )Nr   )r	   argsr   s      r   __init__PredictionClient.__init__N   s    r   c                     [        5       ezProduces predictions for the given inputs.

Args:
  inputs: A dict mapping input names to values.
  **kwargs: Additional keyword arguments for prediction

Returns:
  A dict mapping output names to output values, similar to the input
  dict.
r   r	   inputsr   s      r   r   PredictionClient.predictQ        
r   c                     [        5       er&   r   r'   s      r   explainPredictionClient.explain^   r*   r   r   N)	r   r   r   r   r   r#   r   r,   r   r   r   r   r   r   C   s    	  r   r   c                   (    \ rS rSrSr\S 5       rSrg)	Processorl   z/Interface for constructing instance processors.c                     [        5       e)zCreates a processor using the given model path.

Args:
  model_path: The path to the stored model.

Returns:
  An instance implementing this Processor class.
r   r   s     r   from_model_pathProcessor.from_model_patho        
r   r   N)r   r   r   r   r   r   r2   r   r   r   r   r/   r/   l   s    7	  	 r   r/   c                       \ rS rSrSrS rSrg)Preprocessor|   z?Interface for processing a list of instances before prediction.c                     [        5       e)zThe preprocessing function.

Args:
  instances: A list of instances, as provided to the predict() method.
  **kwargs: Additional keyword arguments for preprocessing.

Returns:
  The processed instance to use in the predict() method.
r   r   s      r   
preprocessPreprocessor.preprocess   r4   r   r   N)r   r   r   r   r   r9   r   r   r   r   r6   r6   |   s
    G
 r   r6   c                       \ rS rSrSrS rSrg)Postprocessor   z>Interface for processing a list of instances after prediction.c                     [        5       e)zThe postprocessing function.

Args:
  instances: A list of instances, as provided to the predict() method.
  **kwargs: Additional keyword arguments for postprocessing.

Returns:
  The processed instance to return as the final prediction output.
r   r   s      r   postprocessPostprocessor.postprocess   r4   r   r   N)r   r   r   r   r   r?   r   r   r   r   r<   r<      s
    F
 r   r<   N)r   objectr   r   r/   r6   r<   r   r   r   <module>rB      sI    M/ F / d& v & R     6    F  r   