Looking at the decision boundary a classifier generates can give us some geometric intuition about the decision rule a classifier uses and how this decision rule changes as the classifier is trained on more data.
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
library(brms) | |
library(parsnip) | |
## Fits a brms model | |
convex_regression <- function(formula, data, | |
family = "gaussian", | |
alpha = 1, gamma = 2, # Yang (2014) recommends alpha=1, gamma=2 | |
verbose = 0, | |
...) { | |
if (gamma <= 1) { |
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 | |
import tensorflow as tf | |
from tensorflow import keras | |
from tensorflow.keras import layers | |
import matplotlib.pyplot as plt | |
from matplotlib import animation, rc | |
rc('animation', html='html5') | |
plt.style.use('seaborn-whitegrid') |
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 math | |
from itertools import product | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import tensorflow as tf | |
import tensorflow.keras as keras | |
from matplotlib import gridspec | |
# # Activation Model # |
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 tensorflow as tf | |
import tensorflow.experimental.numpy as tnp | |
from absl import logging | |
from typing import Callable, Dict, Union, Optional, Iterable, Sequence | |
from tensorflow import keras | |
from tensorflow.keras.optimizers.schedules import LearningRateSchedule | |
# Schedules ported from Optax | |
# https://github.com/deepmind/optax/blob/master/optax/_src/schedule.py |
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 | |
import matplotlib.pyplot as plt | |
plt.style.use("seaborn-whitegrid") | |
plt.rc('figure', autolayout=True) | |
plt.rc('axes', | |
labelweight='bold', | |
labelsize='large', |
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 | |
EPSILON = 1e-10 | |
def _error(actual: np.ndarray, predicted: np.ndarray): | |
""" Simple error """ | |
return actual - predicted | |
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
from joblib import delayed, Parallel | |
from pathlib import Path | |
from tqdm import tqdm | |
import hashlib | |
import imagehash | |
import pandas as pd | |
import PIL | |
import pybktree | |
from PIL import Image |