| | | |
Offset 1230, 31 lines modified | Offset 1230, 36 lines modified |
1230 | ········{ | 1230 | ········{ |
1231 | ············"location":·"backend.html#backend", | 1231 | ············"location":·"backend.html#backend", |
1232 | ············"text":·"keras.backend.backend()·Publicly·accessible·method·for·determining·the·current·backend.·Returns·String,·the·name·of·the·backend·Keras·is·currently·using.·Example·>>>·keras.backend.backend()·'tensorflow'", | 1232 | ············"text":·"keras.backend.backend()·Publicly·accessible·method·for·determining·the·current·backend.·Returns·String,·the·name·of·the·backend·Keras·is·currently·using.·Example·>>>·keras.backend.backend()·'tensorflow'", |
1233 | ············"title":·"backend" | 1233 | ············"title":·"backend" |
1234 | ········}, | 1234 | ········}, |
1235 | ········{ | 1235 | ········{ |
1236 | ············"location":·"callbacks.html", | 1236 | ············"location":·"callbacks.html", |
1237 | ············"text":·"Usage·of·callbacks·A·callback·is·a·set·of·functions·to·be·applied·at·given·stages·of·the·training·procedure.·You·can·use·callbacks·to·get·a·view·on·internal·states·and·statistics·of·the·model·during·training.·You·can·pass·a·list·of·callbacks·(as·the·keyword·argument·callbacks·)·to·the·.fit()·method·of·the·Sequential·or·Model·classes.·The·relevant·methods·of·the·callbacks·will·then·be·called·at·each·stage·of·the·training.·[source]·CSVLogger·keras.callbacks.CSVLogger(filename,·separator=',',·append=False)·Callback·that·streams·epoch·results·to·a·csv·file.·Supports·all·values·that·can·be·represented·as·a·string,·including·1D·iterables·such·as·np.ndarray.·Example·csv_logger·=·CSVLogger('training.log')·model.fit(X_train,·Y_train,·callbacks=[csv_logger])·Arguments·filename·:·filename·of·the·csv·file,·e.g.·'run/log.csv'.·separator·:·string·used·to·separate·elements·in·the·csv·file.·append·:·True:·append·if·file·exists·(useful·for·continuing·training).·False:·overwrite·existing·file,·[source]·LambdaCallback·keras.callbacks.LambdaCallback(on_epoch_begin=None,·on_epoch_end=None,·on_batch_begin=None,·on_batch_end=None,·on_train_begin=None,·on_train_end=None)·Callback·for·creating·simple,·custom·callbacks·on-the-fly.·This·callback·is·constructed·with·anonymous·functions·that·will·be·called·at·the·appropriate·time.·Note·that·the·callbacks·expects·positional·arguments,·as:·on_epoch_begin·and·on_epoch_end·expect·two·positional·arguments:·epoch·,·logs[·...·truncated·by·diffoscope;·len:·11554,·SHA:·6065bf115a8da85f77959b37e0ac7b395ffdd86fdb5dd7acd748f001bf64f8c3·...·]·Create·a·callback·You·can·create·a·custom·callback·by·extending·the·base·class·keras.callbacks.Callback·.·A·callback·has·access·to·its·associated·model·through·the·class·property·self.model·.·Here's·a·simple·example·saving·a·list·of·losses·over·each·batch·during·training:·class·LossHistory(keras.callbacks.Callback):·def·on_train_begin(self,·logs={}):·self.losses·=·[]·def·on_batch_end(self,·batch,·logs={}):·self.losses.append(logs.get('loss'))·Example:·recording·loss·history·class·LossHistory(keras.callbacks.Callback):·def·on_train_begin(self,·logs={}):·self.losses·=·[]·def·on_batch_end(self,·batch,·logs={}):·self.losses.append(logs.get('loss'))·model·=·Sequential()·model.add(Dense(10,·input_dim=784,·kernel_initializer='uniform'))·model.add(Activation('softmax'))·model.compile(loss='categorical_crossentropy',·optimizer='rmsprop')·history·=·LossHistory()·model.fit(x_train,·y_train,·batch_size=128,·epochs=20,·verbose=0,·callbacks=[history])·print(history.losses)·#·outputs·'''·[0.66047596406559383,·0.3547245744908703,·...,·0.25953155204159617,·0.25901699725311789]·'''·Example:·model·checkpoints·from·keras.callbacks·import·ModelCheckpoint·model·=·Sequential()·model.add(Dense(10,·input_dim=784,·kernel_initializer='uniform'))·model.add(Activation('softmax'))·model.compile(loss='categorical_crossentropy',·optimizer='rmsprop')·'''·saves·the·model·weights·after·each·epoch·if·the·validation·loss·decreased·'''·checkpointer·=·ModelCheckpoint(filepath='/tmp/weights.hdf5',·verbose=1,·save_best_only=True)·model.fit(x_train,·y_train,·batch_size=128,·epochs=20,·verbose=0,·validation_data=(X_test,·Y_test),·callbacks=[checkpointer])", | 1237 | ············"text":·"Usage·of·callbacks·A·callback·is·a·set·of·functions·to·be·applied·at·given·stages·of·the·training·procedure.·You·can·use·callbacks·to·get·a·view·on·internal·states·and·statistics·of·the·model·during·training.·You·can·pass·a·list·of·callbacks·(as·the·keyword·argument·callbacks·)·to·the·.fit()·method·of·the·Sequential·or·Model·classes.·The·relevant·methods·of·the·callbacks·will·then·be·called·at·each·stage·of·the·training.·[source]·Callback·keras.callbacks.Callback()·Abstract·base·class·used·to·build·new·callbacks.·Properties·params·:·dict.·Training·parameters·(eg.·verbosity,·batch·size,·number·of·epochs...).·model·:·instance·of·keras.models.Model·.·Reference·of·the·model·being·trained.·The·logs·dictionary·that·callback·methods·take·as·argument·will·contain·keys·for·quantities·relevant·to·the·current·batch·or·epoch.·Currently,·the·.fit()·method·of·the·Sequential·model·class·will·include·the·following·quantities·in·the·logs·that·it·passes·to·its·callbacks:·on_epoch_end:·logs·include·acc·and·loss·,·and·optionally·include·val_loss·(if·validation·is·enabled·in·fit·),·and·val_acc·(if·validation·and·accuracy·monitoring·are·enabled).·on_batch_begin:·logs·include·size·,·the·number·of·samples·in·the·current·batch.·on_batch_end:·logs·include·loss·,·and·optionally·acc·(if·accuracy·monitoring·is·enabled).·[source]·BaseLogger·keras.callbacks.BaseLogger(stateful_metrics=None)·Callback·that·accumulates·epoch·averages·of·metrics.·This·callback·is·automa[·...·truncated·by·diffoscope;·len:·11554,·SHA:·ef1b9f5a546696aa6e1193a9fe993930d01bc1c548d1b82ab689eed2ddb78fcd·...·]·Create·a·callback·You·can·create·a·custom·callback·by·extending·the·base·class·keras.callbacks.Callback·.·A·callback·has·access·to·its·associated·model·through·the·class·property·self.model·.·Here's·a·simple·example·saving·a·list·of·losses·over·each·batch·during·training:·class·LossHistory(keras.callbacks.Callback):·def·on_train_begin(self,·logs={}):·self.losses·=·[]·def·on_batch_end(self,·batch,·logs={}):·self.losses.append(logs.get('loss'))·Example:·recording·loss·history·class·LossHistory(keras.callbacks.Callback):·def·on_train_begin(self,·logs={}):·self.losses·=·[]·def·on_batch_end(self,·batch,·logs={}):·self.losses.append(logs.get('loss'))·model·=·Sequential()·model.add(Dense(10,·input_dim=784,·kernel_initializer='uniform'))·model.add(Activation('softmax'))·model.compile(loss='categorical_crossentropy',·optimizer='rmsprop')·history·=·LossHistory()·model.fit(x_train,·y_train,·batch_size=128,·epochs=20,·verbose=0,·callbacks=[history])·print(history.losses)·#·outputs·'''·[0.66047596406559383,·0.3547245744908703,·...,·0.25953155204159617,·0.25901699725311789]·'''·Example:·model·checkpoints·from·keras.callbacks·import·ModelCheckpoint·model·=·Sequential()·model.add(Dense(10,·input_dim=784,·kernel_initializer='uniform'))·model.add(Activation('softmax'))·model.compile(loss='categorical_crossentropy',·optimizer='rmsprop')·'''·saves·the·model·weights·after·each·epoch·if·the·validation·loss·decreased·'''·checkpointer·=·ModelCheckpoint(filepath='/tmp/weights.hdf5',·verbose=1,·save_best_only=True)·model.fit(x_train,·y_train,·batch_size=128,·epochs=20,·verbose=0,·validation_data=(X_test,·Y_test),·callbacks=[checkpointer])", |
1238 | ············"title":·"Callbacks" | 1238 | ············"title":·"Callbacks" |
1239 | ········}, | 1239 | ········}, |
1240 | ········{ | 1240 | ········{ |
1241 | ············"location":·"callbacks.html#usage-of-callbacks", | 1241 | ············"location":·"callbacks.html#usage-of-callbacks", |
1242 | ············"text":·"A·callback·is·a·set·of·functions·to·be·applied·at·given·stages·of·the·training·procedure.·You·can·use·callbacks·to·get·a·view·on·internal·states·and·statistics·of·the·model·during·training.·You·can·pass·a·list·of·callbacks·(as·the·keyword·argument·callbacks·)·to·the·.fit()·method·of·the·Sequential·or·Model·classes.·The·relevant·methods·of·the·callbacks·will·then·be·called·at·each·stage·of·the·training.·[source]", | 1242 | ············"text":·"A·callback·is·a·set·of·functions·to·be·applied·at·given·stages·of·the·training·procedure.·You·can·use·callbacks·to·get·a·view·on·internal·states·and·statistics·of·the·model·during·training.·You·can·pass·a·list·of·callbacks·(as·the·keyword·argument·callbacks·)·to·the·.fit()·method·of·the·Sequential·or·Model·classes.·The·relevant·methods·of·the·callbacks·will·then·be·called·at·each·stage·of·the·training.·[source]", |
1243 | ············"title":·"Usage·of·callbacks" | 1243 | ············"title":·"Usage·of·callbacks" |
1244 | ········}, | 1244 | ········}, |
1245 | ········{ | 1245 | ········{ |
1246 | ············"location":·"callbacks.html#csvlogger", | 1246 | ············"location":·"callbacks.html#callback", |
1247 | ············"text":·"keras.callbacks.CSVLogger(filename,·separator=',',·append=False)·Callback·that·streams·epoch·results·to·a·csv·file.·Supports·all·values·that·can·be·represented·as·a·string,·including·1D·iterables·such·as·np.ndarray.·Example·csv_logger·=·CSVLogger('training.log')·model.fit(X_train,·Y_train,·callbacks=[csv_logger])·Arguments·filename·:·filename·of·the·csv·file,·e.g.·'run/log.csv'.·separator·:·string·used·to·separate·elements·in·the·csv·file.·append·:·True:·append·if·file·exists·(useful·for·continuing·training).·False:·overwrite·existing·file,·[source]", | 1247 | ············"text":·"keras.callbacks.Callback()·Abstract·base·class·used·to·build·new·callbacks.·Properties·params·:·dict.·Training·parameters·(eg.·verbosity,·batch·size,·number·of·epochs...).·model·:·instance·of·keras.models.Model·.·Reference·of·the·model·being·trained.·The·logs·dictionary·that·callback·methods·take·as·argument·will·contain·keys·for·quantities·relevant·to·the·current·batch·or·epoch.·Currently,·the·.fit()·method·of·the·Sequential·model·class·will·include·the·following·quantities·in·the·logs·that·it·passes·to·its·callbacks:·on_epoch_end:·logs·include·acc·and·loss·,·and·optionally·include·val_loss·(if·validation·is·enabled·in·fit·),·and·val_acc·(if·validation·and·accuracy·monitoring·are·enabled).·on_batch_begin:·logs·include·size·,·the·number·of·samples·in·the·current·batch.·on_batch_end:·logs·include·loss·,·and·optionally·acc·(if·accuracy·monitoring·is·enabled).·[source]", |
1248 | ············"title":·"CSVLogger" | 1248 | ············"title":·"Callback" |
1249 | ········}, | 1249 | ········}, |
1250 | ········{ | 1250 | ········{ |
1251 | ············"location":·"callbacks.html#lambdacallback", | 1251 | ············"location":·"callbacks.html#baselogger", |
1252 | ············"text":·"keras.callbacks.LambdaCallback(on_epoch_begin=None,·on_epoch_end=None,·on_batch_begin=None,·on_batch_end=None,·on_train_begin=None,·on_train_end=None)·Callback·for·creating·simple,·custom·callbacks·on-the-fly.·This·callback·is·constructed·with·anonymous·functions·that·will·be·called·at·the·appropriate·time.·Note·that·the·callbacks·expects·positional·arguments,·as:·on_epoch_begin·and·on_epoch_end·expect·two·positional·arguments:·epoch·,·logs·on_batch_begin·and·on_batch_end·expect·two·positional·arguments:·batch·,·logs·on_train_begin·and·on_train_end·expect·one·positional·argument:·logs·Arguments·on_epoch_begin·:·called·at·the·beginning·of·every·epoch.·on_epoch_end·:·called·at·the·end·of·every·epoch.·on_batch_begin·:·called·at·the·beginning·of·every·batch.·on_batch_end·:·called·at·the·end·of·every·batch.·on_train_begin·:·called·at·the·beginning·of·model·training.·on_train_end·:·called·at·the·end·of·model·training.·Example·#·Print·the·batch·number·at·the·beginning·of·every·batch.·batch_print_callback·=·LambdaCallback(·on_batch_[·...·truncated·by·diffoscope;·len:·719,·SHA:·fd9128fa6e3a0bcd532dcc0ec751df2a9a37ae0f2d6605b584f4289f2efedacb·...·]·[source]", | 1252 | ············"text":·"keras.callbacks.BaseLogger(stateful_metrics=None)·Callback·that·accumulates·epoch·averages·of·metrics.·This·callback·is·automatically·applied·to·every·Keras·model.·Arguments·stateful_metrics·:·Iterable·of·string·names·of·metrics·that·should·not·be·averaged·over·an·epoch.·Metrics·in·this·list·will·be·logged·as-is·in·on_epoch_end·.·All·others·will·be·averaged·in·on_epoch_end·.·[source]", |
1253 | ············"title":·"LambdaCallback" | 1253 | ············"title":·"BaseLogger" |
| 1254 | ········}, |
| 1255 | ········{ |
| 1256 | ············"location":·"callbacks.html#terminateonnan", |
| 1257 | ············"text":·"keras.callbacks.TerminateOnNaN()·Callback·that·terminates·training·when·a·NaN·loss·is·encountered.·[source]", |
| 1258 | ············"title":·"TerminateOnNaN" |
1254 | ········}, | 1259 | ········}, |
1255 | ········{ | 1260 | ········{ |
1256 | ············"location":·"callbacks.html#progbarlogger", | 1261 | ············"location":·"callbacks.html#progbarlogger", |
1257 | ············"text":·"keras.callbacks.ProgbarLogger(count_mode='samples',·stateful_metrics=None)·Callback·that·prints·metrics·to·stdout.·Arguments·count_mode·:·One·of·\"steps\"·or·\"samples\".·Whether·the·progress·bar·should·count·samples·seen·or·steps·(batches)·seen.·stateful_metrics·:·Iterable·of·string·names·of·metrics·that·should·not·be·averaged·over·an·epoch.·Metrics·in·this·list·will·be·logged·as-is.·All·others·will·be·averaged·over·time·(e.g.·loss,·etc).·Raises·ValueError·:·In·case·of·invalid·count_mode·.·[source]", | 1262 | ············"text":·"keras.callbacks.ProgbarLogger(count_mode='samples',·stateful_metrics=None)·Callback·that·prints·metrics·to·stdout.·Arguments·count_mode·:·One·of·\"steps\"·or·\"samples\".·Whether·the·progress·bar·should·count·samples·seen·or·steps·(batches)·seen.·stateful_metrics·:·Iterable·of·string·names·of·metrics·that·should·not·be·averaged·over·an·epoch.·Metrics·in·this·list·will·be·logged·as-is.·All·others·will·be·averaged·over·time·(e.g.·loss,·etc).·Raises·ValueError·:·In·case·of·invalid·count_mode·.·[source]", |
1258 | ············"title":·"ProgbarLogger" | 1263 | ············"title":·"ProgbarLogger" |
1259 | ········}, | 1264 | ········}, |
1260 | ········{ | 1265 | ········{ |
Offset 1289, 27 lines modified | Offset 1294, 22 lines modified |
1289 | ········}, | 1294 | ········}, |
1290 | ········{ | 1295 | ········{ |
1291 | ············"location":·"callbacks.html#reducelronplateau", | 1296 | ············"location":·"callbacks.html#reducelronplateau", |
1292 | ············"text":·"keras.callbacks.ReduceLROnPlateau(monitor='val_loss',·factor=0.1,·patience=10,·verbose=0,·mode='auto',·min_delta=0.0001,·cooldown=0,·min_lr=0)·Reduce·learning·rate·when·a·metric·has·stopped·improving.·Models·often·benefit·from·reducing·the·learning·rate·by·a·factor·of·2-10·once·learning·stagnates.·This·callback·monitors·a·quantity·and·if·no·improvement·is·seen·for·a·'patience'·number·of·epochs,·the·learning·rate·is·reduced.·Example·reduce_lr·=·ReduceLROnPlateau(monitor='val_loss',·factor=0.2,·patience=5,·min_lr=0.001)·model.fit(X_train,·Y_train,·callbacks=[reduce_lr])·Arguments·monitor·:·quantity·to·be·monitored.·factor·:·factor·by·which·the·learning·rate·will·be·reduced.·new_lr·=·lr·*·factor·patience·:·number·of·epochs·with·no·improvement·after·which·learning·rate·will·be·reduced.·verbose·:·int.·0:·quiet,·1:·update·messages.·mode·:·one·of·{auto,·min,·max}.·In·min·mode,·lr·will·be·reduced·when·the·quantity·monitored·has·stopped·decreasing;·in·max·mode·it·will·be·reduced·when·the·quantity·monitored·has·stopped·increasing;·in·auto·mode,·the·direction·is·automatically·inferred·from·the·name·of·the·monitored·quantity.·min_delta·:·threshold·for·measuring·the·new·optimum,·to·only·focus·on·significant·changes.·cooldown·:·number·of·epochs·to·wait·before·resuming·normal·operation·after·lr·has·been·reduced.·min_lr·:·lower·bound·on·the·learning·rate.·[source]", | 1297 | ············"text":·"keras.callbacks.ReduceLROnPlateau(monitor='val_loss',·factor=0.1,·patience=10,·verbose=0,·mode='auto',·min_delta=0.0001,·cooldown=0,·min_lr=0)·Reduce·learning·rate·when·a·metric·has·stopped·improving.·Models·often·benefit·from·reducing·the·learning·rate·by·a·factor·of·2-10·once·learning·stagnates.·This·callback·monitors·a·quantity·and·if·no·improvement·is·seen·for·a·'patience'·number·of·epochs,·the·learning·rate·is·reduced.·Example·reduce_lr·=·ReduceLROnPlateau(monitor='val_loss',·factor=0.2,·patience=5,·min_lr=0.001)·model.fit(X_train,·Y_train,·callbacks=[reduce_lr])·Arguments·monitor·:·quantity·to·be·monitored.·factor·:·factor·by·which·the·learning·rate·will·be·reduced.·new_lr·=·lr·*·factor·patience·:·number·of·epochs·with·no·improvement·after·which·learning·rate·will·be·reduced.·verbose·:·int.·0:·quiet,·1:·update·messages.·mode·:·one·of·{auto,·min,·max}.·In·min·mode,·lr·will·be·reduced·when·the·quantity·monitored·has·stopped·decreasing;·in·max·mode·it·will·be·reduced·when·the·quantity·monitored·has·stopped·increasing;·in·auto·mode,·the·direction·is·automatically·inferred·from·the·name·of·the·monitored·quantity.·min_delta·:·threshold·for·measuring·the·new·optimum,·to·only·focus·on·significant·changes.·cooldown·:·number·of·epochs·to·wait·before·resuming·normal·operation·after·lr·has·been·reduced.·min_lr·:·lower·bound·on·the·learning·rate.·[source]", |
1293 | ············"title":·"ReduceLROnPlateau" | 1298 | ············"title":·"ReduceLROnPlateau" |
1294 | ········}, | 1299 | ········}, |
1295 | ········{ | 1300 | ········{ |
1296 | ············"location":·"callbacks.html#callback", | 1301 | ············"location":·"callbacks.html#csvlogger", |
1297 | ············"text":·"keras.callbacks.Callback()·Abstract·base·class·used·to·build·new·callbacks.·Properties·params·:·dict.·Training·parameters·(eg.·verbosity,·batch·size,·number·of·epochs...).·model·:·instance·of·keras.models.Model·.·Reference·of·the·model·being·trained.·The·logs·dictionary·that·callback·methods·take·as·argument·will·contain·keys·for·quantities·relevant·to·the·current·batch·or·epoch.·Currently,·the·.fit()·method·of·the·Sequential·model·class·will·include·the·following·quantities·in·the·logs·that·it·passes·to·its·callbacks:·on_epoch_end:·logs·include·acc·and·loss·,·and·optionally·include·val_loss·(if·validation·is·enabled·in·fit·),·and·val_acc·(if·validation·and·accuracy·monitoring·are·enabled).·on_batch_begin:·logs·include·size·,·the·number·of·samples·in·the·current·batch.·on_batch_end:·logs·include·loss·,·and·optionally·acc·(if·accuracy·monitoring·is·enabled).·[source]", | 1302 | ············"text":·"keras.callbacks.CSVLogger(filename,·separator=',',·append=False)·Callback·that·streams·epoch·results·to·a·csv·file.·Supports·all·values·that·can·be·represented·as·a·string,·including·1D·iterables·such·as·np.ndarray.·Example·csv_logger·=·CSVLogger('training.log')·model.fit(X_train,·Y_train,·callbacks=[csv_logger])·Arguments·filename·:·filename·of·the·csv·file,·e.g.·'run/log.csv'.·separator·:·string·used·to·separate·elements·in·the·csv·file.·append·:·True:·append·if·file·exists·(useful·for·continuing·training).·False:·overwrite·existing·file,·[source]", |
1298 | ············"title":·"Callback" | 1303 | ············"title":·"CSVLogger" |
1299 | ········}, | |
1300 | ········{ | |
1301 | ············"location":·"callbacks.html#baselogger", | |
1302 | ············"text":·"keras.callbacks.BaseLogger(stateful_metrics=None)·Callback·that·accumulates·epoch·averages·of·metrics.·This·callback·is·automatically·applied·to·every·Keras·model.·Arguments·stateful_metrics·:·Iterable·of·string·names·of·metrics·that·should·not·be·averaged·over·an·epoch.·Metrics·in·this·list·will·be·logged·as-is·in·on_epoch_end·.·All·others·will·be·averaged·in·on_epoch_end·.·[source]", | |
1303 | ············"title":·"BaseLogger" | |
1304 | ········}, | 1304 | ········}, |
1305 | ········{ | 1305 | ········{ |
1306 | ············"location":·"callbacks.html#terminateonnan", | 1306 | ············"location":·"callbacks.html#lambdacallback", |
1307 | ············"text":·"keras.callbacks.TerminateOnNaN()·Callback·that·terminates·training·when·a·NaN·loss·is·encountered.", | 1307 | ············"text":·"keras.callbacks.LambdaCallback(on_epoch_begin=None,·on_epoch_end=None,·on_batch_begin=None,·on_batch_end=None,·on_train_begin=None,·on_train_end=None)·Callback·for·creating·simple,·custom·callbacks·on-the-fly.·This·callback·is·constructed·with·anonymous·functions·that·will·be·called·at·the·appropriate·time.·Note·that·the·callbacks·expects·positional·arguments,·as:·on_epoch_begin·and·on_epoch_end·expect·two·positional·arguments:·epoch·,·logs·on_batch_begin·and·on_batch_end·expect·two·positional·arguments:·batch·,·logs·on_train_begin·and·on_train_end·expect·one·positional·argument:·logs·Arguments·on_epoch_begin·:·called·at·the·beginning·of·every·epoch.·on_epoch_end·:·called·at·the·end·of·every·epoch.·on_batch_begin·:·called·at·the·beginning·of·every·batch.·on_batch_end·:·called·at·the·end·of·every·batch.·on_train_begin·:·called·at·the·beginning·of·model·training.·on_train_end·:·called·at·the·end·of·model·training.·Example·#·Print·the·batch·number·at·the·beginning·of·every·batch.·batch_print_callback·=·LambdaCallback(·on_batch_[·...·truncated·by·diffoscope;·len:·719,·SHA:·fd9128fa6e3a0bcd532dcc0ec751df2a9a37ae0f2d6605b584f4289f2efedacb·...·]", |
1308 | ············"title":·"TerminateOnNaN" | 1308 | ············"title":·"LambdaCallback" |
1309 | ········}, | 1309 | ········}, |
1310 | ········{ | 1310 | ········{ |
1311 | ············"location":·"callbacks.html#create-a-callback", | 1311 | ············"location":·"callbacks.html#create-a-callback", |
1312 | ············"text":·"You·can·create·a·custom·callback·by·extending·the·base·class·keras.callbacks.Callback·.·A·callback·has·access·to·its·associated·model·through·the·class·property·self.model·.·Here's·a·simple·example·saving·a·list·of·losses·over·each·batch·during·training:·class·LossHistory(keras.callbacks.Callback):·def·on_train_begin(self,·logs={}):·self.losses·=·[]·def·on_batch_end(self,·batch,·logs={}):·self.losses.append(logs.get('loss'))", | 1312 | ············"text":·"You·can·create·a·custom·callback·by·extending·the·base·class·keras.callbacks.Callback·.·A·callback·has·access·to·its·associated·model·through·the·class·property·self.model·.·Here's·a·simple·example·saving·a·list·of·losses·over·each·batch·during·training:·class·LossHistory(keras.callbacks.Callback):·def·on_train_begin(self,·logs={}):·self.losses·=·[]·def·on_batch_end(self,·batch,·logs={}):·self.losses.append(logs.get('loss'))", |
1313 | ············"title":·"Create·a·callback" | 1313 | ············"title":·"Create·a·callback" |
1314 | ········}, | 1314 | ········}, |
1315 | ········{ | 1315 | ········{ |