This file contains 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
ProgressBar = function(num_steps, freq=0.2) { | |
tic = Sys.time() | |
init = Sys.time() | |
current_step = 0 | |
update = function() { | |
current_step <<- current_step + 1 | |
toc = Sys.time() | |
if ((toc - tic > freq) || (current_step == num_steps)) { | |
.speed = current_step / as.numeric(toc - init) |
This file contains 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
ProgressBar = function(niters, freq=0.2) { | |
tic = Sys.time() | |
init = Sys.time() | |
advance = function(i) { | |
toc = Sys.time() | |
if ((toc - tic > freq) || (i == niters)) { | |
.speed = i / as.numeric(toc - init) | |
speed = round(ifelse(.speed > 1, .speed, 1 / .speed)) | |
speed_units = ifelse(.speed > 1, "it/s", "s/it") |
This file contains 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
// Place your key bindings in this file to override the defaults | |
[ | |
{ | |
"key": "ctrl+shift+h", | |
"command": "workbench.action.navigateLeft" | |
}, | |
{ | |
"key": "ctrl+shift+l", | |
"command": "workbench.action.navigateRight" | |
}, |
This file contains 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
# Julia: v1.7 | |
""" | |
Demo of using `Gibbs` sampling with `ESS` update for one set of parameters and | |
`GibbsConditional` for another. Demo model is a standard multiple linear | |
regression model with Gaussian priors for the coefficients and Inverse Gamma | |
prior for the variance of the error terms. Weakly / non-informative priors are | |
used. Results are benchmarked against the inference from a model sampled | |
entirely using NUTS. | |
""" |
This file contains 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
def ess_step(state, loglike_fn, prior_sampler, prev_loglike=None): | |
""" | |
state: current state | |
loglike_fn: loglikelihood function which accepts one argument: a | |
parameter vector. | |
prior_sampler: function (with no arguments) to sample from the prior, | |
which must be a multivariate normal. i.e. the function returns a | |
sample from a multivariate normal. | |
prev_loglike (float): the result of `loglike_fn(state)`, which should be computed previously. | |
""" |
This file contains 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
""" This file belongs in ~/AppData/Local/nvim/init.vim. Create if necessary. | |
""" Made for Windows OS. | |
""" Make sure that ~/AppData/Local/nvim/autoload/plug.vim contains a copy of plug.vim. | |
""" 1. Plugins | |
" NOTE: This script requires vim-plug. | |
" See: https://github.com/junegunn/vim-plug | |
" Install vimplug if needed. |
This file contains 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
{ | |
"shortcuts": [ | |
{ | |
"command": "notebook:run-all-below", | |
"keys": [ | |
"Ctrl Shift Enter" | |
], | |
"selector": ".jp-Notebook:focus" | |
}, | |
{ |
This file contains 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
" Plugins. | |
call plug#begin() | |
Plug 'luiarthur/tmux.vim' | |
Plug 'luiarthur/red.vim' | |
call plug#end() | |
" Color scheme. | |
silent! colorscheme noir " depends on `luiarthur/red.vim` | |
" Tab / buffer navigation. |
This file contains 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
# Always show status bar at the bottom of screen. | |
hardstatus alwayslastline | |
# Disable screen locking. | |
bind ^x | |
bind x |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.