h2o.remove()

1,256 views
Skip to first unread message

Aleksandr Modestov

unread,
Feb 2, 2016, 10:19:43 AM2/2/16
to H2O Open Source Scalable Machine Learning - h2ostream
As I see I can delete a dataframe by delete operation:

"h2o.h2o.remove(x)[source]

Remove object from H2O.

: H2OFrame or str
The object pointing to the object to be removed."

I have the dataframe and I try to delete it.
h2o.remove(data_h2o)
In the next string I try to read it and I see in the work area content of this dataframe (which I thought was deleted).
May be someone knows why it is so.
Thank you

lu...@0xdata.com

unread,
Feb 2, 2016, 11:22:57 AM2/2/16
to H2O Open Source Scalable Machine Learning - h2ostream
On Tuesday, February 2, 2016 at 7:19:43 AM UTC-8, Aleksandr Modestov wrote:
> As I see I can delete a dataframe by delete operation:
>
>
> "h2o.h2o.remove(x)[source]
> Remove object from H2O.x : H2OFrame or strThe object pointing to the object to be removed."
> I have the dataframe and I try to delete it.h2o.remove(data_h2o)
> In the next string I try to read it and I see in the work area content of this dataframe (which I thought was deleted).May be someone knows why it is so.Thank you

Hi,

The object has been removed from the backend, but appears to still be present because it is in the Python cache. The fix for this issue is in the nightly development build (Bleeding Edge) and will be in the next stable release. Trying to read an H2OFrame that has been removed will give the following output:

>>> h2o.remove(a)
>>> a
This H2OFrame has been removed.


Aleksandr Modestov

unread,
Feb 3, 2016, 3:36:35 AM2/3/16
to H2O Open Source Scalable Machine Learning - h2ostream
Thank you!
I use sparkling water 1.5.10.
I want to make a circle for that reason I should delete a dataframe fro creating the next one with the same name.
And last version of sparkling water has the same issue.
Can you recomend me anything?

вторник, 2 февраля 2016 г., 18:19:43 UTC+3 пользователь Aleksandr Modestov написал:

lu...@0xdata.com

unread,
Feb 3, 2016, 12:09:24 PM2/3/16
to H2O Open Source Scalable Machine Learning - h2ostream
On Wednesday, February 3, 2016 at 12:36:35 AM UTC-8, Aleksandr Modestov wrote:
> Thank you!
> I use sparkling water 1.5.10.
> I want to make a circle for that reason I should delete a dataframe fro creating the next one with the same name.
> And last version of sparkling water has the same issue.
> Can you recomend me anything?
>
> вторник, 2 февраля 2016 г., 18:19:43 UTC+3 пользователь Aleksandr Modestov написал:
> As I see I can delete a dataframe by delete operation:
>
>
> "h2o.h2o.remove(x)[source]
> Remove object from H2O.x : H2OFrame or strThe object pointing to the object to be removed."
> I have the dataframe and I try to delete it.h2o.remove(data_h2o)
> In the next string I try to read it and I see in the work area content of this dataframe (which I thought was deleted).May be someone knows why it is so.Thank you

If your dataframe is data_h2o, try:

h2o.remove(data_h2o)
del data_h2o

Aleksandr Modestov

unread,
Feb 4, 2016, 5:26:43 AM2/4/16
to H2O Open Source Scalable Machine Learning - h2ostream, lu...@0xdata.com
Thank you. It works.
But I want to use a variable with the same name in the circle.
After deleting I get message: "500 Server Error (method = GET; url = http://192.168.107.30:54321/3/Frames/data_h2o?row_count=10).
detailed error messages: Rollups not possible, because Vec was deleted: $04ff05000000ffffffffb39786c2718087b2014f877a0d850594$"
It's not very good to create a new variable in the circle every time ( I mean to use a new name)

среда, 3 февраля 2016 г., 20:09:24 UTC+3 пользователь lu...@0xdata.com написал:

lu...@0xdata.com

unread,
Feb 4, 2016, 11:58:13 AM2/4/16
to H2O Open Source Scalable Machine Learning - h2ostream, lu...@0xdata.com
To use the same variable name in a loop, assign to the name at the beginning of the loop, and call h2o.remove() at the end of the loop. For example,

>>> for i in range(5):
... h2o_data = h2o.H2OFrame([i])
... print(h2o_data) # do other calculations, etc
... h2o.remove(h2o_data)

