PIMA Diabetes demo model using R
The dataset required to train or evaluate this model is the PIMA Indians Diabetes dataset available here. This dataset is available in Teradata Vantage and already configured in the demo environment.
Training
{
"table": "<training dataset>"
}
Evaluation
{
"table": "<test dataset>"
}
Batch Scoring
{
"table": "<score dataset>",
"predictions": "<ouput predictions dataset>"
}
The training.R produces the following artifacts
- model.rds (gbm parameters)
Evaluation is also performed in scoring.R by the function evaluate
and it returns the following metrics
accuracy: <acc>
The scoring.R loads the model and metadata and accepts the dataframe for prediction.
In this example, the values to score are in the table 'PIMA_TEST' at Teradata Vantage. The results are saved in the table 'PIMA_PREDICTIONS'. When batch deploying, this custom values should be specified:
key | value |
---|---|
table | PIMA_TEST |
predictions | PIMA_PREDICTIONS |
curl -X POST http://localhost:5000/predict \
-H "Content-Type: application/json" \
-d '{
"data": {
"ndarray": [[
6,
148,
72,
35,
0,
33.6,
0.627,
50
]],
"names":[
"NumTimesPrg",
"PlGlcConc",
"BloodP",
"SkinThick",
"TwoHourSerIns",
"BMI",
"DiPedFunc",
"Age"
]
}
}'