First, navigate to https://www.techtonique.net/token to obtain your token (token = what appears after 'Authorization: Bearer' below). Get data from: https://github.com/Techtonique/datasets, and download the datasets to your local machine. Translate to your favorite language, using https://curlconverter.com/.
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
.PHONY: clean getwd initialize help render-rnw render-rmd setwd | |
.DEFAULT_GOAL := help | |
define BROWSER_PYSCRIPT | |
import os, webbrowser, sys | |
from urllib.request import pathname2url | |
# The input is expected to be the full HTML filename | |
filename = sys.argv[1] | |
filepath = os.path.abspath(os.path.join(filename)) |
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
import numpy as np | |
from typing import Any, Callable, Iterable | |
from math import factorial | |
from itertools import chain, combinations | |
class ShapFromScratchExplainer(): | |
def __init__(self, | |
model: Callable[[np.ndarray], float], | |
background_dataset: np.ndarray, | |
max_samples: int = None): |
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
.PHONY: build buildsite check clean cleanvars coverage docs getwd initialize install installcranpkg installgithubpkg installedpkgs load removepkg render setwd start test usegit | |
.DEFAULT_GOAL := help | |
# The directory where R files are stored | |
R_DIR = ./R | |
define BROWSER_PYSCRIPT | |
import os, webbrowser, sys | |
from urllib.request import pathname2url |
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
# rm(list=ls()) | |
install.packages('learningmachine', | |
repos = c('https://techtonique.r-universe.dev', | |
'https://cloud.r-project.org')) | |
# or | |
# install.packages("remotes", repos = c(CRAN="https://cloud.r-project.org")) | |
#remotes::install_github("Techtonique/learningmachine") | |
library(learningmachine) |
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
To install chruby and ruby-install: | |
brew install chruby ruby-install | |
To install Ruby using ruby-install: | |
ruby-install ruby 2.7.1 | |
NOTE: You can find latest stable version of Ruby here: https://www.ruby-lang.org/en/downloads/ | |
If you have issues installing Ruby then try the following: | |
brew install openssl@3 | |
ruby-install 3.2.2 -- --with-openssl-dir=$(brew --prefix openssl@3) |
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
# Wilson function | |
fonctionsWilson <- function(t,u,alpha,UFR) | |
{ | |
N <- length(u) | |
J <- length(t) | |
u_mat <- matrix(rep.int(u,J), nrow=J, byrow=T) | |
t_mat <- t(matrix(rep.int(t,N), nrow=N, byrow=T)) | |
min_u <- u_mat*(u_mat<=t_mat) + t_mat*(u_mat>t_mat) | |
max_u <- u_mat + t_mat - min_u | |
return(exp(-UFR*(u_mat+t_mat))*(alpha*min_u - 0.5*exp(-alpha*max_u)*(exp(alpha*min_u)-exp(-alpha*min_u)))) |