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
## 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 |
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
% 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 |
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
# 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) { |