Python / Keras - ModelCheckpoint callback access

I use Keras to predict the time series. I use 20 eras as a standard. I want to know what my neural network predicted for each of the 20 eras.

Using model.predict, I get the latest prediction. However, I need all the forecasts, or at least the last 10 (which have acceptable error levels).

To access this, I'm trying to use Keras's ModelCheckpoint function, however, I had problems accessing it after that. I am using the following code:

model=Sequential()

model.add(GRU(input_dim=col,init='uniform',output_dim=20))
model.add(Dense(10))
model.add(Dense(5))
model.add(Activation("softmax"))
model.add(Dense(1))

model.compile(loss="mae", optimizer="RMSprop")

checkpoint=ModelCheckpoint(filepath='/Users/Alex/checkpoint.hdf5')

model.fit(X=predictor_train, y=target_train, nb_epoch=20, batch_size=batch,validation_split=0.1) #best validation split at 0.1
model.evaluate(X=predictor_train, y=target_train,batch_size=batch,show_accuracy=True)

print checkpoint

Objectively, my questions are:

  • I expected that after running the code, I would find a file called checkpoint.hdf5 inside the / Users / Alex folder, however I did not. What am I missing?

  • checkpoint, keras.callbacks.ModelCheckpoint object at 0x117471290. , ? ?

:)

+4
1

:

  • . " ".
  • (, "{epoch: 02d} - {val_loss:.2f}", str.format by Keras, .

, :

checkpoint = ModelCheckpoint(filepath='/Users/Alex/checkpoint-{epoch:02d}-{val_loss:.2f}.hdf5')

model.fit(X=predictor_train, y=target_train, nb_epoch=20,
         batch_size=batch,validation_split=0.1, callbacks=[checkpoint])

, .

, , .

+8

All Articles