Publications by Jake
Belief Propagation
Belief Propogation Jake 06/12/2022 Generalised belief propogation algorithms can provide approximations for inference Belief Propogation Belief propogation is a message passing algorithm Exact Polytree Algorithm Create a jointree with the same structure as the polytree A node \(i\) in the jointree has cluster \(C_i=XU\) Edge \(U\rightarrow...
3317 sym 9 img
Likelihood Learning
Likelihood Parameter and Structure Learning Jake 06/12/2022 Maximum Likelihood Parameter Learning With complete data we count frequencies This is the maximum likelihood estimate Almost minimises the KL divergence \[\theta^{ml}_{x|u} = P_D(x|u) = \frac{D\#(x,u)}{D\#(u)}\] The variance of this estimator will decrease as the dataset increases ...
4919 sym 17 img
Assessing Fit
Asessing Model Fit Jake 30/05/2021 Introduction Statistical Modelling The goal of statistical learning to link a response variable Y to p different predictors, where \(f\) is a fixed by unknown function and \(\epsilon\) is a random error term with mean 0. We estimate this \(f\) through many different statistical learning approaches. \[ Y = f(X...
7704 sym 8 img
Visualisation
Visualisation Jake 15/05/2021 Packages often used are MASS and ggplot2, and in 3142 we also use ISLR library('ggplot2') library('MASS') library('ISLR') ## Warning: package 'ISLR' was built under R version 3.6.3 Base R plot examples Bar plot Example: obs_bar <- rnorm(100,3,2) hist(obs_bar, xlab = "Observations") Line Graph Example: obs_line ...
1358 sym R (3406 sym/21 pcs) 18 img
Dplyr
Dyplr is a commonly used package for manipulating a dataframe library('dplyr') Filter filters the data set: filter(mtcars, mpg > 30)[1:4,] ## mpg cyl disp hp drat wt qsec vs am gear carb ## 1 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 ## 2 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 ## 3 33.9 4 71.1 65 4.22 1.835 19.9...
616 sym R (2644 sym/18 pcs)
Data Structures
Vectors You can create a vector in the following ways c(1,2,3) ## [1] 1 2 3 c(1:5) ## [1] 1 2 3 4 5 seq(from=0, to=1, by=0.1) ## [1] 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Operations on vectors are done element wise c(1,2,3) + c(1,2,3) ## [1] 2 4 6 c(1,2,3)+2 ## [1] 3 4 5 c(1,2,3)*c(1,2,3) ## [1] 1 4 9 Can use the commands length(), sort(),...
2288 sym R (3855 sym/56 pcs)
Control Flow
If Loop An example of a for loop syntax: x <- 3 y <- 2 if (x<=y) { print("x smaller than y") } else { print("x larger than y") } ## [1] "x larger than y" Example of a for loop j <- 0 for (i in 1:3){ j <- i+j} print(j) ## [1] 6 While loop example: x <- 2 y <- 1 while(x+y<6){ x<-x+y print(x+y)} ## [1] 4 ## [1] 5 ## [1] 6 ...
190 sym R (396 sym/7 pcs)
Basic Statistical Stuff
Can create a frequency table with the table() function (tc <- table(mtcars$cyl)) ## ## 4 6 8 ## 11 7 14 nlevels(mtcars$cyl) ## [1] 0 Can create a table with paired observations (mytable <- table(mtcars$cyl,mtcars$carb)) ## ## 1 2 3 4 6 8 ## 4 5 6 0 0 0 0 ## 6 2 0 0 4 1 0 ## 8 0 4 3 6 0 1 (table.complete <- addmargins(myt...
455 sym R (2824 sym/33 pcs)
Resampling
Resampling Jake 06/07/2021 The goal of resampling is to repeatedly draw samples form a training set in order to refit and test a model multiple times on a single training set. We can estimate the test error rate through resampling methods or mathematical adjustments to the training error rate that accounts for overfitting. Validation Set Approa...
5328 sym R (1231 sym/10 pcs) 4 img
Classification
Classification Jake 05/07/2021 Classification is used when the response \(y_i\) is qualitative/categorical. Our goal is to find a predictive function \(f\) that can estimate the probabilities of each class and classify the observation into the class where the relative decision boundary is passed: \[ P(Y=k|X) \in [0,1]\] * Error Rate is a common...
8732 sym R (3060 sym/26 pcs) 7 img