Last active
January 26, 2018 06:40
-
-
Save ruslangrimov/2e1406715816b96974e1a76b7ed89fe5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCallBack(Callback): | |
def __init__(self, x_v, y_v): | |
super(MyCallBack, self).__init__() | |
self.x_v, self.y_v = x_v, y_v | |
self.ps = [] | |
def on_epoch_end(self, epoch, logs={}): | |
p = self.model.predict(self.x_v).flatten() | |
self.ps.append(p) | |
logs['val_loss'] = log_loss(self.x_y, p) | |
logs['val_acc'] = accuracy_score(self.x_y, p.round()) | |
mycallback = MyCallBack(x_v, y_v) | |
model.fit(x_t, y_t,..., callbacks=[mycallback]) | |
print(mycallback.ps) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment