Buenas
Estoy usando H20 en local y tb en un ec2 de amazon, pero tengo que tener algo mal configurado seguro.
Para iniciarlo, hago lo siguiente:
conexion<-h2o.init()
Me arranca el cluster con el maximo de cores y memoria que se permite.
Una vez hech oesto, quiero calcular la distancia entre dos data.frames:
uno<-data.frame(matrix(rnorm(300000),ncol=10))
dos<-data.frame(matrix(rnorm(500),ncol=10))
uno<-as.h2o(uno)
dos<-as.h2o(dos)
matriz<-h2o.createFrame(rows=nrow(uno),cols=nrow(dos))
for(i in nrow(dos)){
matriz[,i]<-h2o.distance(uno,dos[i,])
}
Al hacerlo, y haciendo uso de htop veo que de lso 4 nucleos de mi pc o los 16 del ec2 de amazon, solo se usa uno, y es mas, en el ec2 esta tardando en ejecutarlo mas que en el pc.
Por ello creo que no esta paralelizando bien. ¿A alguien le ha ocurrido?
Si hago un h2o.clusterStatus() me aparece que esta todo OK
R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R es un software libre y viene sin GARANTIA ALGUNA.
Usted puede redistribuirlo bajo ciertas circunstancias.
Escriba 'license()' o 'licence()' para detalles de distribucion.
R es un proyecto colaborativo con muchos contribuyentes.
Escriba 'contributors()' para obtener más información y
'citation()' para saber cómo citar R o paquetes de R en publicaciones.
Escriba 'demo()' para demostraciones, 'help()' para el sistema on-line de ayuda,
o 'help.start()' para abrir el sistema de ayuda HTML con su navegador.
Escriba 'q()' para salir de R.
[Workspace loaded from ~/.RData]
library(h2o)
----------------------------------------------------------------------
Your next step is to start H2O:
> h2o.init()
For H2O package documentation, ask for help:
> ??h2o
After starting H2O, you can use the Web UI at http://localhost:54321
For more information visit http://docs.h2o.ai
----------------------------------------------------------------------
Attaching package: ‘h2o’
The following objects are masked from ‘package:stats’:
cor, sd, var
The following objects are masked from ‘package:base’:
||, &&, %*%, apply, as.factor, as.numeric, colnames, colnames<-, ifelse, %in%,
is.character, is.factor, is.numeric, log, log10, log1p, log2, round, signif, trunc
h2o.init()
H2O is not running yet, starting it now...
Note: In case of errors look at the following log files:
/tmp/RtmpbuV3iD/h2o_jesus_started_from_r.out
/tmp/RtmpbuV3iD/h2o_jesus_started_from_r.err
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
Starting H2O JVM and connecting: .. Connection successful!
R is connected to the H2O cluster:
H2O cluster uptime: 1 seconds 905 milliseconds
H2O cluster version: 3.10.5.3
H2O cluster version age: 1 month and 20 days
H2O cluster name: H2O_started_from_R_jesus_rqh095
H2O cluster total nodes: 1
H2O cluster total memory: 1.71 GB
H2O cluster total cores: 4
H2O cluster allowed cores: 4
H2O cluster healthy: TRUE
H2O Connection ip: localhost
H2O Connection port: 54321
H2O Connection proxy: NA
H2O Internal Security: FALSE
R Version: R version 3.4.1 (2017-06-30)
gc()
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 679385 36.3 1168576 62.5 940480 50.3
Vcells 1138497 8.7 1920143 14.7 1532430 11.7
+
+ matriz[,j]<-h2o.distance(uno2,dos2[i,])
+ }
Error in !allCol && is.na(col) : objeto 'j' no encontrado
print(Sys.time()-t)
Time difference of 0.006168127 secs
t=Sys.time()
for(i in 1:10){
+
+ matriz[,i]<-h2o.distance(uno2,dos2[i,])
+ }
print(Sys.time()-t)
Time difference of 30.33803 secs
10/30
[1] 0.3333333
30/10*nrow(dos)
[1] 16068
30/10*nrow(dos)
[1] 16068
30/10*nrow(dos)/3600
[1] 4.463333
library(data.table)
data.table 1.10.4
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
Release notes, videos and slides: http://r-datatable.com
Attaching package: ‘data.table’
The following objects are masked from ‘package:h2o’:
hour, month, week, year
t=Sys.time()
for(i in 1:10){
+ fwrite(h2o.distance(uno2,dos2[i,]),paste0("/home/jesus/master/datos/datos-balanceado/matriz-overlapping/k",i,".csv"))
+
+ }
Error: is.list(x) is not TRUE