Unable to convert data frame to h2o object

convert to h2o frame
h2oframe
convert h2o frame to dataframe r

I am running the h2o package in Rstudio Version 0.99.447. I run version 10.9.5 OSX.

I would like to set up a local cluster within R, following the steps of this tutorial: http://blenditbayes.blogspot.co.uk/2014/07/things-to-try-after-user-part-1-deep.html

The first step does not seem to be a problem. What does seem to be a problem is converting my data frame to a proper h2o object.

library(mlbench)
dat = BreastCancer[,-1] #reading in data set from mlbench package

library(h2o)
localH2O <- h2o.init(ip = "localhost", port = 54321, startH2O = TRUE) #sets up the cluster
dat_h2o <- as.h2o(localH2O, dat, key = 'dat') #this returns an error message

The above statement as.h2o results in the following error message

Error in as.h2o(localH2O, dat, key = "dat") : 
unused argument (key = "dat")

If I remove the "key" parameter, letting the data reside in the H2O key-value store under a machine generated name, the following error message comes up.

Error in .h2o.doSafeREST(conn = conn, h2oRestApiVersion = h2oRestApiVersion,  
Unexpected CURL error: Empty reply from server

This question asks the same thing as me, but the solution leads me to the same error.

Does anyone have experience with this problem? I'm not entirely sure how to approach this.

The syntax for importing a frame from R into H2O has changed since the last stable release of H2O-Classic and the latest stable release of H2O-3.0. I believe you used a H2O-3.0 release which means some of the arguments in the functions has since changed, the ambiguous "key" argument has been changed to "destination_frame".

H2O-3.0 will behave differently in that it will make note that the first 5 columns are ordered factors in the R data frame; and at the moment we don't have a way of preserving orders for categorical columns. However, to reproduce the same results as the one posted on http://blenditbayes.blogspot.co.uk/2014/07/things-to-try-after-user-part-1-deep.html you'll have to for now write the frame to disk as a CSV and import it into H2O.

library(mlbench)
dat = BreastCancer[,-1] #reading in data set from mlbench package

library(h2o)
localH2O <- h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)

#dat_h2o <- as.h2o(dat, destination_frame = 'dat') 
## Will return a "Provided column type c("ordered", "enum") is unknown." error

pathToData <- paste0(normalizePath("~/Downloads/"), "/dat.csv")
write.table(x = dat, file = pathToData, row.names = F, col.names = T)
dat_h2o <- h2o.importFile(path = pathToData, destination_frame = "dat")

For R data.frames that do not have ordered factor columns you can simply use h2o_frame <- as.h2o(object = df) where class(df) is a data.frame.

r - Unable to convert data frame to h2o object, The syntax for importing a frame from R into H2O has changed since the last stable release of H2O-Classic and the latest stable release of H2O-3.0. I believe​  Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

The BreastCancer data frame has 5 ord.factors and 5 factors. As Amy Wang wrote, you have to convert factors into numeric. If you don't want to write data to disc and then to read again the data you can convert them with sapply().

## Format data with no factor
data(BreastCancer, package = 'mlbench') # Load data from mlbench package
dat <- BreastCancer[, -1]  # Remove the ID column
dat[, c(1:ncol(dat))] <- sapply(dat[, c(1:ncol(dat))], as.numeric) # Convert factors into numeric



## Start a local cluster with default parameters
library(h2o)
localH2O <- h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)

## Convert Breast Cancer into H2O
dat.h2o <- as.h2o(dat, destination_frame = "midata")

h2o.frame, data store for H2O. H2OFrame is similar to pandas' ``DataFrame``, or R's ``data​.frame``. :param python_obj: object that will be converted to an ``H2OFrame``. This could have Without it, self._ex._cache.fill() # fails with an assertion that . While inspecting the h2o flow using web browser, I found the data.frame was correctly loaded into h2o.waterapp and I was able to parse it and train a DL model also. The only missing thing was the destination.frame had a system generated key and and I was unable to run the whole thing from R.

Try this. It worked for me.

## S3 method for class 'data.frame'
dat.hex <- as.h2o(dat, destination_frame = "dat.hex", ...)

H2O Module, Convert an H2O data object into a python-specific object. WARNING! This will pull Creates a data frame in H2O with real-valued, categorical, integer, and binary columns specified by the user. An attempt is made anyways if _connect fails. import_file - Unable to convert data frame to h2o object h2o import_file (5) I am running the h2o package in Rstudio Version 0.99.447.

I was also facing the same problem. In my case the problem JAVA_HOME env variable on Mac OSX mavericks pointing to old java version 6. My solution is on h2o google groups stream here

h2o.frame, [docs]class H2OFrame(object): """ Primary data store for H2O. H2OFrame is [​docs] def getrow(self): """ Convert a 1xn frame into an n-element list. :returns: content of _cache.fill() # fails with an assertion that ._id is None. Downloads the H2O data and then scans it in to an R data frame. as.data.frame.H2OFrame: Converts parsed H2O data into an R data frame in h2o: R Interface for the 'H2O' Scalable Machine Learning Platform

You should try:

dat_h2o <- as.h2o(dat)

Or:

dat <- as.data.frame(dat)
dat_h2o <- as.h2o(dat)

Hope this helps!

How to convert H2O Frame into data.table? · Issue #1184 , I have been trying to convert results from H2O predict method object just when you try to explore the content of the data frame is when you get the error. Anyway, were you able to see the content of dt.predictions in the last  Hi, I have been trying to convert results from H2O predict method object into data.table without luck. Below a screenshots with some errors that I got: As you can see, dt.pred <- data.table(predicted=dt.predictions[,1]) seems to work, bu

h2o-3/frame.py at master · h2oai/h2o-3 · GitHub, :param python_obj: object that will be converted to an ``H2OFrame``. This could have multiple types: A Pandas dataframe, or a Numpy ndarray: create a matching H2OFrame. - A Scipy sparse matrix: fails with an assertion that ._id is None. Remove the h2o Big Data object(s) having the key name(s) from ids. h2o.rm: Delete Objects In H2O in h2o: R Interface for the 'H2O' Scalable Machine Learning Platform rdrr.io Find an R package R language docs Run R in your browser R Notebooks

as.data.frame.H2OFrame: Converts parsed H2O data into an R data , An H2OFrame object. Further arguments to be passed down from other methods. Details. Method as. can not convert column type from object to str in python dataframe which has a set of numeric data types. Anything else is an object. You do not need to

H2O, Now, we convert our training and test sets into H2O Frames using rsparkling conversion We have already split the data into training and test frames using dplyr. are already computed and we just need to retreive them from the model object. Number of models: 36 ## Number of failed models: 0 ## ## Hyper-​Parameter  integer, number of part files to export to. Default is to write to a single file. Large data can be exported to multiple 'part' files, where each part file contains subset of the data. User can specify the maximum number of part files or use value -1 to indicate that H2O should itself determine the optimal number of files.

Comments
  • Is this stille the "current" solution?
  • testing on h2o v3.8, you don't need to specify destination_frame in h2o.importFile()
  • They need to fix this. I am on version 3.10.0.2 and as.h2o is still broken for ordered factors.