Keras: Question - History fit_generator() gives None

Created on 26 Mar 2018  路  1Comment  路  Source: keras-team/keras

Hello, i don't understand how to get accuracy at the end of fit_generator()

history = model.fit_generator( someparameters )
print( history.on_train_end() ) # gives None

same for

class My_Callback(keras.callbacks.Callback):
    def on_train_begin(self, logs={}):
        self.l = {}
    def on_train_end(self, logs={}):
        self.l = copy.deepcopy(logs)
        return self.l
    def __repr__(self):
        return str(self.l)
history = My_Callback()
model.fit_generator( someparameters,  callbacks=[history])
print( history ) # gives None

I want the acc value at the end of fit_generator

25/25 [==============================] - 17s 663ms/step - loss: 2.7852 - acc: 0.1358

thank u

Most helpful comment

i'm stupid, solve with

history = History()
model.fit_generator( someparameters,  callbacks=[history])
print(history.history) # gives {'loss': [2.7819560527801515], 'acc': [0.1458333331346512]}

>All comments

i'm stupid, solve with

history = History()
model.fit_generator( someparameters,  callbacks=[history])
print(history.history) # gives {'loss': [2.7819560527801515], 'acc': [0.1458333331346512]}
Was this page helpful?
0 / 5 - 0 ratings