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(ggplot2) | |
library(reshape2) | |
datime <- seq(as.POSIXct("2021-01-01"), as.POSIXct("2021-01-31"), by="d") | |
set.seed(5) | |
tmpout <- round(runif(31, 20, 35), 1) | |
tmpin <- tmpout + round(runif(31, -6, -5), 1) | |
temps <- data.frame(datime, tmpout, tmpin) | |
theme_set(theme_bw()) |
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(tidyverse) | |
if (!"Ckmeans.1d.dp" %in% rownames(installed.packages())) { | |
install.packages("Ckmeans.1d.dp") | |
} | |
library(Ckmeans.1d.dp) | |
# params | |
n1 <- 150; u1 = 1.5; sd1 = 0.2 |
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
# author: matthew skiffington | |
# # purpose: make simple sorted column chart for dissertation re:dl repos | |
library(ggplot2) | |
library(scales) | |
dl_gitstars.vec <- | |
c( | |
'Pytorch' = 39600, | |
'Keras' = 47200, |
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(DiagrammeR) | |
gr <-grViz("digraph flowchart { | |
# node definitions with substituted label text | |
node [fontname = Helvetica, shape = rectangle] | |
# edge definitions with the node IDs | |
'Linear Combiner (Perceptron) (ANN)' -> 'Multiple Linear Combiner (One Layer Perceptron)'; | |
'Multiple Linear Combiner (One Layer Perceptron)'-> 'MLP (FFNN)' | |
'MLP (FFNN)' -> 'RBF-NN'; |
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
# Gradient descent example | |
# Start with some function f(x) we wish to optimise | |
# This might be the log likelihood - which can often be optimised analytically | |
# Or using more complex methods (e.g. the hessian, newton-raphson, fisher info) | |
# In practice this will usually be the loss likelihood of a NN | |
# To make this little script more generalisation, will use an AD package | |
#devtools::install_github("mailund/dfdr") | |
library(dfdr) |
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
# author: matthew skiffington | |
# purpose: plain viz of vc4 (surpassing vc dimension) for linear classifiers to go in dissertation - 16 plots | |
# highlights when data isn't shattered (VC dim of linear classifier is d+1) | |
# randomly generates 3 points and fits a glm + plots decision boundary - since it is +2 from data dimension, it is not always shattered | |
# original source: glm code adapted from: | |
# glm code adapted from : https://stats.stackexchange.com/questions/6206/how-to-plot-decision-boundary-in-r-for-logistic-regression-model/6207 | |
# plot code apated from: https://www.r-bloggers.com/beyond-basic-r-plotting-with-ggplot2-and-multiple-plots-in-one-figure/ | |
library(ggplot2) # viz | |
library(cowplot) # multi-viz |
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
# author: matthew skiffington | |
# purpose: make sigmoid simple viz to go in dissertation | |
sigmoid.func <- function(x) { | |
sapply( | |
FUN = function(x) { | |
x = (exp(x)/(1+exp(x))) | |
}, | |
X = x, | |
simplify = T |
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
# author: matthew skiffington | |
# purpose: plain viz of vc3 for linear classifiers to go in dissertation - 16 plots | |
# randomly generates 3 points and fits a glm + plots decision boundary | |
# original source: glm code adapted from: | |
# glm code adapted from : https://stats.stackexchange.com/questions/6206/how-to-plot-decision-boundary-in-r-for-logistic-regression-model/6207 | |
# plot code apated from: https://www.r-bloggers.com/beyond-basic-r-plotting-with-ggplot2-and-multiple-plots-in-one-figure/ | |
library(ggplot2) # viz | |
library(cowplot) # multi-viz |
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
# author: matthew skiffington | |
# date: 09/03/2020 | |
# purpose: produce timeline of nns for dissertation | |
# data ################# | |
library(timelineS) | |
library(lubridate) | |
# old |
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
# author: matthew skiffington | |
# purpose: make xor problem simple viz to go in dissertation | |
library(ggplot2) | |
xor.df <- setNames(object = data.frame( | |
rbind( | |
c(0,1,"Class 1"), | |
c(1,0,"Class 1"), | |
c(1,1,"Class 2"), | |
c(0,0,"Class 2") |
NewerOlder