runPredict¶
PredictResource.
runPredict
(request, sub_analysis_id, **kwargs)¶Prior mandatory steps 1) Upload dataset 2) Create analysis 3) Create sub analysis 4) DataSharp 5)iLearn
This function performs the predictions. When a new data (eval data) is uploaded that has same number of attributes as dataset used for the analysis, this function performs the predictions on this new dataset and adds an additional column with predicted value for each record. There can be exceptions where a record may not have prediction because Record may have a new level that is not seen in training data. The returned data with predictions marks such records as could not predict.
User can pick any specific model for predictions using model number provided for each model out of iLearn function. This function is a background function that generated predictions and returns a prediction_id. Use getPredict function after this to obtain the actual prediction output.
Arguments
sub_analysis_id Give sub analysis id model_no Give model number from model list data_file Give path of eval dataset file Possible errors
Error message Invalid sub analysis id Please wait for a while. Evaluation dataset prediction is still running Please wait for a while. Predict is still running Please run ilearn first POST Request Example
curl -u username:password -X POST -F "model_no=1" -F "data_file=@/path/to/eval.csv" {url_prefix}/predictions/{sub_analysis_id}/Response Example
{ "error": false, "error_msg": "", "result": { "prediction_id": 463, "prediction_accuracy": 91.66, "prediction_data":[ { "TargetdataCleaned": "no", "age": 36.0, "balance": 2843.0, "campaign": 1.0, "contact": "cellular", "day": 12.0, "default": "no", "duration": 473.0, "education": "secondary", "housing": "no", "isCleaned": "Yes", "job": "blue_collar", "loan": "no", "marital": "divorced", "month": "feb", "pdays": 182.0, "poutcome": "success", "predictedClass": "yes", "previous": 1.0, "y": "no" }, .... ] } }Error Response Example
{ "error": true, "error_msg": "Please wait for a while. Evaluation dataset prediction is still running", "result": { "prediction_id": 463, } }