H2O mojo包装器-允许来自Python的预测,而不需要Web服务器开销。

pyH2oMojo的Python项目详细描述


PyH2Omojo

H2O Mojo的非官方Python包装器

围绕一个H2O EasyPredictModelWrapper实例的轻量级Python包装器

实例化对象将启动绑定的jar文件,并在本地主机上建立一个与之通信的端口。

字典或json字符串通过套接字传递给predictor实例,输出通过子进程的stdout管道读回。

用法

from pyH2oMojo import H2oMojoPredictor
# pass at minimum, the filename of the MOJO, and the predictor type
predictor = H2oMojoPredictor("my_nn.zip", "multivariate", verbose=True)

print(H2oMojoPredictor.predict({"sepal_length":4.9, "sepal_width":3.0, "petal_length":1.4,"petal_width":0.2}))
>>> {"prediction":"Iris-setosa", "predictionIndex":1, "classProbabilities":[0.0, 0.944, 0.056]}

print(H2oMojoPredictor.supported_predictors())
>>> ["multivariate", "regression", "ordinal", "binomial", "autoencoder", "clustering", "dimreduction"]

# other constructor parameters include:
# x_cols=None # List of columns to be passed to predict() - by default everything is passed
# x_types=None # Dictionary of column name and types ('int', 'real', 'str') - these values will be converted before being sent to the model. 
# connection_timeout=10.0 # Number of seconds to wait for the Java subprocess to start before raising a runtime error
# prediction_timeout=3.0 # Number of seconds to wait for a response from the Java subprocess before raising a runtime error

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java数据不显示在FXML表中   java如何使整个JTable不可编辑   Java中的swing JTree JTable组合   Windows下的java诊断NIO DatagramChannel读取问题   java Dockerfile运行可执行文件   java手动初始化字节数组以测试更改   java Selenium Webdriver | DragAndDrop功能|也不例外,但代码不起作用   java Hibernate使用多对多关系和左连接多次加载同一实体?   java正在努力开发带有接口和泛型集的API   mongodb mongo java条件和如果不为null   Java程序不显示使用arduino ethernet shield在网页上发送的数据   java将JSONObject转换为JSONArray错误   java Box布局可以接受包含元素的大小吗?