hyperparameters_m.f90 Source File


This file depends on

sourcefile~~hyperparameters_m.f90~~EfferentGraph sourcefile~hyperparameters_m.f90 hyperparameters_m.f90 sourcefile~double_precision_string_m.f90 double_precision_string_m.f90 sourcefile~hyperparameters_m.f90->sourcefile~double_precision_string_m.f90 sourcefile~kind_parameters_m.f90 kind_parameters_m.f90 sourcefile~hyperparameters_m.f90->sourcefile~kind_parameters_m.f90

Files dependent on this one

sourcefile~~hyperparameters_m.f90~~AfferentGraph sourcefile~hyperparameters_m.f90 hyperparameters_m.f90 sourcefile~fiats_m.f90 fiats_m.f90 sourcefile~fiats_m.f90->sourcefile~hyperparameters_m.f90 sourcefile~training_configuration_m.f90 training_configuration_m.f90 sourcefile~fiats_m.f90->sourcefile~training_configuration_m.f90 sourcefile~trainable_network_m.f90 trainable_network_m.f90 sourcefile~fiats_m.f90->sourcefile~trainable_network_m.f90 sourcefile~hyperparameters_s.f90 hyperparameters_s.F90 sourcefile~hyperparameters_s.f90->sourcefile~hyperparameters_m.f90 sourcefile~training_configuration_m.f90->sourcefile~hyperparameters_m.f90 sourcefile~concurrent-inferences.f90 concurrent-inferences.f90 sourcefile~concurrent-inferences.f90->sourcefile~fiats_m.f90 sourcefile~learn-addition.f90 learn-addition.F90 sourcefile~learn-addition.f90->sourcefile~fiats_m.f90 sourcefile~learn-exponentiation.f90 learn-exponentiation.F90 sourcefile~learn-exponentiation.f90->sourcefile~fiats_m.f90 sourcefile~learn-multiplication.f90 learn-multiplication.F90 sourcefile~learn-multiplication.f90->sourcefile~fiats_m.f90 sourcefile~learn-power-series.f90 learn-power-series.F90 sourcefile~learn-power-series.f90->sourcefile~fiats_m.f90 sourcefile~learn-saturated-mixing-ratio.f90 learn-saturated-mixing-ratio.F90 sourcefile~learn-saturated-mixing-ratio.f90->sourcefile~fiats_m.f90 sourcefile~saturated_mixing_ratio_m.f90 saturated_mixing_ratio_m.f90 sourcefile~learn-saturated-mixing-ratio.f90->sourcefile~saturated_mixing_ratio_m.f90 sourcefile~print-training-configuration.f90 print-training-configuration.F90 sourcefile~print-training-configuration.f90->sourcefile~fiats_m.f90 sourcefile~read-query-infer.f90 read-query-infer.f90 sourcefile~read-query-infer.f90->sourcefile~fiats_m.f90 sourcefile~saturated_mixing_ratio_m.f90->sourcefile~fiats_m.f90 sourcefile~train-and-write.f90 train-and-write.F90 sourcefile~train-and-write.f90->sourcefile~fiats_m.f90 sourcefile~trainable_network_m.f90->sourcefile~training_configuration_m.f90 sourcefile~training_configuration_s.f90 training_configuration_s.F90 sourcefile~training_configuration_s.f90->sourcefile~training_configuration_m.f90 sourcefile~write-read-infer.f90 write-read-infer.F90 sourcefile~write-read-infer.f90->sourcefile~fiats_m.f90 sourcefile~trainable_network_s.f90 trainable_network_s.f90 sourcefile~trainable_network_s.f90->sourcefile~trainable_network_m.f90

Source Code

