This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

install.packages('h2o')
Error in install.packages : Updating loaded packages
library(h2o)
h2o.init()
 Connection successful!

R is connected to the H2O cluster: 
    H2O cluster uptime:         38 minutes 36 seconds 
    H2O cluster timezone:       UTC 
    H2O data parsing timezone:  UTC 
    H2O cluster version:        3.44.0.3 
    H2O cluster version age:    1 year, 1 month and 28 days 
    H2O cluster name:           H2O_started_from_R_r2782436_vzv701 
    H2O cluster total nodes:    1 
    H2O cluster total memory:   0.18 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.4.2 (2024-10-31) 
Warning in h2o.clusterInfo() : 
Your H2O cluster version is (1 year, 1 month and 28 days) old. There may be a newer version available.
Please download and install the latest version from: https://h2o-release.s3.amazonaws.com/h2o/latest_stable.html
library(h2o)
h2o.init(nthreads = -1)
 Connection successful!

R is connected to the H2O cluster: 
    H2O cluster uptime:         39 minutes 15 seconds 
    H2O cluster timezone:       UTC 
    H2O data parsing timezone:  UTC 
    H2O cluster version:        3.44.0.3 
    H2O cluster version age:    1 year, 1 month and 28 days 
    H2O cluster name:           H2O_started_from_R_r2782436_vzv701 
    H2O cluster total nodes:    1 
    H2O cluster total memory:   0.18 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.4.2 (2024-10-31) 
Warning in h2o.clusterInfo() : 
Your H2O cluster version is (1 year, 1 month and 28 days) old. There may be a newer version available.
Please download and install the latest version from: https://h2o-release.s3.amazonaws.com/h2o/latest_stable.html
datasets <- "https://raw.githubusercontent.com/DarrenCook/h2o/bk/datasets/"
data <- h2o.importFile(paste0(datasets, "iris_wheader.csv"))  

  |                                 
  |                           |   0%
  |                                 
  |===========================| 100%
y <- "class"  
x <- setdiff(names(data), y)
parts <- h2o.splitFrame(data, 0.8)#In R, h2o.splitFrame() takes an H2O frame and returns a list of the splits, which are assigned to train and test, for readability:  
train <- parts[[1]]
test <- parts[[2]]

m <- h2o.deeplearning(x, y, train)  

  |                                 
  |                           |   0%
  |                                 
  |===========================| 100%
h2o.mse(m)
[1] 0.1899852
h2o.confusionMatrix(m)
Confusion Matrix: Row labels: Actual class; Column labels: Predicted class
as.data.frame(p)
as.data.frame( h2o.cbind(p$predict, test$class) )

ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://localhost:54321/99/Rapids)

java.lang.IllegalArgumentException
 [1] "java.lang.IllegalArgumentException: cbind frames must have all the same rows, found 23 and 32 rows."         
 [2] "    water.rapids.ast.prims.mungers.AstCBind.apply(AstCBind.java:44)"                                         
 [3] "    water.rapids.ast.prims.mungers.AstCBind.apply(AstCBind.java:15)"                                         
 [4] "    water.rapids.ast.AstExec.exec(AstExec.java:63)"                                                          
 [5] "    water.rapids.ast.prims.assign.AstTmpAssign.apply(AstTmpAssign.java:48)"                                  
 [6] "    water.rapids.ast.prims.assign.AstTmpAssign.apply(AstTmpAssign.java:17)"                                  
 [7] "    water.rapids.ast.AstExec.exec(AstExec.java:63)"                                                          
 [8] "    water.rapids.Session.exec(Session.java:99)"                                                              
 [9] "    water.rapids.Rapids.exec(Rapids.java:94)"                                                                
