Skip to content

Instantly share code, notes, and snippets.

@siakon89
Last active July 5, 2020 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siakon89/28e3f2285d5a0ee69714579933863cee to your computer and use it in GitHub Desktop.
Save siakon89/28e3f2285d5a0ee69714579933863cee to your computer and use it in GitHub Desktop.
from smdebug.trials import create_trial
from smdebug import modes
import numpy as np
import matplotlib.pyplot as plt
# Get the tensors from S3
s3_output_path = estimator.latest_job_debugger_artifacts_path()
# Create a Trial https://github.com/awslabs/sagemaker-debugger/blob/master/docs/analysis.md#Trial
trial = create_trial(s3_output_path)
# Get all the tensor names
trial.tensor_names()
# Get the values of the tensor `val_acc`for mode GLOBAL (validation accuracy)
values = trial.tensor("val_acc").values(modes.GLOBAL)
# Convert it to numpy array
values_eval = np.array(list(values.items()))
fig = plt.figure()
plt.plot(values_eval[:, 1])
fig.suptitle('Validation Accuracy', fontsize=20)
plt.xlabel('Intervals of sampling', fontsize=18)
plt.ylabel('Acuracy', fontsize=16)
fig.savefig('temp.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment