This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Simple script implementing the Banach fixed point Theorem applied to iterations in linear equation models. | |
| In particular, I implement the Jacobi iteration and the Gauss-Seidel iteration. | |
| The implementation of this script follows the theory in Chapter 5.2 of Kreyszig's "Introductory functional analysis with applications". | |
| The architecture is based on a super class "LinearIteration" which implements the methods common to all linear iteration | |
| methods, and then we have the JacobiIteration and GaussSeidelIteration which simply implements the initialisation | |
| of the iteration matrix and vector. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ Short script showcasing Hamiltonian Monte Carlo (HMC) | |
| I used JAX as a backend to estimate the negative log posterior, | |
| and the gradients of it with respect to our parameters of interest. | |
| In addition, I added a function to validate the inference from the method: | |
| bayesian_fraction_missing_information which estimates the E-BFMI. | |
| The assumed model is a simple linear regression: | |
| beta_i ~ Normal(0,1) |