hydrosdk.predictor module¶
- show-inheritance
- class hydrosdk.predictor.MonitorableApplicationPredictionService(channel, target)¶
Sends data to an application and shadows it to the monitoring services.
- Parameters
channel –
target (str) – Name of an application, which will receive data.
- class hydrosdk.predictor.MonitorableServablePredictionService(channel, target)¶
Sends data to a servable and shadows it to the monitoring services.
- Parameters
channel –
target (str) – Name of a servable, which will receive the data.
- class hydrosdk.predictor.PredictImplementation¶
- class hydrosdk.predictor.PredictServiceClient(impl, signature, return_type)¶
PredictServiceClient is the main way of passing your data to a deployed ModelVersion
Creates a client through which you could send your data. :param impl: implementation - either Monitorable (which shadows data to monitoring services), either not :param signature: ModelVersion signature which is used to encode/decode your data into proto messages :param return_type: One of 3 ways (Pandas, Numpy, Python) to represent a ModelVersion output
- Parameters
signature (hydro_serving_grpc.serving.contract.signature_pb2.ModelSignature) –
return_type (hydrosdk.data.types.PredictorDT) –
- predict(inputs)¶
Sends data to the model version deployed in the cluster and returns the response from it.
This methods hides the conversion of Python/Numpy objects into a TensorProto objects.
- Parameters
inputs (Union[pandas.core.frame.DataFrame, dict, pandas.core.series.Series]) – Input data in either Pandas DataFrame, Numpy or Python lists/scalars.
- Returns
Output data in a format specified by return_type
- Return type
Union[pandas.core.frame.DataFrame, Dict]
- static predict_resp_to_df(response)¶
Transform PredictResponse into a pandas.DataFrame by using intermediate representation of Dict[str, np.array] :param response: PredictResponse proto message returned from the runtime :return: pandas DataFrame
- Parameters
response (hydro_serving_grpc.serving.runtime.api_pb2.PredictResponse) –
- Return type
pandas.core.frame.DataFrame
- static predict_resp_to_dict_np(response)¶
Transform PredictResponse into a Dictionary with Numpy arrays/scalars :param response: PredictResponse proto message returned from the runtime :return: Dictionary with Numpy arrays
- Parameters
response (hydro_serving_grpc.serving.runtime.api_pb2.PredictResponse) –
- Return type
Dict[str, numpy.array]
- static predict_resp_to_dict_pydtype(response)¶
Transform PredictResponse into a Dictionary with Python lists/scalars :param response: PredictResponse proto message returned from the runtime :return: Dictionary with Python list/scalars
- Parameters
response (hydro_serving_grpc.serving.runtime.api_pb2.PredictResponse) –
- Return type
Dict