mod_gradient_descent
Lines: 104 |
Visibility: private
Definition of the gradient descent optimization algorithm.
In gradient descent, all weights are updated along the direction of
the loss gradient with a constant stepsize.
author: Alexander Knoll, Moritz R. Schaefer
Dependencies
Uses
module~~mod_gradient_descent~~UsesGraph
module~mod_gradient_descent
mod_gradient_descent
module~mod_abstractoptimizer
mod_abstractoptimizer
module~mod_gradient_descent->module~mod_abstractoptimizer
module~mod_decorations
mod_decorations
module~mod_gradient_descent->module~mod_decorations
module~mod_io
mod_io
module~mod_gradient_descent->module~mod_io
module~mod_learning_rate
mod_learning_rate
module~mod_gradient_descent->module~mod_learning_rate
module~mod_loss_mse
mod_loss_mse
module~mod_gradient_descent->module~mod_loss_mse
module~mod_lossfunctions
mod_lossfunctions
module~mod_gradient_descent->module~mod_lossfunctions
module~mod_precision
mod_precision
module~mod_gradient_descent->module~mod_precision
module~mod_throw
mod_throw
module~mod_gradient_descent->module~mod_throw
module~mod_abstractoptimizer->module~mod_io
module~mod_abstractoptimizer->module~mod_precision
module~mod_abstractoptimizer->module~mod_throw
module~mod_global_warning
mod_global_warning
module~mod_abstractoptimizer->module~mod_global_warning
module~mod_gradient_clipping
mod_gradient_clipping
module~mod_abstractoptimizer->module~mod_gradient_clipping
module~mod_loss_abstract
mod_loss_abstract
module~mod_abstractoptimizer->module~mod_loss_abstract
module~mod_mpi
mod_mpi
module~mod_abstractoptimizer->module~mod_mpi
module~mod_nan_check
mod_nan_check
module~mod_abstractoptimizer->module~mod_nan_check
module~mod_settings
mod_settings
module~mod_abstractoptimizer->module~mod_settings
module~mod_decorations->module~mod_io
module~mod_decorations->module~mod_precision
module~mod_decorations->module~mod_throw
module~mod_io->module~mod_precision
iso_fortran_env
iso_fortran_env
module~mod_io->iso_fortran_env
module~mod_optional_args
mod_optional_args
module~mod_io->module~mod_optional_args
module~mod_learning_rate->module~mod_abstractoptimizer
module~mod_learning_rate->module~mod_precision
module~mod_loss_mse->module~mod_precision
module~mod_loss_mse->module~mod_loss_abstract
module~mod_lossfunctions->module~mod_io
module~mod_lossfunctions->module~mod_loss_mse
module~mod_lossfunctions->module~mod_throw
module~mod_lossfunctions->module~mod_loss_abstract
module~mod_loss_mae
mod_loss_mae
module~mod_lossfunctions->module~mod_loss_mae
module~mod_loss_mse_torch
mod_loss_mse_torch
module~mod_lossfunctions->module~mod_loss_mse_torch
module~mod_loss_rmse
mod_loss_rmse
module~mod_lossfunctions->module~mod_loss_rmse
iso_c_binding
iso_c_binding
module~mod_precision->iso_c_binding
module~mod_precision->iso_fortran_env
module~mod_throw->module~mod_io
module~mod_throw->module~mod_precision
module~mod_throw->iso_c_binding
module~mod_throw->iso_fortran_env
module~mod_throw->module~mod_mpi
module~mod_sort
mod_sort
module~mod_throw->module~mod_sort
module~mod_global_warning->module~mod_io
module~mod_global_warning->module~mod_throw
module~mod_abstract_warning
mod_abstract_warning
module~mod_global_warning->module~mod_abstract_warning
module~mod_gradient_clipping->module~mod_precision
module~mod_gradient_clipping->module~mod_settings
module~mod_loss_abstract->module~mod_precision
module~mod_loss_abstract->module~mod_mpi
module~mod_loss_mae->module~mod_precision
module~mod_loss_mae->module~mod_loss_abstract
module~mod_loss_mse_torch->module~mod_precision
module~mod_loss_mse_torch->module~mod_loss_abstract
module~mod_loss_rmse->module~mod_precision
module~mod_loss_rmse->module~mod_loss_abstract
module~mod_mpi->module~mod_precision
mpi_f08
mpi_f08
module~mod_mpi->mpi_f08
module~mod_nan_check->module~mod_io
module~mod_nan_check->module~mod_precision
module~mod_nan_check->module~mod_throw
ieee_arithmetic
ieee_arithmetic
module~mod_nan_check->ieee_arithmetic
module~mod_settings->module~mod_io
module~mod_settings->module~mod_precision
module~mod_settings->module~mod_throw
module~mod_constants
mod_constants
module~mod_settings->module~mod_constants
module~mod_cpu_vendor
mod_cpu_vendor
module~mod_settings->module~mod_cpu_vendor
module~mod_periodic_table
mod_periodic_table
module~mod_settings->module~mod_periodic_table
module~mod_sort->module~mod_precision
module~mod_constants->module~mod_precision
module~mod_constants->iso_c_binding
module~mod_cpu_vendor->iso_c_binding
module~mod_periodic_table->module~mod_io
module~mod_periodic_table->module~mod_precision
module~mod_periodic_table->module~mod_throw
module~mod_periodic_table->module~mod_constants
module~mod_array_helpers
mod_array_helpers
module~mod_periodic_table->module~mod_array_helpers
module~mod_array_helpers->module~mod_precision
module~mod_array_helpers->module~mod_throw
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Used By
module~~mod_gradient_descent~~UsedByGraph
module~mod_gradient_descent
mod_gradient_descent
module~mod_optimizers
mod_optimizers
module~mod_optimizers->module~mod_gradient_descent
module~mod_initialize
mod_initialize
module~mod_initialize->module~mod_optimizers
module~mod_predict_mode
mod_predict_mode
module~mod_predict_mode->module~mod_initialize
module~mod_write_outfiles
mod_write_outfiles
module~mod_predict_mode->module~mod_write_outfiles
module~mod_runner_interface_bindings
mod_runner_interface_bindings
module~mod_runner_interface_bindings->module~mod_initialize
module~mod_train_energy_multiple_structures
mod_train_energy_multiple_structures
module~mod_train_energy_multiple_structures->module~mod_initialize
module~mod_train_forces_multiple_structures
mod_train_forces_multiple_structures
module~mod_train_forces_multiple_structures->module~mod_initialize
module~mod_train_forces_multiple_structures->module~mod_train_energy_multiple_structures
module~mod_train_loop_4g_charges
mod_train_loop_4g_charges
module~mod_train_loop_4g_charges->module~mod_initialize
module~mod_cost_calculator
mod_cost_calculator
module~mod_train_loop_4g_charges->module~mod_cost_calculator
module~mod_output_files_and_cost_4g_charges
mod_output_files_and_cost_4g_charges
module~mod_train_loop_4g_charges->module~mod_output_files_and_cost_4g_charges
module~mod_train_loop_atomic_property
mod_train_loop_atomic_property
module~mod_train_loop_atomic_property->module~mod_initialize
module~mod_train_loop_atomic_property->module~mod_cost_calculator
module~mod_output_files_and_cost
mod_output_files_and_cost
module~mod_train_loop_atomic_property->module~mod_output_files_and_cost
module~mod_train_loop_short_range
mod_train_loop_short_range
module~mod_train_loop_short_range->module~mod_initialize
module~mod_train_loop_short_range->module~mod_train_energy_multiple_structures
module~mod_train_loop_short_range->module~mod_train_forces_multiple_structures
module~mod_train_loop_short_range->module~mod_cost_calculator
module~mod_train_loop_short_range->module~mod_output_files_and_cost
module~mod_output_files_and_cost_4g_short_range
mod_output_files_and_cost_4g_short_range
module~mod_train_loop_short_range->module~mod_output_files_and_cost_4g_short_range
module~mod_train_mode
mod_train_mode
module~mod_train_mode->module~mod_initialize
module~mod_train_mode->module~mod_train_loop_4g_charges
module~mod_train_mode->module~mod_train_loop_atomic_property
module~mod_train_mode->module~mod_train_loop_short_range
module~mod_write_outfiles_training
mod_write_outfiles_training
module~mod_train_mode->module~mod_write_outfiles_training
module~mod_write_outfiles->module~mod_initialize
program~runner
RuNNer
program~runner->module~mod_initialize
program~runner->module~mod_predict_mode
program~runner->module~mod_train_mode
module~mod_lammps_interface
mod_lammps_interface
module~mod_lammps_interface->module~mod_runner_interface_bindings
module~mod_write_outfiles_training->module~mod_write_outfiles
module~mod_cost_calculator->module~mod_write_outfiles_training
module~mod_output_files_and_cost->module~mod_cost_calculator
module~mod_output_files_and_cost_4g_charges->module~mod_cost_calculator
module~mod_output_files_and_cost_4g_short_range->module~mod_cost_calculator
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Derived Types Summary
Procedures Summary
Derived Types Details
type GradientDescent
Gradient Descent (GD) Optimizer.
Components
Type-Bound Procedures
Name
Attributes
Binding
weight_decay
public
⇒ weight_decay
initialize_from_file
public
⇒ initialize_from_file_abstract_optimizer
step
public
⇒ step_abstractoptimizer_mpi
set_num_parameters
public
⇒ set_num_parameters_abstractoptimizer
update_hyperparameters
public
⇒ update_hyperparameters_abstractoptimizer
parameter_weight_decay
public
⇒ parameter_weight_decay
print
public
⇒ print_gd
report
public
⇒ report_gd
update
public
⇒ update_gd
initialize_defaults
public
⇒ initialize_defaults_gd
validate
public
⇒ validate_hyperparameters_gd
set_hyperparameter
public
⇒ set_hyperparameter_gd
Inherits
type~~gradientdescent~~InheritsGraph
type~gradientdescent
GradientDescent
type~abstractoptimizerlearningrate
AbstractOptimizerLearningRate
type~gradientdescent->type~abstractoptimizerlearningrate
type~abstractoptimizer
AbstractOptimizer
type~abstractoptimizerlearningrate->type~abstractoptimizer
type~abstractlossfunction
AbstractLossFunction
type~abstractoptimizer->type~abstractlossfunction
loss_function
Nodes of different colours represent the following:
Graph Key
Type
Type
This Page's Entity
This Page's Entity
Solid arrows point from a derived type to the parent type which it
extends. Dashed arrows point from a derived type to the other
types it contains as a components, with a label listing the name(s) of
said component(s).
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Interface Details
interface GradientDescent
Procedure Details
function constructor_ptr_from_hyperparams_gd
function constructor_ptr_from_hyperparams_gd ( & learning_rate, & loss_function_type, & icomm &)
Initialize a new GradientDescent optimizer object.
Arguments
learning_rate :
real (DP) [in]– The step size for each gradient update.
loss_function_type :
integer [in]
icomm :
integer [in]– Index of the committee member to which this optimizer is assigned to.
Called By
proc~~constructor_ptr_from_hyperparams_gd~~CalledByGraph
proc~constructor_ptr_from_hyperparams_gd
mod_gradient_descent::constructor_ptr_from_hyperparams_gd
interface~gradientdescent
mod_gradient_descent::GradientDescent
interface~gradientdescent->proc~constructor_ptr_from_hyperparams_gd
Nodes of different colours represent the following:
Graph Key
Subroutine
Subroutine
Function
Function
Interface
Interface
Type Bound Procedure
Type Bound Procedure
Unknown Procedure Type
Unknown Procedure Type
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
function constructor_ptr_from_file_gd
function constructor_ptr_from_file_gd ( & line, & icomm &)
Arguments
line :
character [in]
icomm :
integer [in]– Committee index to which this ´GradientDescent` object is assigned to.
Called By
proc~~constructor_ptr_from_file_gd~~CalledByGraph
proc~constructor_ptr_from_file_gd
mod_gradient_descent::constructor_ptr_from_file_gd
interface~gradientdescent
mod_gradient_descent::GradientDescent
interface~gradientdescent->proc~constructor_ptr_from_file_gd
Nodes of different colours represent the following:
Graph Key
Subroutine
Subroutine
Function
Function
Interface
Interface
Type Bound Procedure
Type Bound Procedure
Unknown Procedure Type
Unknown Procedure Type
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
subroutine print_gd
subroutine print_gd ( & self &)
Display information about the GradientDescent object.
Arguments
subroutine report_gd
subroutine report_gd ( & self, & epoch &)
Displays current status of the GradientDescent object
for verbosity >= 2.
Arguments
subroutine initialize_defaults_gd
subroutine initialize_defaults_gd ( & self &)
Arguments
Called By
Nodes of different colours represent the following:
Graph Key
Subroutine
Subroutine
Function
Function
Interface
Interface
Type Bound Procedure
Type Bound Procedure
Unknown Procedure Type
Unknown Procedure Type
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
subroutine set_hyperparameter_gd
subroutine set_hyperparameter_gd ( & self, & name, & value_str &)
Update the value of the given hyperparameter.
Arguments
self :
class (GradientDescent ) [inout]
name :
character [in]
value_str :
character [in]
subroutine validate_hyperparameters_gd
subroutine validate_hyperparameters_gd ( & self &)
Arguments
Called By
Nodes of different colours represent the following:
Graph Key
Subroutine
Subroutine
Function
Function
Interface
Interface
Type Bound Procedure
Type Bound Procedure
Unknown Procedure Type
Unknown Procedure Type
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
subroutine update_gd
subroutine update_gd ( & self, & parameters, & gradients, & losses, & num_streams &)
Update parameters according to their loss gradients.
Arguments
self :
class (GradientDescent ) [inout]
parameters :
real (DP) (dim: (self%num_parameters)) [inout]– A list of all free parameters in the `Model`.
gradients :
real (DP) (dim: (self%num_parameters,num_streams)) [inout]– Gradients of the `Model` output wrt its parameters.
losses :
real (DP) (dim: (num_streams)) [in]– Loss of the `Model` output (prediction - target).
num_streams :
integer [in]– The number of streams participating in the update.