Skip to content

Instantly share code, notes, and snippets.

View theogf's full-sized avatar
😶‍🌫️

Théo Galy-Fajou theogf

😶‍🌫️
View GitHub Profile
@theogf
theogf / studentt.jl
Last active May 23, 2019 10:54
Student-T GP Augmented model model
using Turing
using MLKernels
using LinearAlgebra
N=100
X = sort(rand(N,1),1) #Create some data
K = kernelmatrix(SquaredExponentialKernel(100.0),X) #Kernel matrix
y = rand(MvNormal(zeros(N),K+1e-1I)) #Sample from the GP prior with some noise
# Model representing Student-T Likelihood => Normal(y|f,omega)IG(omega|nu/2,nu/2)
@theogf
theogf / surfaceshiftxfail.jl
Created May 24, 2019 09:53
Failing to update x position for a surface
using Makie
N_grid = 100
x_grid = range(0,1,length=N_grid)
scene = Makie.surface(x_grid,x_grid,rand(N_grid,N_grid))
push!(scene[end][1],scene[end][1][].+ 1.0f0)
@theogf
theogf / kernelcompare.jl
Last active June 12, 2019 14:45
Comparison performance
using KernelFunctions
using Stheno
using Stheno: pw
using BenchmarkTools
using Zygote
# Ds = [1,2,5,10,20,50,100,200,500,1000]
Ds = [1,10,100,1000]
timestheno = zeros(Float64,length(Ds)); memstheno = similar(timestheno)
timekf = similar(timestheno); memkf = similar(timestheno)
@theogf
theogf / logojuliagps.jl
Created March 24, 2020 19:13
Logo Julia Gaussian Processes
using Plots, Colors, Measures
using AugmentedGaussianProcesses
pyplot()
julia_blue = RGB(0.251, 0.388, 0.847)
julia_green = RGB(0.22, 0.596, 0.149)
julia_purple = RGB(0.584, 0.345, 0.698)
julia_red = RGB(0.796, 0.235, 0.2)
x = [0.1, 0.2, 0.3]
using Plots; pyplot()
N = 100
x = range(-3, 3, length=N)
f1(x, y) = begin z = Complex(x, y); abs(z^z); end
f2(x, y) = begin z = Complex(x, y); angle(z^z); end
surface(x, x, f1.(x, x'), fill_z = f2.(x, x'), clims = (-pi, pi), color = :colorwheel)
@theogf
theogf / normalizing_flows.jl
Last active April 28, 2020 18:22
Animation of normalizing flows
using Distributions
using Bijectors
using Makie, Colors
using Animations
p0 = MvNormal(ones(2))
samples = rand(p0, 1)
abslim = -7
using Distributions
using Plots; pyplot()
using ForwardDiff
using LaTeXStrings
λ = 3.0
μ = 2.0
s = 0.8
# α = Exponential(λ) # Measure alpha the starting point
α = Laplace(μ, s + 1.0)
@theogf
theogf / sinkhorn.jl
Created May 9, 2020 20:12
Implementation of the sinkhorn algorithm
using Makie
using MakieLayout
using LinearAlgebra, Distances
using Distributions
α = MixtureModel([Normal(0.2, 0.05), Normal(0.6, 0.06), Normal(0.8, 0.04)], [0.3, 0.5, 0.2])
# β = Normal(0.3, 0.09)
β = Laplace(0.5, 0.1)
using HTTP
using Dates
using Printf
using JSON
using DataFrames
using FileIO
using CSV
work_location = (52.516747,13.323553)
@theogf
theogf / compare_block_diagonal.jl
Created September 15, 2020 12:12
Comparing how to make diagonal block matrices
using BlockDiagonals
using StatsBase
using BenchmarkTools
using Test
D = 2000
N = 100
K = 20
G = rand(D, N)
X = rand(D, N)
indices = vcat(1, sort(sample(2:D-1, K-1, replace = false)), D+1)