Skip to content

Instantly share code, notes, and snippets.

View vikram-s-narayan's full-sized avatar

Vikram vikram-s-narayan

View GitHub Profile
@vikram-s-narayan
vikram-s-narayan / gist:15352b020986a247da38a7c201d69dfe
Created December 13, 2022 03:28
Test of GEKPLS with First Datapoint Removed in Test Dataset Generated by GoldenSample from QMC@0.2.19
# 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
@vikram-s-narayan
vikram-s-narayan / gekpls_quasi_tests.jl
Created December 6, 2022 12:55
Standalone GEKPLS to help pinpoint bug in QuasiMonteCarlo.jl
# 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
@vikram-s-narayan
vikram-s-narayan / vikram-gsoc-report.md
Last active February 1, 2023 20:38
Final Report on GSoC 22 Improvements to Surrogates

Project Details:

Org: SciML-NumFOCUS

Contributor: Vikramaditya Narayan

Mentors: Chris Rackauckas and Ranjan Anantharaman

What Work Was Done:

@vikram-s-narayan
vikram-s-narayan / modified_krg_based.py
Last active July 7, 2022 06:33
Gist to reproduce correlation anomaly between rmse and rlfv in SMT GEKPLS
#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
)
@vikram-s-narayan
vikram-s-narayan / comparison_3_dimensions_juliacon.jl
Last active July 6, 2022 06:10
Comparison of GEKPLS on Welded Beam Test with Kriging, RBF and PolyChaos for JuliaCon 2022 Presentation
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))
@vikram-s-narayan
vikram-s-narayan / comparison_8_dimensions_juliacon.jl
Last active July 5, 2022 07:27
Comparison of GEKPLS on Water Flow Test with Kriging, RBF and PolyChaos for JuliaCon 2022 Presentation
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))
@vikram-s-narayan
vikram-s-narayan / gekpls_benchmarked.jl
Last active June 22, 2022 15:58
comparison of GEKPLS with RBF and Kriging
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
@vikram-s-narayan
vikram-s-narayan / GEKPLS_V1.jl
Created May 26, 2022 13:36
First attempt at GEKPLS
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
@vikram-s-narayan
vikram-s-narayan / AD_compatibility_PROPOSED.jl
Last active January 20, 2022 07:06
Proposed file to replace test/AD_compatibility.jl in Surrogates.jl (https://github.com/SciML/Surrogates.jl/blob/master/test/AD_compatibility.jl)
using Surrogates
using LinearAlgebra
using Flux
using Flux: @epochs
using Zygote
using PolyChaos
using Test
#using Zygote: @nograd
#=
#FORWARD