Diagnostic functions

GPLinearODEMaker.est_dΣdθMethod
est_dΣdθ(glo, kernel_hyperparameters; return_est=true, return_anal=false, return_dif=false, return_bool=false, dif=1e-6, print_stuff=true)

Estimate the covariance derivatives of glo (a GLOM model) at kernel_hyperparameterswith forward differences

Keyword Arguments

  • return_est::Bool=true: Add the numerically estimated dΣdθs to the output
  • return_anal::Bool=false: Add the analytical dΣdθs to the output
  • return_dif::Bool=false: Add the difference between the dΣdθs to the output
  • return_bool::Bool=false: Return just a similarity Boolean
  • dif::Real=1e-6: The step size used in the forward difference method
  • print_stuff::Bool=true: Whether to print things

Output

  • If return_bool==true, returns a Boolean for whether the analytical and

numerical estimates for the dΣdθs are approximately the same.

  • Else returns a vector with some combination of the numerically estimated

dΣdθs, analytical dΣdθs, and differences between them

source
GPLinearODEMaker.est_∇Method
est_∇(f::Function, inputs::Vector{<:Real}; dif=1e-7, ignore_0_inputs=false)

Estimate the gradient of f at inputs with forward differences

Examples

julia> f(x) = x[1] + x[2]^2;

julia> isapprox([1,4], GPLinearODEMaker.est_∇(f, [2, 2.]); rtol=1e-5)
true
source
GPLinearODEMaker.est_∇∇Method
est_∇∇(g::Function, inputs::Vector{<:Real}; dif=1e-7, ignore_0_inputs=false)

Estimate the Hessian of a function whose gradients are provided by g at inputs with forward differences

Examples

julia> g(x) = [(x[2] ^ 2) / 2, x[1] * x[2]];  # h(x) = [0 x[2], x[2] x[1]]

julia> isapprox([0. 9; 9 4], GPLinearODEMaker.est_∇∇(g, [4., 9]); rtol=1e-5)
true
source
GPLinearODEMaker.est_∇∇_from_fMethod
est_∇∇_from_f(f::Function, inputs::Vector{<:Real}; dif=1e-7, ignore_0_inputs=false)

Estimate the Hessian of f at inputs with forward differences. WARNING: The result is very sensitive to dif

Examples

julia> f(x) = (x[1] * x[2] ^ 2) / 2;  # h(x) = [0 x[2], x[2] x[1]]

julia> isapprox([0. 9; 9 4], GPLinearODEMaker.est_∇∇_from_f(f, [4., 9]; dif=1e-4); rtol=1e-3)
true
source
GPLinearODEMaker.test_∇Method
test_∇(est_G, G; print_stuff=true, function_name="function")

Check if two gradient vectors (est_G and G) are approximately the same

Examples

julia> GPLinearODEMaker.test_∇([1., 2, 3], [1.0001, 2, 3]; print_stuff=false)
true
julia> GPLinearODEMaker.test_∇([1., 2, 3], [0., 2, 3]; print_stuff=false)
false
source
GPLinearODEMaker.test_∇nlogL_GLOMMethod
test_∇nlogL_GLOM(glo, kernel_hyperparameters; dif=1e-4, print_stuff=true)

Check if ∇nlogL_GLOM(glo, total_hyperparameters) is close to numerical estimates provided by est_∇nlogL_GLOM(glo, total_hyperparameters)

source
GPLinearODEMaker.test_∇∇Method
test_∇∇(est_H, H; print_stuff=true, function_name="function", rtol=1e-3)

Check if two Hessian matrices (est_H and H) are approximately the same

Examples

julia> GPLinearODEMaker.test_∇∇([1. 2; 3 4], [1.0001 2; 3 4]; print_stuff=false)
true
julia> GPLinearODEMaker.test_∇∇([1. 2; 3 4], [0. 2; 3 4]; print_stuff=false)
false
source
GPLinearODEMaker.test_∇∇nlogL_GLOMMethod
test_∇∇nlogL_GLOM(glo, kernel_hyperparameters; dif=1e-4, print_stuff=true)

Check if ∇∇nlogL_GLOM(glo, total_hyperparameters) is close to numerical estimates provided by est_∇∇nlogL_GLOM(glo, total_hyperparameters)

source