Skip to content

Instantly share code, notes, and snippets.

View SaschaHeyer's full-sized avatar
👨‍🚀

Sascha Heyer SaschaHeyer

👨‍🚀
View GitHub Profile
@SaschaHeyer
SaschaHeyer / response.json
Created January 28, 2023 16:31
response.json
{
"predictions": [
{
"confidence": 0.9409326314926147,
"sentiment": "POSITIVE"
}
]
}
@SaschaHeyer
SaschaHeyer / start_execution.py
Last active November 16, 2022 19:35
Vertex AI Experiments
training_data_artifact = aiplatform.Artifact.create(
schema_title='system.Dataset',
uri='gs://doit-vertex-demo/higgs/training.csv',
display_name='data')
with aiplatform.start_execution(
schema_title="system.ContainerExecution",
display_name='training'
) as execution:
@SaschaHeyer
SaschaHeyer / get_experiment_run_data.py
Created November 14, 2022 20:26
Vertex AI Experiments
experiment_run = aiplatform.ExperimentRun(
run_name='run-1668456760',
experiment='experiment-demo',
)
print(experiment_run.get_artifacts())
print(experiment_run.get_metrics())
print(experiment_run.get_params())
print(experiment_run.get_time_series_data_frame())
print(experiment_run.get_classification_metrics())
@SaschaHeyer
SaschaHeyer / compare.py
Created November 14, 2022 20:23
Vertex AI Endpoints
experiment_df = aiplatform.get_experiment_df()
experiment_df = experiment_df[experiment_df.experiment_name == 'experiment-demo']
experiment_df
@SaschaHeyer
SaschaHeyer / init_tensorboard.py
Last active November 14, 2022 16:22
Vertex AI Experiment
aiplatform.init(
project='sascha-playground-doit',
location='us-central1',
experiment='experiment-sample',
experiment_tensorboard='projects/sascha-playground-doit/locations/us-central1/tensorboards/6382621018774568960'
)
@SaschaHeyer
SaschaHeyer / tensorboard_instance.py
Created November 11, 2022 14:34
Vertex AI Experiments
experiment_tensorboard = vertex_ai.Tensorboard.create()
@SaschaHeyer
SaschaHeyer / artifact.py
Created November 11, 2022 09:51
Vertex AI Experiment
training_data_artifact = aiplatform.Artifact.create(
schema_title='system.Dataset',
uri='gs://doit-vertex-demo/higgs/training.csv',
display_name='training data')
@SaschaHeyer
SaschaHeyer / time_series_metrics.py
Last active November 14, 2022 16:20
Vertex AI Experiments
aiplatform.log_time_series_metrics({"mse": 2500.00, "rmse": 50.00})
aiplatform.log_time_series_metrics({"mse": 2600.00, "rmse": 60.00})
aiplatform.log_time_series_metrics({"mse": 2700.00, "rmse": 70.00})
@SaschaHeyer
SaschaHeyer / summary_metrics.py
Last active November 10, 2022 11:28
Vertex AI Experiments
metrics = {}
metrics["f1"] = 0.81
aiplatform.log_metrics(metrics)
@SaschaHeyer
SaschaHeyer / classification_metrics.py
Created November 10, 2022 11:21
Vertex AI Experiments
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
}