[10] "    water.api.RapidsHandler.exec(RapidsHandler.java:34)"                                                     
[11] "    jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)"                                    
[12] "    java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[13] "    java.base/java.lang.reflect.Method.invoke(Method.java:566)"                                              
[14] "    water.api.Handler.handle(Handler.java:60)"                                                               
[15] "    water.api.RequestServer.serve(RequestServer.java:472)"                                                   
[16] "    water.api.RequestServer.doGeneric(RequestServer.java:303)"                                               
[17] "    water.api.RequestServer.doPost(RequestServer.java:227)"                                                  
[18] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:707)"                                            
[19] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:790)"                                            
[20] "    org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)"                                  
[21] "    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)"                              
[22] "    org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)"                       
[23] "    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)"                      
[24] "    org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)"                        
[25] "    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)"                               
[26] "    org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)"                        
[27] "    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)"                       
[28] "    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)"                           
[29] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)"                   
[30] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)"                         
[31] "    water.webserver.jetty9.Jetty9ServerAdapter$LoginHandler.handle(Jetty9ServerAdapter.java:130)"            
[32] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)"                   
[33] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)"                         
[34] "    org.eclipse.jetty.server.Server.handle(Server.java:516)"                                                 
[35] "    org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)"                              
[36] "    org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)"                                     
[37] "    org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)"                                       
[38] "    org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)"                             
[39] "    org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)"             
[40] "    org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)"                                       
[41] "    org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)"                                    
[42] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)"                  
[43] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)"                
[44] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)"               
[45] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)"                      
[46] "    org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)"
[47] "    org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)"                        
[48] "    org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)"                   
[49] "    java.base/java.lang.Thread.run(Thread.java:829)"                                                         
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 
  

ERROR MESSAGE:

cbind frames must have all the same rows, found 23 and 32 rows.
mean(p$predict == test$class)

ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://localhost:54321/99/Rapids)

java.lang.IllegalArgumentException
 [1] "java.lang.IllegalArgumentException: Frames must have same rows, found 23 rows and 32 rows."                  
 [2] "    water.rapids.ast.prims.operators.AstBinOp.frame_op_frame(AstBinOp.java:311)"                             
 [3] "    water.rapids.ast.prims.operators.AstBinOp.prim_apply(AstBinOp.java:100)"                                 
 [4] "    water.rapids.ast.prims.operators.AstBinOp.apply(AstBinOp.java:41)"                                       
 [5] "    water.rapids.ast.AstExec.exec(AstExec.java:63)"                                                          
 [6] "    water.rapids.ast.prims.reducers.AstMean.apply(AstMean.java:53)"                                          
 [7] "    water.rapids.ast.AstExec.exec(AstExec.java:63)"                                                          
 [8] "    water.rapids.ast.prims.mungers.AstGetrow.apply(AstGetrow.java:38)"                                       
 [9] "    water.rapids.ast.prims.mungers.AstGetrow.apply(AstGetrow.java:12)"                                       
[10] "    water.rapids.ast.AstExec.exec(AstExec.java:63)"                                                          
[11] "    water.rapids.Session.exec(Session.java:99)"                                                              
[12] "    water.rapids.Rapids.exec(Rapids.java:94)"                                                                
[13] "    water.api.RapidsHandler.exec(RapidsHandler.java:34)"                                                     
[14] "    jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)"                                    
[15] "    java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[16] "    java.base/java.lang.reflect.Method.invoke(Method.java:566)"                                              
[17] "    water.api.Handler.handle(Handler.java:60)"                                                               
[18] "    water.api.RequestServer.serve(RequestServer.java:472)"                                                   
[19] "    water.api.RequestServer.doGeneric(RequestServer.java:303)"                                               
[20] "    water.api.RequestServer.doPost(RequestServer.java:227)"                                                  
[21] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:707)"                                            
[22] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:790)"                                            
[23] "    org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)"                                  
[24] "    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)"                              
[25] "    org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)"                       
[26] "    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)"                      
[27] "    org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)"                        
[28] "    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)"                               
[29] "    org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)"                        
[30] "    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)"                       
[31] "    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)"                           
[32] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)"                   
[33] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)"                         
[34] "    water.webserver.jetty9.Jetty9ServerAdapter$LoginHandler.handle(Jetty9ServerAdapter.java:130)"            
[35] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)"                   
[36] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)"                         
[37] "    org.eclipse.jetty.server.Server.handle(Server.java:516)"                                                 
[38] "    org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)"                              
[39] "    org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)"                                     
[40] "    org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)"                                       
[41] "    org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)"                             
[42] "    org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)"             
[43] "    org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)"                                       
[44] "    org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)"                                    
[45] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)"                  
[46] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)"                
[47] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)"               
[48] "    org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)"                      
[49] "    org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)"
[50] "    org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)"                        
[51] "    org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)"                   
[52] "    java.base/java.lang.Thread.run(Thread.java:829)"                                                         
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 
  

