Repository for simple REST API using fastAPI, exposing probability of default (PD) model. This model is deployed as a web service on AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/).
A RandomForest
classifier has been trained on the data found in data folder.
No feature pruning has been done in this stage instead all features have been used where the following transforms have been made:
Ordinal
encoding of categorical features- Standard scaling of numerical features
BinaryLabel
encoding of bool features.
See more under features.
The model has been evaluated using 5-fold
cross-validation and the following metrics:
- AUC
- prAUC
- F1-score, precision & recall
To start API locally run the cmd found in the Makefile
:
make build # build image
make up # run container
make run # run container in interactive mode
make down # stop containter
make destroy # destroy all containers
make train # run training script
make logs # make logs
make help # get help for each cmd
API is exposed as a web service at this address: http://probdefaultapi-env.eba-b4r3fruv.eu-west-1.elasticbeanstalk.com/. API Swagger and Documentation can be found at this address: http://probdefaultapi-env.eba-b4r3fruv.eu-west-1.elasticbeanstalk.com/docs
This API has the following routes:
/
is aGET
route for getting model information, see the example output below
{
"version": "df126280-f563-4fbc-a820-42cff04c874f",
"timestamp": "20221114163452"
}
-
/v1/predict
aPOST
route for predicting on one user -
/v1/predict/multiple
aPOST
route for predicting one list of users