Skip to content

Instantly share code, notes, and snippets.


Stijn de Waele sdewaele

View GitHub Profile
sdewaele / zscore-transform.jl
Last active Nov 26, 2020
Generic StatsBase.ZScoreTransform
View zscore-transform.jl
using CUDA
using StatsBase
import StatsBase: fit, transform!, reconstruct!, mean_and_std
Standardization (Z-score transformation)
struct ZScoreTransformGeneric{T<:Real,U<:AbstractVector{T}} <: AbstractDataTransform
sdewaele / getindex-zygote.jl
Last active Jan 25, 2020
setindex with copy to enable Zygote autodiff
View getindex-zygote.jl
using ZygoteRules:@adjoint
using Zygote
using Random
function ngradient(f, xs::AbstractArray...)
grads = zero.(xs)
for (x, Δ) in zip(xs, grads), i in 1:length(x)
δ = sqrt(eps())
tmp = x[i]
x[i] = tmp - δ/2
sdewaele / expm.jl
Last active Feb 28, 2019 — forked from matthiasschabel/expm.jl
Julia translation of MATLAB expm function (matrix exponential) and test code in Julia and MATLAB
View expm.jl
using LinearAlgebra
import Base.exp
import LinearAlgebra.exp!
function expmchk()
# EXPMCHK Check the class of input A and
# initialize M_VALS and THETA accordingly.
m_vals = [3 5 7 9 13];
# theta_m for m=1:13.
theta = [#3.650024139523051e-008