Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# The following code is used by the notebook "24_run_notebook_on_azureml.ipynb" to log metrics when using papermill or scrapbook
# to run this notebook. We can comment out this cell when we are running this notebook directly.
training_losses = [x.numpy().ravel()[0] for x in learn.recorder.losses]
training_accuracy = [x[0].numpy().ravel()[0] for x in learn.recorder.metrics]
# pm.record may get deprecated and completely replaced by sb.glue:
# https://github.com/nteract/scrapbook#papermills-deprecated-record-feature
try:
sb.glue("training_loss", training_losses)
sb.glue("training_accuracy", training_accuracy)
sb.glue("Accuracy on validation set:", 100 * float(metric))
except Exception:
pm.record("training_loss", training_losses)
pm.record("training_accuracy", training_accuracy)
pm.record("Accuracy on validation set:", 100 * float(metric))
# The following code is used by the notebook "24_run_notebook_on_azureml.ipynb" to log metrics when using papermill or scrapbook
# to run this notebook. We can comment out this cell when we are running this notebook directly.
training_losses = [x.numpy().ravel()[0] for x in learn.recorder.losses]
training_accuracy = [x[0].numpy().ravel()[0] for x in learn.recorder.metrics]
# pm.record may get deprecated and completely replaced by sb.glue:
# https://github.com/nteract/scrapbook#papermills-deprecated-record-feature
try:
sb.glue("training_loss", training_losses)
sb.glue("training_accuracy", training_accuracy)
sb.glue("Accuracy on validation set:", 100 * float(metric))
except Exception:
pm.record("training_loss", training_losses)
pm.record("training_accuracy", training_accuracy)
pm.record("Accuracy on validation set:", 100 * float(metric))
# The following code is used by the notebook "24_run_notebook_on_azureml.ipynb" to log metrics when using papermill or scrapbook
# to run this notebook. We can comment out this cell when we are running this notebook directly.
training_losses = [x.numpy().ravel()[0] for x in learn.recorder.losses]
training_accuracy = [x[0].numpy().ravel()[0] for x in learn.recorder.metrics]
# pm.record may get deprecated and completely replaced by sb.glue:
# https://github.com/nteract/scrapbook#papermills-deprecated-record-feature
try:
sb.glue("training_loss", training_losses)
sb.glue("training_accuracy", training_accuracy)
sb.glue("Accuracy on validation set:", 100 * float(metric))
except Exception:
pm.record("training_loss", training_losses)
pm.record("training_accuracy", training_accuracy)
pm.record("Accuracy on validation set:", 100 * float(metric))