Last active
July 14, 2020 19:56
-
-
Save awaiskaleem/81fcf0ed227c718fb3fe03b6c975260e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_learning(recall,recall_live): | |
s3_client = boto3.Session(profile_name=None).client('s3') | |
s3_resource = boto3.resource('s3') | |
artifact_bucket = 'YOUR ARTIFACT BUCKET ON S3' | |
if recall>recall_live: | |
# Push live champion to history | |
try: | |
object = s3_client.get_object(Bucket=artifact_bucket, Key='mlflow/'+proj_id+'/live_model_run_history') | |
live_hist = object['Body'].read().decode("utf-8") | |
except botocore.exceptions.ClientError as e: | |
live_hist='' | |
object = s3_resource.Object(artifact_bucket, 'mlflow/'+proj_id+'/live_model_run_history') | |
object.put(Body=live_run+" \n"+live_hist) | |
#Promote active challenger to live champion | |
object = s3_resource.Object(artifact_bucket, 'mlflow/'+proj_id+'/live_model_run') | |
object.put(Body=active_run) | |
print("INFO: New model learnt.") | |
return 1 | |
else: | |
print("INFO: Old model has better performance, keeping it.") | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment