Exemple #1
0
        def _report_parameter_from_model_optimizer(self, metric_name, name_of_optimizer_attr=None):
            if not name_of_optimizer_attr:
                name_of_optimizer_attr = metric_name

            if not _should_report_metric_or_parameter(autolog_inputs, metric_name) or not hasattr(self.model.optimizer, name_of_optimizer_attr):
                return

            parameter_from_model = getattr(self.model.optimizer, name_of_optimizer_attr)
            value = parameter_from_model if type(parameter_from_model) is float else keras.backend.eval(parameter_from_model)
            reportParameter(metric_name, value)
Exemple #2
0
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout
import time
from runai.reporter import autolog, reportParameter, reportMetric
import keras.optimizers

NUM_CLASSES = 10
BATCH_SIZE = 10
STEPS = 5

autolog()
reportParameter("current_state", "preprocessing")

# the data, split between train and test sets
(x_train, y_train), (x_test, y_test) = mnist.load_data()

x_train = x_train.reshape(60000, 784)
x_test = x_test.reshape(10000, 784)
x_train = x_train.astype('float32')
x_test = x_test.astype('float32')
x_train /= 255
x_test /= 255

reportParameter("current_state", "final tunning")

# convert class vectors to binary class matrices
y_train = keras.utils.to_categorical(y_train, NUM_CLASSES)
y_test = keras.utils.to_categorical(y_test, NUM_CLASSES)
 def _reportParameter(*args, **kwargs):
     if reporter is not None:
         reporter.reportParameter(*args, **kwargs)
     else:
         runai.reporter.reportParameter(*args, **kwargs)
Exemple #4
0
from runai.reporter import reportMetric, reportParameter
from time import sleep

for step in range(1000):
    reportMetric("step", step)
    reportMetric("accuracy", step)
    reportMetric("loss", step)
    reportMetric("epoch", step)
    reportMetric("this_is_a_test", 123)
    reportParameter("state", "running")
    sleep(1)
Exemple #5
0
 def _report_parameter_if_needed(autolog_inputs, key, value):
     if _should_report_metric_or_parameter(autolog_inputs, key):
         reportParameter(key, value)