twodlearn.optim module

class twodlearn.optim.ConstantLr(value)[source]

Bases: object

class twodlearn.optim.DataFeeder(feed_train, feed_valid=None)[source]

Bases: object

feed_train()[source]
feed_valid()[source]
stop()[source]
class twodlearn.optim.EarlyStopping(monitor, var_list, logger_path, session, check_func=None, options=None)[source]

Bases: twodlearn.core.common.TdlObject

add_checkpoint[source]

Decorator used to specify methods that have a set of local variables.

These methods consist of an initialization method (speficied with the function given to the decorator) and an execute method.

check_greather(local)[source]
check_lower[source]

Decorator used to specify methods that have a set of local variables.

These methods consist of an initialization method (speficied with the function given to the decorator) and an execute method.

check_progress(step, monitor)[source]
property checkpoints[source]
reset()[source]
restore[source]

Decorator used to specify methods that have a set of local variables.

These methods consist of an initialization method (speficied with the function given to the decorator) and an execute method.

restore_file()[source]
save[source]

Decorator used to specify methods that have a set of local variables.

These methods consist of an initialization method (speficied with the function given to the decorator) and an execute method.

class twodlearn.optim.EarlyStoppingV2(optimizer, objective, minimize=True)[source]

Bases: twodlearn.core.common.TdlObject

property checkpoints[source]
objective[source]
property optimizer[source]
reset()[source]
restore[source]

Decorator used to specify methods that have a set of local variables.

These methods consist of an initialization method (speficied with the function given to the decorator) and an execute method.

property session[source]
class twodlearn.optim.OptimizationManager(session, optimizer=None, step_op=None, monitor_manager=None, n_logging=100, saver=None, options=None, optimizer_op=None)[source]

Bases: object

Performs a standard mini-batch training with validation evaluation

check_nan(step, xp)[source]

Check if the result from the optimizer includes Nan values. :param step: current step of the optimizer. :type step: int :param xp: list of outputs from the optimizer :type xp: list

Returns

True if variables were reset.

Return type

bool

check_progress(step, xp)[source]

Check if progress was made in the last call to the optimizer :param step: current optimizer step. :type step: int :param xp: list of outputs from the training monitors. :type xp: list

Returns

variables were reset.

Return type

bool

run(n_train_steps, feed_train=None, n_valid_steps=1, valid_eval_freq=1, feed_valid=None, monitor_training=True)[source]
run_step(step, ops, feed_dict)[source]

Run a step of the optimizer. :param step: Description of parameter step. :type step: type :param ops: Description of parameter ops. :type ops: type :param feed_dict: Description of parameter feed_dict. :type feed_dict: type

Returns

Description of returned object.

Return type

type

class twodlearn.optim.Optimizer(loss, var_list, session=None, metrics=None, n_logging=100, log_folder=None, options=None, **kargs)[source]

Bases: twodlearn.core.common.TdlModel

check_nan(step, xp)[source]

Check if the result from the optimizer includes Nan values. :param step: current step of the optimizer. :type step: int :param xp: list of outputs from the optimizer :type xp: list

Returns

True if variables were reset.

Return type

bool

check_progress(step, xp)[source]

Check if progress was made in the last call to the optimizer :param step: current optimizer step. :type step: int :param xp: list of outputs from the training monitors. :type xp: list

Returns

variables were reset.

Return type

bool

feed_train()[source]
learning_rate[source]
log_folder[source]
loss_monitor[source]
monitor_manager[source]
optimizer[source]
reset()[source]

Reset optimizer variables (var_optim)

run(n_train_steps, feed_train=None, n_valid_steps=1, valid_eval_freq=1, feed_valid=None, monitor_training=True)[source]
run_step(step, ops, feed_dict)[source]

Run a step of the optimizer. :param step: Description of parameter step. :type step: type :param ops: Description of parameter ops. :type ops: type :param feed_dict: Description of parameter feed_dict. :type feed_dict: type

Returns

Description of returned object.

Return type

type

saver[source]
session[source]
step_op[source]
property var_optim[source]

Variables created by the optimizer

class twodlearn.optim.SimpleSaver(var_list, logger_path, session)[source]

Bases: twodlearn.core.common.TdlObject

add_checkpoint(step)[source]
property checkpoints[source]
reset()[source]
restore_file()[source]
save[source]

Decorator used to specify methods that have a set of local variables.

These methods consist of an initialization method (speficied with the function given to the decorator) and an execute method.