Skip to content

Instantly share code, notes, and snippets.

View jonsedar's full-sized avatar

Jonathan Sedar jonsedar

View GitHub Profile
@jonsedar
jonsedar / lib_getter.r
Last active December 15, 2015 12:18
[R] Convenience function to load R libraries or install then load if they're not found. Handy when deploying/executing new code on several servers. Uses the active boolean response from require() rather than the passive library() load function. Replace the repo with your favorite. This will install libraries to your system's default location.
lib_getter <- function(y){
# Accepts a char array of package / library names, and loads or installs then loads them
# Returns a char array of load status messages
r <- ''
for (x in y) {
if (!require(x,character.only=TRUE,quietly=TRUE,warn.conflicts=FALSE)) {
install.packages(x, repos="http://cran.ma.imperial.ac.uk/")
if(require(x,character.only=TRUE,quietly=TRUE,warn.conflicts=FALSE)) {
r <- c(r,paste(x,'installed and loaded'))
} else {
@jonsedar
jonsedar / DemoPoissonRegression.ipynb
Last active November 29, 2020 03:03
An excuse to demo Poisson Regression in PyMC3 and PyStan
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonsedar
jonsedar / MRE_missing_values.ipynb
Last active March 31, 2021 17:35
MRE_missing_values
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonsedar
jonsedar / GRW_Future_Prediction_Example.ipynb
Last active October 5, 2022 18:45
Example model for holdout (future) set PPC using a GaussianRandomWalk in pymc3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonsedar
jonsedar / 800_issue_potential_debug.ipynb
Last active October 21, 2023 11:07
800_issue_potential_debug
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.