Third Party Model Rest API SymetryML allows you to build third party models. Currently only XGBoost models can be built. These models are different than SymetryML models in the following:
Third party models do not belong to a particular project. They belong to the user who creates them.
They are built using 2 data sources:
In Sample data source
Out of sample data source
Build a new third party model for a given user.
POST /symetry/rest/{cid}/tmodels/build [body=MLContext]
Parameter Required / Optional Description modelid Required ID to assign to the new model. algo Required Algorithm to use to build the model. Only xgb_model is supported for now. isdf Required In sample data source to be used to build the model. oosdf Required Out of sample data source to be used to build the model.
Many parameters can be passed to this methods depending on what type of XGBoost model one wants to build. See Sample Request for an example. Basically, XGBoost parameters are passed as extraParameters inside the MLContext data structure.
Parameter Required/Optional? Type Description missing_val Optional Float XGBoost missing value parameter.
HTTP Status Code HTTP Status Message Description 200 OK Success.
The following is an example on how to set XGBoost parameters with the MLContext structure when building a xgboost model:
Request:
POST url="http://charm:8080/symetry/rest/c1/tmodels/build/modelid=xgbM1&modelType=xgb_model&isds=inputDS&oosds=oosDS
Body:
{"targets":[],"inputAttributes":[],"inputAttributeNames":["sepal_length","sepal_width","petal_length"],"targetAttributeNames":["petal_width"],"extraParameters":{"eta":"0.5","eval_metric":"rmse","max_depth":"4","objective":"reg:linear"}}
POST /symetry/rest/{cid}/tmodels/{modelid}/predict [body=DataFrame]
HTTP Status Code HTTP Status Message Description 200 OK Success. 500 INTERNAL SERVER ERROR Invalid model ID. {"statusCode":"INTERNAL_SERVER_ERROR","statusString":"Generic Exception \u003cError no such model \u003cm3\u003e\u003e","values":{}}
HTTP Response Entity Example KSVSMap Contain information about the prediction.
Request:
POST url="http://charm:8080/symetry/rest/c1/tmodels/xgbmodel1/predict"
Body:
{"attributeNames":["petal_length","sepal_width"],"data":[["1.5","5"]],"attributeTypes":["C","C"]}
GET /symetry/rest/{cid}/tmodels/{modelid}/info
HTTP Status Code HTTP Status Message Description 200 OK Success.
For information about the ModelInfo JSON data structure see the section ModelInfo .
HTTP Response Entity Description ModelInfo Contains information about model.
Request:
GET url="http://charm:8080/symetry/rest/c1/tmodels/xgbmodel1/info"
Response:
{"statusCode":"OK","statusString":"OK","values":{"modelInfo":{"modelId":"xgb-model1","modelType":"xgb_model","modelBuilt":1,"buildTime":7026012,"attributeNames":["sepal_length","sepal_width","petal_length"],"targetNames":["petal_width"],"info":{},"creationDate":1605813840224,"useShortDesc":false}}}
Delete a particular model
DELETE /symetry/rest/{cid}/tmodels/{modelid}
HTTP Status Code HTTP Status Message Description 200 OK Success
List all third party models that belong to a user.
GET /symetry/rest/{cid}/tmodels
HTTP Status Code HTTP Status Message Description 200 OK Success.
GET url="http://charm:8080/symetry/rest/c1/tmodels"
Response:
{"statusCode":"OK","statusString":"OK","values":{"stringList":{"values":["xgbmodel1","xgbmodel2"]}}}