QTZPOC-20
QTZPOC-20: Add skip_predict_timestamp flag to model_config to prevent timestamp reinsertion in prediction data, and document other ad-hoc behavioral flags.
This commit is contained in:
@@ -237,6 +237,9 @@ class MLFlow(MinioManager):
|
||||
- data (dict): Transformed data for prediction
|
||||
- model_name (str): Name of the MLFlow model to use
|
||||
- model_retention (int): Model retention period in minutes
|
||||
Optional keys (in model_config):
|
||||
- skip_predict_timestamp (bool): If True, don't reinsert the
|
||||
timestamp column from the index before predicting. Default False.
|
||||
|
||||
Returns:
|
||||
dict: Prediction results from MLFlow model
|
||||
@@ -258,10 +261,11 @@ class MLFlow(MinioManager):
|
||||
# Convert numpy.nan to None for model compatibility
|
||||
data.replace(np.nan, None, inplace=True)
|
||||
|
||||
data['timestamp'] = data.index
|
||||
data['timestamp'] = to_datetime(
|
||||
data['timestamp'], format=DATETIME_FORMAT_WITH_TZ
|
||||
).dt.strftime(DATETIME_FORMAT)
|
||||
if not model_config.get('skip_predict_timestamp', False):
|
||||
data['timestamp'] = data.index
|
||||
data['timestamp'] = to_datetime(
|
||||
data['timestamp'], format=DATETIME_FORMAT_WITH_TZ
|
||||
).dt.strftime(DATETIME_FORMAT)
|
||||
|
||||
# Request prediction from MLFlow model
|
||||
response_data = await self.model_monitoring_repository.predict(
|
||||
|
||||
Reference in New Issue
Block a user