3 - What makes a model?

Analytical Paleobiology Workshop 2022

Your turn

How many different models can you think of?

05:00

Steps for applying machine learning

  • Choose a model
  • Specify additional parameters if any.
  • That’s it for now!

Choosing a model

library(h2o)

h2o.init(nthreads = 1, #Number of threads/cores 
         max_mem_size = "1G")  #max mem size is the maximum memory to allocate to H2O


abalone <- read.csv("abalone.csv")
abalone$sex <- as.factor(abalone$sex) # NEW LINE ADDED

abalone_h2o <- as.h2o(abalone) # convert to h2o data

ring_split <- h2o.splitFrame(abalone_h2o, ratio=0.7)

ring_train <- ring_split[[1]]
ring_test <- ring_split[[2]]

Choosing a model


?h2o.glm()

predictors <- colnames(abalone)[1:8]
target <- "rings"

mod_glm1 <- h2o.glm(x = predictors, y= target, 
                   training_frame=ring_train)

Steps for applying machine learning

  • Choose a model
  • Specify additional parameters if any.
  • That’s it for now!

Specifying parameters

mod_glm2 <- h2o.glm(x = predictors, y= target, 
                   training_frame=ring_train,
                   family="gaussian",
                   lambda = 0, compute_p_values = TRUE)

How to choose the optimal lambda value: click here to read.

Your turn

  • Choose a model
  • Specify additional parameters if any.
  • That’s it for now!

20:00