MLRAM¶
Auger model¶
Import dataset and Train to get model
Make sure review section is correct in config.yml
Deploy model. It will add model to review section in Auger.ai
Predict and send actuals. See actuals API
Monitored model¶
See application example: https://github.com/augerai/mlram_apps
Create A2ML application with external provider:
$ a2ml new test_app -p external
Specify the following parameters in config.yml:
target: the feature which is the target model_type: Can be regression or classification experiment: metric: <metric to calculate using actuals> review: roi: <See configuration section> alert: <See configuration section>
Deploy model without model id:
ctx = Context() a2ml = A2ML(ctx) result = a2ml.deploy(model_id=None, name="My Monitored model.", algorithm="RandomForest", score=0.76) model_id = result['data']['model_id']
Send actuals:
ctx = Context() actual_records = [['predicted_value_1', 'actual_value_1'], ['predicted_value_2', 'actual_value_2']] columns = [target, 'actual'] A2ML(ctx, "external").actuals('external_model_id', data=actual_records,columns=columns)
To review distribution chart , send training features with target and actuals:
ctx = Context() actual_records = [['predicted_value_1', 'actual_value_1', 'value1', 'value2'], ['predicted_value_2', 'actual_value_2', 'value3', 'value4']] columns = [target, 'actual', 'feature1', 'feature2'] A2ML(ctx, "external").actuals('external_model_id', data=actual_records,columns=columns)
Call review to check if model retrain is required:
# If call just after actuals, wait some time till server process the data time.sleep(30) ctx = Context() result = A2ML(ctx).review(model_id='external_model_id') if result['data']['status'] == 'retrain': #Train new model using updated data a2ml.deploy(model_id=None, name="My Monitored model.", algorithm="RandomForest", score=0.77)