- Newest
- Most votes
- Most comments
Hello,
I understand that you tried to create a data monitoring schedule using the DefaultModelMonitor, but the output order was not preserved and would like to gather more information on the same.
Here, the issue you're facing is likely due to the order of the features being changed when the monitoring job generates the new constraints.json file. This is because the order of the features in the new constraints.json file may not match the order in which you're returning the features from the preprocess_handler.
One solution to this problem is to create the output dictionary in the preprocess_handler using an OrderedDict from the collections module. This way, the order of the features will be preserved when you return the dictionary from the preprocess_handler.
Here's how you can modify your preprocess_handler:
from collections import OrderedDict
def preprocess_handler(inference_record):
input_data = inference_record.endpoint_input.data
output_data = inference_record.endpoint_output.data
result = OrderedDict()
result['most_recent_enrollment'] = output_data["recommendations"][0] if len(output_data["recommendations"]) > 0 else None
result['previous_enrollment'] = input_data['inputs']['most_recent_enrollment']
result['most_recent_click'] = input_data['inputs']['most_recent_xdp_view']
result['locale'] = input_data['inputs']['locale']
result['occupation_id'] = input_data['inputs']['occupation_id']
result['most_recent_skill_viewed'] = input_data['inputs']['skill_id']
return result
By using OrderedDict, the order of the features in the dictionary will be preserved, and the new constraints.json file should match the order in which you're returning the features from the preprocess_handler.
I would request that you please try this on your end and let us know how it goes for you.
If you have any difficulty or if you still run into issues, please reach out to AWS Support [1] (Sagemaker) along with your issue or use case in detail, and we would be happy to assist you further.
References:
[1] Creating support cases and case management: https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#creating-a-support-case
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 9 months ago