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
| metrics = {} | |
| metrics["f1"] = 0.81 | |
| aiplatform.log_metrics(metrics) |
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
| from sklearn.metrics import confusion_matrix | |
| labels = ["ant", "bird", "cat"] | |
| y_true = ["cat", "ant", "cat", "cat", "ant", "bird"] | |
| y_pred = ["ant", "ant", "cat", "cat", "ant", "cat"] | |
| classification_metrics = { | |
| "matrix": confusion_matrix(y_true, y_pred, labels=labels).tolist(), | |
| "labels": labels | |
| } |
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
| metaparams = {} | |
| metaparams["batch_size"] = 256 | |
| aiplatform.log_params(metaparams) |
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
| aiplatform.start_run('run-1') | |
| # log metrics | |
| # log parameters | |
| # log artifacts | |
| aiplatform.end_run() |
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
| pip install google-cloud-aiplatform | |
| import google.cloud.aiplatform as aiplatform |
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
| aiplatform.init( | |
| project='sascha-playground-doit', | |
| location='us-central1', | |
| experiment='experiment-sample' | |
| ) |
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
| DISPLAY_NAME = "recommendation" | |
| models = aiplatform.Model.list(filter=("display_name={}").format(DISPLAY_NAME)) | |
| if len(models) == 0: | |
| model_upload = aiplatform.Model.upload( | |
| display_name = DISPLAY_NAME | |
| ) | |
| else: | |
| parent_model = models[0].resource_name |
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
| aiplatform.Model.upload( | |
| version_aliases=["experimental"] | |
| ) |
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
| aiplatform.Model.upload( | |
| is_default_version=False, | |
| ) |
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
| aiplatform.Model.upload( | |
| version_description="This is a test version description" | |
| ) |