/moonraker

A sample project for an ML engineering interview.

Primary LanguageJupyter Notebook

Community Questions

Introduction

This is a demo ML classifier that runs in a Docker container and exposes an API enpoint for predictions.

API in Docker

Getting Started

  1. Clone the repository.
git clone https://github.com/bjornorri/moonraker.git
  1. Navigate to the project directory.
cd moonraker
  1. Build the docker container image.
docker build -t moonraker .
  1. Start the docker container .
docker run moonraker
  1. Locate the Docker container's IP address.
docker ps # Get container id
docker inspect CONTAINER_ID # Get IP address
  1. Access the prediction API at http://IP_ADDRESS/predict?VisitsLastYear=123&QuestionTextLength=456. Example:
curl "http://172.17.0.3/predict?VisitsLastYear=123&QuestionTextLength=456"

Request and response format

Provide the following parameters as query parameters. These are used as input features for the model.

Name Type
VisitsLastYear integer
QuestionTextLength integer

Example response:

{ "prediction": false }

Jupyter Notebook

To see how the model was created, view the provided Jupyter notebook.

Getting Started

  1. Clone the repository.
git clone https://github.com/bjornorri/moonraker.git
  1. Navigate to the project directory.
cd moonraker
  1. (Optional) Create and activate a virtual environment.
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies.
pip install -r requirements.txt
  1. Run the Jupyter server. This should launch your browser.
jupyter notebook
  1. Open community_questions.ipynb.

Advanced model

If I create a more advanced model (optional task), I will do it on another branch in this repository.