Inference

AdvancedHMC/AdvancedMH/AdvancedNUTS based inference

SubspaceInference.sub_inferenceMethod
sub_inference(in_model, data, W_swa, P; σ_z = 1.0, σ_m = 1.0, σ_p = 1.0, itr=100, 
M = 3, alg = :rwmh,	backend = :forwarddiff)

To generate the uncertainty in machine learing models using MH Sampler from subspace

Input Arguments

  • in_model : Machine learning model. Eg: Chain(Dense(10,2)). Model should be created with Chain in Flux
  • data : Inputs and outputs. Eg: X = rand(10,100); Y = rand(2,100); data = DataLoader(X,Y);
  • W_swa : Mean Weight
  • P : Projection Matrix

Keyword Arguments

  • σ_z : Standard deviation of subspace
  • σ_m : Standard deviation of likelihood model
  • σ_p : Standard deviation of prior
  • itr : Iterations for sampling
  • M : Maximum number of columns in deviation matrix. Eg: M= 3
  • alg : Sampling Algorithm. Eg: :rwmh
  • backend : Differentiation backend. Eg: :forwarddiff

Output

  • chn : Chain with samples with uncertainty informations
  • lp : Log probabilities of all samples
source

Autoencoder based inference

SubspaceInference.auto_inferenceMethod
auto_inference(m, data, decoder, W_swa; σ_z = 1.0,
σ_m = 1.0, σ_p = 1.0, itr=100, M = 3, alg = :hmc,
backend = :forwarddiff)

To generate the uncertainty in machine learing or neural ODE models using auto-encoders

Input Arguments

  • m : Machine learning model. Eg: Chain(Dense(10,2)). Model should be created with Chain in Flux
  • data : Inputs and outputs. Eg: X = rand(10,100); Y = rand(2,100); data = DataLoader(X,Y);
  • decoder : Decoder to generate NN or Neural ODE parameters from subspace
  • W_swa : Mean Weight

Keyword Arguments

  • σ_z : Standard deviation of subspace
  • σ_m : Standard deviation of likelihood model
  • σ_p : Standard deviation of prior
  • itr : Iterations for sampling
  • M : Maximum number of columns in deviation matrix. Eg: M= 3
  • alg : Sampling Algorithm. Eg: :rwmh
  • backend : Differentiation backend. Eg: :forwarddiff

Output

  • chn : Chain with samples with uncertainty informations
  • lp : Log probabilities of all samples
source

Turing based inference

SubspaceInference.turing_inferenceMethod
turing_inference(m, data, W_swa, P; σ_z = 1.0,
σ_m = 1.0, σ_p = 1.0, itr=100, M = 3, alg = :turing_mh,
backend = :forwarddiff)

To generate the uncertainty in machine learing or neural ODE models using auto-encoders

Input Arguments

  • m : Machine learning model. Eg: Chain(Dense(10,2)). Model should be created with Chain in Flux
  • data : Inputs and outputs. Eg: X = rand(10,100); Y = rand(2,100); data = DataLoader(X,Y);
  • W_swa : Mean Weight
  • P : Projection Matrix

Keyword Arguments

  • σ_z : Standard deviation of subspace
  • σ_m : Standard deviation of likelihood model
  • σ_p : Standard deviation of prior
  • itr : Iterations for sampling
  • M : Maximum number of columns in deviation matrix. Eg: M= 3
  • alg : Sampling Algorithm. Eg: :turing_mh
  • backend : Differentiation backend. Eg: :forwarddiff

Output

  • chn : Chain with samples with uncertainty informations
  • lp : Log probabilities of all samples
source