T# Install H2O if needed if (!require(h2o)) { install.packages(“h2o”) library(h2o) } else { library(h2o) } # Initialize H2O h2o.init()
data(iris)
head(iris)
iris_h2o <- as.h2o(iris)
iris_h2o
y <- “Species” x <- setdiff(names(iris_h2o), y)
model <- h2o.glm( x = x, y = y, training_frame = iris_h2o, family = “multinomial” )
model
predictions <- h2o.predict(model, iris_h2o)
head(predictions)
performance <- h2o.performance(model)
performance
This activity introduced me to the H2O framework and showed how machine learning models can be built quickly using R. By initializing the H2O cluster, converting data into H2O frames, training a model, and generating predictions, I was able to understand the basic workflow of H2O. This exercise helped me see how H2O simplifies the process of building scalable machine learning models.