H2O MOJO wrapper - allows predictions from python without the webserver overhead.
Project description
pyH2oMojo
Unofficial Python wrapper for H2o MOJO's
A lightweight python wrapper around an H2o EasyPredictModelWrapper instance
Instantiating the object will launch the bundled Jar file, and establish a port on localhost on which to communicate with.
Dictionaries or JSON strings are passed to the predictor instance over a socket, and the output is read back via the subprocess' stdout pipe.
Usage
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyH2oMojo-0.1.1.tar.gz.
File metadata
- Download URL: pyH2oMojo-0.1.1.tar.gz
- Upload date:
- Size: 12.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76de061740b7669e4c8566a8684c0ff53d8c3db44af357d72cf7ce1ccb71bed7
|
|
| MD5 |
2b8cc2dba44b642f50cf6704657bc719
|
|
| BLAKE2b-256 |
ac27c273ceba08ccbe02005cb0d0a6ad95146f46fb654eac969509ef7bc95283
|
File details
Details for the file pyH2oMojo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyH2oMojo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9374bb3a5dcfdebbe1362daf22bfaba472f61075d8e73cad116f0f1b572b527e
|
|
| MD5 |
d36fac1287902574e42d6c1737fd6c08
|
|
| BLAKE2b-256 |
d33894f937c21049d7cc58e7af2db7204981061b1888f10a36a6e223c28e5573
|