Open
Description
I am working with h2o4gpu and trying to run the example provided on github.
import h2o4gpu
import sklearn
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn import linear_model
from sklearn.metrics import accuracy_score
import numpy as np
def test_not_labels():
data = load_breast_cancer()
X = data.data
y = data.target
# convert class values to [0,2]
# y = y * 2
# Splitting data into train and test
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.25, random_state=42)
# sklearn
clf_sklearn = linear_model.LogisticRegression()
clf_sklearn.fit(X_train, y_train)
y_pred_sklearn = clf_sklearn.predict(X_test)
# h2o
clf_h2o = h2o4gpu.LogisticRegression()
clf_h2o.fit(X_train, y_train)
y_pred_h2o = clf_h2o.predict(X_test)
assert np.allclose(accuracy_score(y_test, y_pred_sklearn), accuracy_score(y_test, y_pred_h2o.squeeze()))
But it's giving me this error :
AttributeError Traceback (most recent call last)
<ipython-input-5-57ba0443136b> in <module>
----> 1 test_not_labels()
<ipython-input-4-2f003f7e0081> in test_not_labels()
27 # h2o
28 clf_h2o = h2o4gpu.LogisticRegression()
---> 29 clf_h2o.fit(X_train, y_train)
30 y_pred_h2o = clf_h2o.predict(X_test)
31
~/h20/lib/python3.7/site-packages/h2o4gpu/solvers/logistic.py in fit(self, X, y, sample_weight)
273
274 def fit(self, X, y=None, sample_weight=None):
--> 275 res = self.model.fit(X, y, sample_weight)
276 self.set_attributes()
277 return res
~/h20/lib/python3.7/site-packages/h2o4gpu/solvers/elastic_net.py in fit(self, train_x, train_y, valid_x, valid_y, sample_weight, free_input_data)
301 valid_y=valid_y,
302 sample_weight=sample_weight,
--> 303 source_dev=source_dev)
304
305 else:
~/h20/lib/python3.7/site-packages/h2o4gpu/solvers/utils.py in prepare_and_upload_data(self, train_x, train_y, valid_x, valid_y, sample_weight, source_dev)
272 time_upload_data0 = time.time()
273 (a, b, c, d, e) = upload_data(self, train_x_np, train_y_np, valid_x_np,
--> 274 valid_y_np, weight_np, source_dev)
275
276 self.time_upload_data = time.time() - time_upload_data0
~/h20/lib/python3.7/site-packages/h2o4gpu/solvers/utils.py in upload_data(self, train_x, train_y, valid_x, valid_y, sample_weight, source_dev)
376
377 if self.double_precision == 1:
--> 378 c_upload_data = self.lib.make_ptr_double
379 elif self.double_precision == 0:
380 c_upload_data = self.lib.make_ptr_float
AttributeError: 'NoneType' object has no attribute 'make_ptr_double'
I have installed h20 and h2o4gpu in separate python env with python 3.7 with cuda 10.1
How I can resolve this?
Metadata
Metadata
Assignees
Labels
No labels