Estimator#

class mergernet.estimators.base.Estimator[source]#

Bases: ABC

Attributes

abstract build(freeze_conv: bool = False)[source]#
compile_model(tf_model: Model, optimizer: Optimizer, metrics: list = [], label_smoothing: float = 0.0)[source]#
download(config: EstimatorConfig, replace: bool = False)[source]#
get_conv_arch(pretrained_arch: str) Tuple[Callable, Callable][source]#
get_dataaug_block(flip_horizontal: bool = True, flip_vertical: bool = True, rotation: Tuple[float, float] | bool = (-0.08, 0.08), zoom: Tuple[float, float] | bool = (-0.15, 0.0))[source]#
get_metric(metric: str)[source]#
get_optimizer(optimizer: str, lr: float | LearningRateSchedule) Optimizer[source]#
get_scheduler(scheduler: str, lr: float) LearningRateSchedule[source]#

For cosine_restarts scheduler, the learning rate multiplier first decays from 1 to alpha for first_decay_steps steps. Then, a warm restart is performed. Each new warm restart runs for t_mul times more steps and with m_mul times initial learning rate as the new learning rate.

Parameters:
  • scheduler (str) – Scheduler name

  • lr (float) – Initial learning rate

Returns:

A LearningRateSchedule instance

Return type:

tf.keras.optimizers.schedules.LearningRateSchedule

plot(filename: str = 'model.png')[source]#
abstract predict()[source]#
set_trainable(tf_model: Model, layer: str, trainable: bool)[source]#
abstract train(run_name: str = '') Tuple[Model, History][source]#
_abc_impl = <_abc_data object>#
registry = <mergernet.estimators.base.EstimatorRegistry object>#
property tf_model#