Skip to content

Develop a single endpoint to predict the sales of a company

License

Notifications You must be signed in to change notification settings

jrpespinas/sales-prediction

Repository files navigation

Sales Prediction

Predict the sales given a set of inputs using only a single endpoint /predict

File Structure

FastAPI

  1. /domain: storage of the Schema
  2. /router: layer for handling requests
  3. /service: the name of the file is adapted from a clean architecture set up wherein the services are where the application and business logic is executed
  4. /tests: consists of both functional and load test

Model Store

  1. /model_store: it stores the latest model
  2. /archive: storage of previously used model to mimic the functionality of versioning models

Data Store

  1. /data_store: stores the training dataset, store details, and unscaled training dataset

Experiments

  1. /experiments: makeshift isolated directory for conducting local testing, normally it should be isolated altogether from the deployment to reduce access of the training notebook and environment
  2. /utils: stores the function for automatically saving the trained model in the Model Store
app
├── __init__.py
├── domain
│   ├── __init__.py
│   └── store.py
├── main.py
├── router
│   ├── __init__.py
│   ├── index.py
│   └── predict.py
├── service
│   ├── __init__.py
│   ├── model_loader.py
│   └── preprocessor.py
└── tests
    ├── __init__.py
    ├── functional_test
    │   ├── __init__.py
    │   ├── test_index.py
    │   └── test_predict.py
    └── load_test
        ├── __init__.py
        └── locustfile.py
        
data_store
├── store.csv
├── train.csv
└── x_train_unscaled.csv

model_store
├── archive
│   ├── sales_prediction_1.joblib
│   └── sales_prediction_2.joblib
└── sales_prediction_3.joblib

experiments
├── Experiment.ipynb
├── sales-prediction.joblib
└── utils
    └── services.py

Basic System Design

Usage

You may the application through heroku

  1. Inference endpoint: https://sales-prediction.herokuapp.com/predict
curl -d '{"Store":1111,"DayOfWeek":4,"Date":"2014-07-10","Customers":410,"Open":1,"Promo":0,"StateHoliday":"0","SchoolHoliday":1}' -H "Content-Type: application/json" -X POST https://sales-prediction.herokuapp.com/predict 
  1. API documentation endpoint: https://sales-prediction.herokuapp.com/docs

References

About

Develop a single endpoint to predict the sales of a company

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published