Skip to content

Instantly share code, notes, and snippets.

View carloscinelli's full-sized avatar

Carlos Cinelli carloscinelli

View GitHub Profile
@brendano
brendano / gist:39760
Created December 24, 2008 20:11
load the MNIST data set in R
# Load the MNIST digit recognition dataset into R
# http://yann.lecun.com/exdb/mnist/
# assume you have all 4 files and gunzip'd them
# creates train$n, train$x, train$y and test$n, test$x, test$y
# e.g. train$x is a 60000 x 784 matrix, each row is one digit (28x28)
# call: show_digit(train$x[5,]) to see a digit.
# brendan o'connor - gist.github.com/39760 - anyall.org
load_mnist <- function() {
load_image_file <- function(filename) {
@ummels
ummels / mydiss.cls
Last active July 18, 2024 00:14
Class file for my PhD thesis
% Copyright (c) 2010 Michael Ummels <[email protected]>
%
% Permission to use, copy, modify, and/or distribute this software for any
% purpose with or without fee is hereby granted, provided that the above
% copyright notice and this permission notice appear in all copies.
%
% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@bbolker
bbolker / bayes_tails.R
Last active September 12, 2023 22:20
bayes tails examples
## original by Richard McElreath at https://twitter.com/rlmcelreath/status/1701165075493470644,
## https://gist.github.com/rmcelreath/39dd410fc6bb758e54d79249b11eeb2f
## originally based on https://doi.org/10.1006/jmva.1999.1820
## with improvements from https://gist.github.com/murphyk/94205bcf335837108ff0e6d51331785a
post_prior <- function(
m_pr = 10, m_lik = 0, ## mean values for prior and likelihood
sd_pr = 1, sd_lik = 1, ## standard deviations
df_pr = 1000, df_lik = 1000, ## dfs (df = 1000 is effectively Gaussian)
xlim = c(-5, 15), n = 1001, ## range and delta for x-vector