install.packages("h2o")
trying URL 'http://rspm/default/__linux__/noble/latest/src/contrib/bitops_1.0-9.tar.gz'
trying URL 'http://rspm/default/__linux__/noble/latest/src/contrib/RCurl_1.98-1.17.tar.gz'
trying URL 'http://rspm/default/__linux__/noble/latest/src/contrib/h2o_3.44.0.3.tar.gz'
The downloaded source packages are in
‘/tmp/Rtmp0GnvsN/downloaded_packages’
library(h2o)
h2o.init()
H2O is not running yet, starting it now...
Note: In case of errors look at the following log files:
/tmp/Rtmp0GnvsN/file17b5023109e/h2o_r2754159_started_from_r.out
/tmp/Rtmp0GnvsN/file17b2f51977b/h2o_r2754159_started_from_r.err
Starting H2O JVM and connecting: ... Connection successful!
R is connected to the H2O cluster:
H2O cluster uptime: 2 seconds 338 milliseconds
H2O cluster timezone: UTC
H2O data parsing timezone: UTC
H2O cluster version: 3.44.0.3
H2O cluster version age: 2 years, 1 month and 13 days
H2O cluster name: H2O_started_from_R_r2754159_jaa137
H2O cluster total nodes: 1
H2O cluster total memory: 0.23 GB
H2O cluster total cores: 1
H2O cluster allowed cores: 1
H2O cluster healthy: TRUE
H2O Connection ip: localhost
H2O Connection port: 54321
H2O Connection proxy: NA
H2O Internal Security: FALSE
R Version: R version 4.5.2 (2025-10-31)
??h2o
#Starting the H20 cluster
library(h2o)
h2o.init()
Connection successful!
R is connected to the H2O cluster:
H2O cluster uptime: 4 hours 20 minutes
H2O cluster timezone: UTC
H2O data parsing timezone: UTC
H2O cluster version: 3.44.0.3
H2O cluster version age: 2 years, 1 month and 13 days
H2O cluster name: H2O_started_from_R_r2754159_jaa137
H2O cluster total nodes: 1
H2O cluster total memory: 0.19 GB
H2O cluster total cores: 1
H2O cluster allowed cores: 1
H2O cluster healthy: TRUE
H2O Connection ip: localhost
H2O Connection port: 54321
H2O Connection proxy: NA
H2O Internal Security: FALSE
R Version: R version 4.5.2 (2025-10-31)
#Loading dataset into H20
datasets <- "https://raw.githubusercontent.com/DarrenCook/h2o/bk/datasets/"
data <- h2o.importFile(paste0(datasets, "iris_wheader.csv"))
|
| | 0%
|
|======================================================| 100%
#Choosing target and predictors. Split/train and test
y <- "class"
x <- setdiff(names(data), y)
parts <- h2o.splitFrame(data, 0.8)
train <- parts[[1]]
test <- parts[[2]]
#Training model
m <- h2o.deeplearning(x, y, train)
|
| | 0%
|
|===== | 10%
|
|======================================================| 100%
#Predict model and evaluation
p <- h2o.predict(m, test)
|
| | 0%
|
|======================================================| 100%
h2o.confusionMatrix(m)
Confusion Matrix: Row labels: Actual class; Column labels: Predicted class
h2o.performance(m, test)
H2OMultinomialMetrics: deeplearning
Test Set Metrics:
=====================
MSE: (Extract with `h2o.mse`) 0.1668329
RMSE: (Extract with `h2o.rmse`) 0.4084518
Logloss: (Extract with `h2o.logloss`) 0.5514333
Mean Per-Class Error: 0.2666667
AUC: (Extract with `h2o.auc`) NaN
AUCPR: (Extract with `h2o.aucpr`) NaN
Confusion Matrix: Extract with `h2o.confusionMatrix(<model>, <data>)`)
=========================================================================
Confusion Matrix: Row labels: Actual class; Column labels: Predicted class
Hit Ratio Table: Extract with `h2o.hit_ratio_table(<model>, <data>)`
=======================================================================
Top-3 Hit Ratios:
NANANA