evidently
evidently copied to clipboard
Fix issue with datetime_features column mapping
Description
An error occurs under the following conditions:
- you specify
datetime_features
in column mapping - the datatime feature name starts with "prediction"
- you run the Target Drift preset
It fails with an error Cannot calculate drift metric for column 'prediction' with type ColumnType.Datetime
. It appears to incorrectly parse the datatime feature as the prediction column.
Example mapping:
column_mapping_1 = ColumnMapping()
column_mapping_1.prediction="prediction"
column_mapping_1.datetime_features="prediction_timestamp_utc"
Example report (fails):
target_drift_report = Report(metrics=[
TargetDriftPreset(),
])
target_drift_report.run(reference_data=ref, current_data=cur, column_mapping=column_mapping_1)
target_drift_report
However, it works correctly if:
- the datetime feature column does not have "prediction" in its name (for example, it is called
timestamp_utc
) - the datatime column is passed as
datetime
and notdatetime_features
Reproducible example https://colab.research.google.com/drive/13hdgU0mSPTiwjq5pAEAgQZApUcM5v3nV
Implementation:
Fix the bug + it seems worth checking how datetime_features
are treated in other reports.