Org: SciML-NumFOCUS
Contributor: Vikramaditya Narayan
Mentors: Chris Rackauckas and Ranjan Anantharaman
# The purpose of this gist is to help pinpoint a potential bug in | |
# QuasiMonteCarlo. This gist shows the working of the GEKPLS surrogate model | |
# without the potential interferences from other Surrogates dependencies. | |
# To run the gist and reproduce the results: | |
# Run this gist with QuasiMonteCarlo@0.2.19; it can be seen that it produces | |
# far better results without the first data point in the test dataset | |
# Additional notes: | |
# - Ensure that no other packages that depend on QuasiMonteCarlo are in your package environment | |
# - QuasiMonteCarlo@0.2.17 and QuasiMonteCarlo@0.2.18 throw errors. More info for the cause can | |
# be seen here - https://github.com/SciML/QuasiMonteCarlo.jl/releases/tag/v0.2.17 |
# The purpose of this gist is to help pinpoint a potential bug in | |
# QuasiMonteCarlo. This gist shows the working of the GEKPLS surrogate model | |
# without the potential interferences from other Surrogates dependencies. | |
# To run the gist and reproduce the results: | |
# Run this gist with QuasiMonteCarlo@0.2.16 => all tests pass (evidenced by 3 true prints) | |
# Then run this gist with QuasiMonteCarlo@0.2.19 => all tests fail in a fashion similar to | |
# the failing tests of Surogates.jl - https://github.com/SciML/Surrogates.jl/pull/420 | |
# Additional notes: | |
# - Ensure that no other packages that depend on QuasiMonteCarlo are in your package environment | |
# - QuasiMonteCarlo@0.2.17 and QuasiMonteCarlo@0.2.18 throw errors. More info for the cause can |
#Add this line below | |
#above https://github.com/SMTorg/smt/blob/4a4df255b9259965439120091007f9852f41523e/smt/surrogate_models/krg_based.py#L1165 | |
#to try different theta values | |
optimal_theta = np.array([0.0001, 0.0001]) | |
optimal_rlf_value, optimal_par = self._reduced_likelihood_function( | |
theta=optimal_theta | |
) |
using Surrogates | |
using Zygote | |
using SurrogatesPolyChaos | |
using SurrogatesAbstractGPs | |
using AbstractGPs | |
function vector_of_tuples_to_matrix(v) | |
#helper function to convert training data generated by surrogate sampling into a matrix suitable for GEKPLS | |
num_rows = length(v) | |
num_cols = length(first(v)) |
using Surrogates | |
using Zygote | |
using SurrogatesPolyChaos | |
using SurrogatesAbstractGPs | |
using AbstractGPs | |
function vector_of_tuples_to_matrix(v) | |
#helper function to convert training data generated by surrogate sampling into a matrix suitable for GEKPLS | |
num_rows = length(v) | |
num_cols = length(first(v)) |
using Surrogates | |
using Zygote | |
using SurrogatesPolyChaos | |
function vector_of_tuples_to_matrix(v) | |
#helper function to convert training data generated by surrogate sampling into a matrix suitable for GEKPLS | |
num_rows = length(v) | |
num_cols = length(first(v)) | |
K = zeros(num_rows, num_cols) | |
for row in 1:num_rows |
using Statistics | |
using ScikitLearn | |
using LinearAlgebra | |
@sk_import cross_decomposition: PLSRegression | |
####### START OF ALL FUNCTIONS ########## | |
function _ge_compute_pls(X, y, n_comp, grads, delta_x, xlimits, extra_points) | |
""" |
using LinearAlgebra | |
using ExtendableSparse | |
Base.copy(t::Tuple) = t | |
mutable struct RadialBasis{F,Q,X,Y,L,U,C,S,D} <: AbstractSurrogate | |
phi::F | |
dim_poly::Q | |
x::X | |
y::Y |
using Surrogates | |
using LinearAlgebra | |
using Flux | |
using Flux: @epochs | |
using Zygote | |
using PolyChaos | |
using Test | |
#using Zygote: @nograd | |
#= | |
#FORWARD |