Before you begin, make sure you have the following installed on your machine:
- Docker: Install Docker
- Docker Compose: Install Docker Compose
-
Clone the repository:
git clone https://github.com/vkmguy/ml_training_hub.git cd ml_training_hub
-
Build and start the services:
docker-compose up --build
This command will build the Docker images and start the services.
-
Access your application:
- Django Admin: localhost:8001/admin (setup your username and password)
docker exec -it mlTrainingHub bash python manage.py createsuperuser
-
To stop the services, press
Ctrl + C
in the terminal wheredocker-compose
is running.
The Django web app allows you to interact with the Stock Market ML model.
- GET request to train the ML model: localhost:8001/api/trainModel
- GET request to get the last 10 ML model accuracies: localhost:8001/api/accuracies
- POST request to predict the direction of market: localhost:8001/api/predict
{ "open": 0.11, "low": 0.1, "high": 0.11, "volume": 202048089, "dividends": 0, "stock_splits": 0 }
{ "prediction": 0.0 }
- GET request to train the ML model: localhost:8001/api/trainModel
{ "message": "ML model training task has been triggered successfully." }
- GET request to fetch the ML model accuracy: localhost:8001/api/accuracies
[ { "metrics": { "recall": 0.8824884792626728, "accuracy": 0.4818880351262349, "precision": 0.4763681592039801 }, "timestamp": "2024-02-07T21:09:59.251336Z" }, { "metrics": { "recall": 0.7235023041474654, "accuracy": 0.49286498353457736, "precision": 0.47865853658536583 }, "timestamp": "2024-02-07T20:33:16.008314Z" } ]
- GET model visualization for its metrics: localhost:8001/visualization
The Celery worker processes asynchronous tasks, such as training the ML model. Check the Celery container for logs and task execution.
- start celery beat and worker so that the jobs can be scheduled, inside the docerk container
docker exec -it mlTrainingHub bash
celery -A ml_training_hub beat --detach
celery -A ml_training_hub worker --detach
- If you encounter issues, check the logs of individual containers for more details.
This project is licensed under the MIT License.