! Copyright (c), The Regents of the University of California
! Terms of use are as specified in LICENSE.txt
module hyperparameters_m
  use julienne_string_m, only : string_t
  use kind_parameters_m, only : default_real, double_precision
  use double_precision_string_m, only : double_precision_string_t
  implicit none
  private
  public :: hyperparameters_t

  type hyperparameters_t(k)
    integer, kind :: k = default_real
    integer, private:: mini_batches_ = 10
    real(k), private :: learning_rate_ = real(1.5,k)
    character(len=:), allocatable :: optimizer_
  contains
    generic :: to_json => default_real_to_json, double_precision_to_json
    procedure, private :: default_real_to_json, double_precision_to_json
    generic :: operator(==) => default_real_equals, double_precision_equals
    procedure, private ::      default_real_equals, double_precision_equals
    generic :: mini_batches => default_real_mini_batches, double_precision_mini_batches
    procedure, private ::      default_real_mini_batches, double_precision_mini_batches
    generic :: optimizer_name => default_real_optimizer_name, double_precision_optimizer_name
    procedure, private ::        default_real_optimizer_name, double_precision_optimizer_name
    generic :: learning_rate => default_real_learning_rate, double_precision_learning_rate
    procedure, private ::       default_real_learning_rate, double_precision_learning_rate
  end type

  interface hyperparameters_t

    pure module function default_real_from_json(lines) result(hyperparameters)
      implicit none
      type(string_t), intent(in) :: lines(:)
      type(hyperparameters_t) hyperparameters
    end function

    pure module function double_precision_from_json(lines) result(hyperparameters)
      implicit none
      type(double_precision_string_t), intent(in) :: lines(:)
      type(hyperparameters_t(double_precision)) hyperparameters
    end function

    pure module function default_real_from_components(mini_batches, learning_rate, optimizer) result(hyperparameters)
      implicit none
      integer, intent(in) :: mini_batches
      real, intent(in) :: learning_rate
      character(len=*), intent(in) :: optimizer
      type(hyperparameters_t) hyperparameters
    end function

    pure module function double_precision_from_components(mini_batches, learning_rate, optimizer) result(hyperparameters)
      implicit none
      integer, intent(in) :: mini_batches
      double precision, intent(in) :: learning_rate
      character(len=*), intent(in) :: optimizer
      type(hyperparameters_t(double_precision)) hyperparameters
    end function

  end interface

  interface

    pure module function default_real_to_json(self) result(lines)
      implicit none
      class(hyperparameters_t), intent(in) :: self
      type(string_t), allocatable :: lines(:)
    end function

    pure module function double_precision_to_json(self) result(lines)
      implicit none
      class(hyperparameters_t(double_precision)), intent(in) :: self
      type(string_t), allocatable :: lines(:)
    end function

    elemental module function default_real_equals(lhs, rhs) result(lhs_equals_rhs)
      implicit none
      class(hyperparameters_t), intent(in) :: lhs, rhs
      logical lhs_equals_rhs
    end function

    elemental module function double_precision_equals(lhs, rhs) result(lhs_equals_rhs)
      implicit none
      class(hyperparameters_t(double_precision)), intent(in) :: lhs, rhs
      logical lhs_equals_rhs
    end function

    elemental module function default_real_mini_batches(self) result(num_mini_batches)
      implicit none
      class(hyperparameters_t), intent(in) :: self
      integer num_mini_batches
    end function

    elemental module function double_precision_mini_batches(self) result(num_mini_batches)
      implicit none
      class(hyperparameters_t(double_precision)), intent(in) :: self
      integer num_mini_batches
    end function

     elemental module function default_real_learning_rate(self) result(rate)
       implicit none
       class(hyperparameters_t), intent(in) :: self
       real rate
     end function

     elemental module function double_precision_learning_rate(self) result(rate)
       implicit none
       class(hyperparameters_t(double_precision)), intent(in) :: self
       double precision rate
     end function

    elemental module function default_real_optimizer_name(self) result(identifier)
      implicit none
      class(hyperparameters_t), intent(in) :: self
      type(string_t) identifier
     end function

    elemental module function double_precision_optimizer_name(self) result(identifier)
      implicit none
      class(hyperparameters_t(double_precision)), intent(in) :: self
      type(string_t) identifier
     end function

  end interface

end module