Aleksandr Modestov

unread,
Feb 5, 2016, 4:16:50 AM2/5/16
to H2O Open Source Scalable Machine Learning - h2ostream, lu...@0xdata.com
Thank you!
But in my case your example doesn't work.

for item in list_of_services: #list_of_services - list of strings (services' names)
    #Выборка данных
    #Положительные примеры
    query_data="select some_columns "+item+" as label from data_full \   #item - the name of service, it changes every iteration
                                     where "+item+"=1"
    data=sqlContext.sql(query_data).persist()
    print data.head(1)
    data_h2o = hc.as_h2o_frame(data, "data_h2o")
    print data_h2o.head(1)
    h2o.remove(data_h2o)

After the first iteration data changes evry iteration (it's spark data frame) but data_h2o after the first iteration doesn't change.
I use sparkling water 1.5.10.


четверг, 4 февраля 2016 г., 19:58:13 UTC+3 пользователь lu...@0xdata.com написал:

Aleksandr Modestov

unread,
Feb 5, 2016, 6:54:02 AM2/5/16
to H2O Open Source Scalable Machine Learning - h2ostream, lu...@0xdata.com
and the result of the circle:


for item in list_of_services: #list_of_services - list of strings (services' names)
    #Выборка данных
    #Положительные примеры
    query_data="select some_columns "+item+" as label from data_full \   #item - the name of service, it changes every iteration
                                     where "+item+"=1"
    data=sqlContext.sql(query_data).persist()
    print data.head(1)
    data_h2o = hc.as_h2o_frame(data, "data_h2o")
    print data_h2o.head(1)
    h2o.remove(data_h2o)

is:

[Row(fisrt=1, second=1, third=2, fouth=50, fifth=0, sixth=0, label=1)]
  fisrt    second    third    fouth    fifth    sixth    label
-------  --------  -------  -------  -------  -------  -------
      1         1        2       50        0        0        1

[1 rows x 7 columns]
[Row(fisrt=3, second=1, third=7, fouth=52, fifth=0, sixth=3, label=1)]
  fisrt    second    third    fouth    fifth    sixth    label
-------  --------  -------  -------  -------  -------  -------
      1         1        2       50        0        0        1

[1 rows x 7 columns]
[Row(fisrt=3, second=1, third=5, fouth=0, fifth=2, sixth=3, label=1)]
  fisrt    second    third    fouth    fifth    sixth    label
-------  --------  -------  -------  -------  -------  -------
      1         1        2       50        0        0        1

[1 rows x 7 columns]
[Row(fisrt=1, second=1, third=3, fouth=26, fifth=1, sixth=1, label=1)]
  fisrt    second    third    fouth    fifth    sixth    label
-------  --------  -------  -------  -------  -------  -------
      1         1        2       50        0        0        1

четверг, 4 февраля 2016 г., 19:58:13 UTC+3 пользователь lu...@0xdata.com написал:

Aleksandr Modestov

unread,
Feb 15, 2016, 8:24:43 AM2/15/16
to H2O Open Source Scalable Machine Learning - h2ostream
Does anybody know the answer?


вторник, 2 февраля 2016 г., 18:19:43 UTC+3 пользователь Aleksandr Modestov написал:
As I see I can delete a dataframe by delete operation:

Spencer Aiello

unread,
Feb 15, 2016, 3:50:33 PM2/15/16
to Aleksandr Modestov, H2O Open Source Scalable Machine Learning - h2ostream
Hi Aleksandr -- by "circle" I'm thinking you intend to say "loop" (for each iteration of the for loop/circle) right?



Here's a simple example that appears to work with the latest stable release ( http://h2o-release.s3.amazonaws.com/h2o/rel-tukey/3/index.)


>>> data = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
>>> for d in data:
...     df = h2o.H2OFrame(d)
...     print df
...
Parse Progress: [##################################################] 100%
  C1    C2    C3
----  ----  ----
   1     2     3
[1 row x 3 columns]

Parse Progress: [##################################################] 100%
  C1    C2    C3
----  ----  ----
   4     5     6
[1 row x 3 columns]

Parse Progress: [##################################################] 100%
  C1    C2    C3
----  ----  ----
   7     8     9
[1 row x 3 columns]

Parse Progress: [##################################################] 100%
  C1    C2    C3
----  ----  ----
  10    11    12
[1 row x 3 columns]














Reply all
Reply to author
Forward
0 new messages