BookmarkSubscribeRSS Feed
anishkapoor
Calcite | Level 5

Hello All, 

 

I am trying to save my model build using SWAT python package into the sas model manager using the sasctl package, 

when I am saving the sklearn model it is saving into model manager without any issues but when I am trying to save the model which is build in CAS using the CAS Actions it is giving me a error message which is as follows.

 

NOTE: Added action set 'astore'.
ERROR: The table DECITION_TREE_ATTR_MODEL cannot be operated on through this interface.
ERROR: Action describe failed.
ERROR: The action stopped due to errors

 Code I am using,

model_sas_viya_dt = conn.CASTable("decition_tree_attr_model")

with Session('https://servername', username='*****', password='****'):
attr_dt = register_model(model_sas_viya_dt, 'Decision_Tree_SAS_VIYA', 'Comparison', force=True)

 

* decition_tree_attr_model this the model built using the CAS actions.

 

1 REPLY 1
jlwalker
SAS Employee

When working with SWAT, the register_model() task in sasctl requires that the input model is a CAS table that contains either Data Step code or an ASTORE.  This can be confusing, since many CAS actions also produce some sort of "model" table.

 

Judging from your model name (Decision_Tree_SAS_VIYA) I'd guess that you're using the dtreeTrain action.  If that's the case, that action doesn't output an ASTORE table, but it can output a table containing the Data Step score code using the  code= parameter.  You'll need to pass that table as the input to register_model().  Here's a quick example:

 

tbl = cas.upload('iris.csv').casTable

cas.decisiontree.dtreetrain(tbl,
                            target='Species',
                            inputs=['SepalLength', 'SepalWidth', 'PetalLength', 'PetalWidth'],
                            nominals=['Species'],
                            casout=dict(name='model', replace=True),
                            code=dict(casout=dict(name='code', replace=True)))

register_model(cas.CASTable('code'), 'Example Model', 'Example Project', force=True)

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Discussion stats
  • 1 reply
  • 485 views
  • 0 likes
  • 2 in conversation