Ejemplo n.º 1
0
from tensorflow.keras.models import Sequential
from tensorflow.keras import layers

model = Sequential()
model.add(layers.InputLayer(input_shape=(28, 28, 1)))
model.add(layers.Flatten())
model.add(layers.Dense(128, activation='relu'))
model.add(layers.Dense(64, activation='relu'))
model.add(layers.Dense(10, activation='softmax'))

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['acc'])

# 모델 학습
history = model.fit(reshape_x_train,
                    y_train,
                    batch_size=128,
                    epochs=50,
                    validation_split=.1)

# 원하는 지표 생성
acc = history.history['acc']
loss = history.history['loss']

import nutellaAgent

nnn = nutellaAgent.Nutella()
nnn.init("test_run1", "", 0)
nnn.log(accuracy=acc, loss=loss)
Ejemplo n.º 2
0
import nutellaAgent

max_features = 20000
maxlen = 80
batch_size = 32

(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)

x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)

model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))

# try using different optimizers and different optimizer configs
model.compile(loss='binary_crossentropy',
              optimizer='adam',
              metrics=['accuracy'])

model.fit(x_train,
          y_train,
          batch_size=batch_size,
          epochs=15,
          validation_data=(x_test, y_test))
score, acc = model.evaluate(x_test, y_test, batch_size=batch_size)

nutella = nutellaAgent.Nutella()
nutella.init("test_run", "LRW1qf_RkusatXgmqw_bAgvFG2EbE49dHQbp0Fo8", 0)
nutella.log(accuracy=acc)