on 05-13-2019 9:55 AM
Hi,
scenario description:
in the Jupyter notebook I have implemented the model with python. The training data is stored on the HANA database and I used the Python API to create the model in the Jupyter notebook - this all worked fine.
Question:
Now that I have a good model I want to export it to HANA and use it there for productive use. How can I export it to HANA and automate the process for doing the predictions there? Is it good to do with AMDP classes or are there better approaches for productive use?
System environmend:
BR
Robert
Hello Robert,
A PAL model can be saved to a HANA table but the feature might be undocumented at the moment. So it might change, etc... Please use with caution. This code saves a model of type trees.DecisionTreeRegressor
model = tree_reg.model_.select('ROW_INDEX', 'MODEL_CONTENT')
model.save(("ML", "USEDCARPRICES_MODEL_REGTREE"))
It can then be loaded from the table with
import hana_ml as hana_ml
from hana_ml.algorithms.pal import trees
df_model_saved = hana_ml.dataframe.DataFrame(conn, 'select * from ML.USEDCARPRICES_MODEL_REGTREE')
tree_reg_saved = trees.DecisionTreeRegressor(conn, algorithm='cart')
tree_reg_saved.model_ = df_model_saved.select('ROW_INDEX', 'MODEL_CONTENT')
Models that use the Automated Predictive Library (APL4) already have save_model() and load_model() methods. https://help.sap.com/doc/0172e3957b5946da85d3fde85ee8f33d/latest/en-US/html/hana_ml.algorithms.apl.h...
To have PAL or APL models retrained and applied automatically I suggest looking at SAP Data Intelligence (SAP DI = Data Hub + ML in the cloud). You can deploy the Python syntax there as Python operator in a graph. I believe you could use that SAP Data Intelligence also to expose the trained model as REST API web service.
Many Greetings, Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.