ERROR MESSAGE:

Frames must have same rows, found 23 rows and 32 rows.

#for some reason I’m getting errors at the end.

LS0tCnRpdGxlOiAiQWN0aXZpdHkgNSIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKVGhpcyBpcyBhbiBbUiBNYXJrZG93bl0oaHR0cDovL3JtYXJrZG93bi5yc3R1ZGlvLmNvbSkgTm90ZWJvb2suIFdoZW4geW91IGV4ZWN1dGUgY29kZSB3aXRoaW4gdGhlIG5vdGVib29rLCB0aGUgcmVzdWx0cyBhcHBlYXIgYmVuZWF0aCB0aGUgY29kZS4gCgpUcnkgZXhlY3V0aW5nIHRoaXMgY2h1bmsgYnkgY2xpY2tpbmcgdGhlICpSdW4qIGJ1dHRvbiB3aXRoaW4gdGhlIGNodW5rIG9yIGJ5IHBsYWNpbmcgeW91ciBjdXJzb3IgaW5zaWRlIGl0IGFuZCBwcmVzc2luZyAqQ3RybCtTaGlmdCtFbnRlciouIAoKYGBge3J9Cmluc3RhbGwucGFja2FnZXMoJ2gybycpCmBgYApgYGB7cn0KbGlicmFyeShoMm8pCmBgYAoKYGBge3J9Cmgyby5pbml0KCkKYGBgCgpgYGB7cn0KbGlicmFyeShoMm8pCmgyby5pbml0KG50aHJlYWRzID0gLTEpCgpgYGAKYGBge3J9CmRhdGFzZXRzIDwtICJodHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vRGFycmVuQ29vay9oMm8vYmsvZGF0YXNldHMvIgpkYXRhIDwtIGgyby5pbXBvcnRGaWxlKHBhc3RlMChkYXRhc2V0cywgImlyaXNfd2hlYWRlci5jc3YiKSkgIAoKYGBgCmBgYHtyfQp5IDwtICJjbGFzcyIgIAp4IDwtIHNldGRpZmYobmFtZXMoZGF0YSksIHkpCnBhcnRzIDwtIGgyby5zcGxpdEZyYW1lKGRhdGEsIDAuOCkjSW4gUiwgaDJvLnNwbGl0RnJhbWUoKSB0YWtlcyBhbiBIMk8gZnJhbWUgYW5kIHJldHVybnMgYSBsaXN0IG9mIHRoZSBzcGxpdHMsIHdoaWNoIGFyZSBhc3NpZ25lZCB0byB0cmFpbiBhbmQgdGVzdCwgZm9yIHJlYWRhYmlsaXR5OiAgCnRyYWluIDwtIHBhcnRzW1sxXV0KdGVzdCA8LSBwYXJ0c1tbMl1dCgptIDwtIGgyby5kZWVwbGVhcm5pbmcoeCwgeSwgdHJhaW4pICAKCmBgYApgYGB7cn0KaDJvLm1zZShtKQpgYGAKCmBgYHtyfQpoMm8uY29uZnVzaW9uTWF0cml4KG0pCmBgYApgYGB7cn0KYXMuZGF0YS5mcmFtZShwKQpgYGAKYGBge3J9CmFzLmRhdGEuZnJhbWUoIGgyby5jYmluZChwJHByZWRpY3QsIHRlc3QkY2xhc3MpICkKYGBgCmBgYHtyfQptZWFuKHAkcHJlZGljdCA9PSB0ZXN0JGNsYXNzKQpgYGAKI2ZvciBzb21lIHJlYXNvbiBJJ20gZ2V0dGluZyBlcnJvcnMgYXQgdGhlIGVuZC4K