odynn.optim module¶
-
class
odynn.optim.
Optimized
(dt)[source]¶ Bases:
abc.ABC
Abstract class for object to be optimized. It could represent on or a set of neurons, or a circuit.
Attributes: init_params
dict, initial parameters
num
int, number of models
variables
dict, current Tf variables
Methods
apply_constraints
(session)Apply necessary constraints to the optimized variables build_graph
([batch])Build the tensorflow graph. plot_vars
(var_dic, suffix, show, save)A function to plot the variables of the optimized object settings
()Give a string describing the settings Returns(str): description apply_init predump study_vars -
apply_constraints
(session)[source]¶ Apply necessary constraints to the optimized variables
Parameters: session (tf.Session) –
-
build_graph
(batch=1)[source]¶ Build the tensorflow graph. Take care of the loop and the initial state.
-
init_params
¶ dict, initial parameters
-
ions
= {}¶
-
num
¶ int, number of models
-
static
plot_vars
(var_dic, suffix, show, save)[source]¶ A function to plot the variables of the optimized object
Parameters: - var_dic –
- suffix –
- show –
- save –
-
variables
¶ dict, current Tf variables
-
class
odynn.optim.
Optimizer
(optimized, frequency=30)[source]¶ Bases:
abc.ABC
Methods
settings
(w, train)Give the settings of the optimization optimize plot_out
-
odynn.optim.
get_best_result
(dir, i=-1, loss=False)[source]¶ Parameters: dir (str) – path to the directory i: (Default value = -1) Returns:
-
odynn.optim.
get_vars
(dir, i=-1, loss=False)[source]¶ get dic of vars from dumped file
Parameters: dir (str) – path to the directory i: (Default value = -1) Returns:
-
odynn.optim.
get_vars_all
(dir, i=-1, losses=False)[source]¶ get dic of vars from dumped file
Parameters: dir (str) – path to the directory i: (Default value = -1) Returns:
-
odynn.optim.
plot_loss_rate
(losses, rates, losses_test=None, parallel=1, suffix='', show=False, save=True)[source]¶ plot loss (log10) and learning rate
Parameters: - losses –
- rates –
- losses_test – (Default value = None)
- parallel – (Default value = 1)
- suffix – (Default value = “”)
- show (bool) – If True, show the figure (Default value = False)
- save – (Default value = True)
Returns: