Просто попробуйте использовать приведенный ниже пример, он работает нормально для меня, ошибка может быть из-за h2o cluster version
, я включил мой, а также результаты для h2o.hit_ratio_table
import h2o
h2o.init(
nthreads=-1, ## -1: use all available threads
max_mem_size = "8G")
from h2o.estimators import H2ORandomForestEstimator
cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
# set the factor:
cars["cylinders"] = cars["cylinders"].asfactor()
# split the training and validation sets:
r = cars[0].runif()
train = cars[r > .2]
valid = cars[r <= .2]
# set the predictors columns, repsonse column, and distribution type:
predictors = ["displacement","power","weight","acceleration","year"]
response_col = "cylinders"
distribution = "multinomial"
# build and train the model:
drf = H2ORandomForestEstimator(nfolds = 3, distribution = distribution)
drf.train(x=predictors, y=response_col, training_frame=train, validation_frame=valid)
# build the hit ratio table:
drf_hit = drf.hit_ratio_table(valid=True)
drf_hit.show()
Вывод :
H2O cluster uptime: 02 secs
H2O cluster timezone: Etc/UTC
H2O data parsing timezone: UTC
H2O cluster version: 3.26.0.10
H2O cluster version age: 3 months and 12 days !!!
H2O cluster name: H2O_from_python_unknownUser_wggipn
H2O cluster total nodes: 1
H2O cluster free memory: 7.111 Gb
H2O cluster total cores: 4
H2O cluster allowed cores: 4
H2O cluster status: accepting new members, healthy
H2O connection url: http://127.0.0.1:54321
H2O connection proxy: {'http': None, 'https': None}
H2O internal security: False
H2O API Extensions: Amazon S3, XGBoost, Algos, AutoML, Core V3, TargetEncoder, Core V4
Python version: 3.6.6 final
k hit_ratio
0 1 0.988235
1 2 0.988235
2 3 1.000000
3 4 1.000000
4 5 1.000000