Welcome to the ML Playground project!
This platform provides an educational tool for understanding machine learning concepts through an interactive web interface, with a focus on code quality through comprehensive testing and a modular, extensible architecture.
- Docker
- Clone the repository to your local machine.
- Navigate to the project root directory.
To run the project, execute the following command in the project root directory:
docker compose up --buildOnce the project is running, you can access the web application at:
http://localhost:8050/regression
This project implements an interactive machine learning platform that allows users to experiment with various algorithms through a web interface. The architecture follows a microservice approach with separate components for the web interface, machine learning API, and asset processing. The platform is containerized using Docker for easy deployment and development.
The platform consists of three main components:
- Django Web Application (
app/) - The frontend interface that users interact with - FastAPI Machine Learning Service (
api/) - Backend service that implements ML algorithms - Deno CSS Processor (
deno/) - Tailwind CSS processing service
These components communicate with each other to provide a seamless experience for experimenting with machine learning algorithms, visualizing results, and exploring datasets.
The API service is built using FastAPI and implements machine learning algorithms that can be accessed through API endpoints and WebSockets.
-
algorithms/: Contains all ML algorithm implementationsbase/: Base classes and interfaces for algorithmsalgorithm.py: Abstract base class for all algorithmssupervised.py: Base class for supervised learning algorithmsunsupervised.py: Base class for unsupervised learning algorithms
supervised/: Implementations of supervised learning algorithmslinear_regression.py: Linear regression algorithm implementation
unsupervised/: Implementations of unsupervised learning algorithms
-
schemas/configs/: Parameter configurations for algorithmsalgorithms_configs.py: Dataclasses defining parameters for each algorithm
-
tests/: Comprehensive test suite for algorithmsconftest.py: Shared test fixtures (e.g., synthetic datasets)test_base/: Tests for base classestest_configs/: Tests for parameter configurationstest_supervised/: Tests for supervised learning algorithms
-
main.py: FastAPI application entry point, defines endpoints and WebSocket handlers
The web application provides the user interface for interacting with ML algorithms, uploading datasets, and visualizing results.
-
core/: Django project settings and configurationsettings.py: Main Django configurationurls.py: Root URL routing
-
endpoints/andplaygrounds/: Django apps for different parts of the platformviews.py: Request handlersurls.py: URL routing for each app
-
static/: Static assets including JavaScript, CSS, and imagesjs/src/plots/: Visualization code for different algorithmslinear_regression.js: Linear regression visualizationlinear_function.js: Linear function visualization
js/src/utils/: Utility functionsfile-handler.js: CSV file parsing and dataset handling
websocket.js: WebSocket client for real-time communication with API
-
templates/: HTML templatesbase.html: Base template with common layoutpartials/: Reusable UI componentsnavbar.html: Navigation barsidebar.html: Sidebar with algorithm controls
A Tailwind CSS processor that compiles CSS for the web application.
src/styles.css: Source CSS file with Tailwind directivesdeno.json: Deno configuration
docker-compose.yml: Defines and configures all servicesdatasets/: Sample datasets for experimentationdocs/: Documentation including test-driven development guides
- User accesses the Django web application
- User selects or uploads a dataset
- User configures an algorithm (e.g., Linear Regression)
- The web app establishes a WebSocket connection to the API service
- The API processes the data and runs the selected algorithm
- Real-time results are sent back via WebSocket
- Results are visualized in the browser using Plotly.js
The project follows a test-driven development approach for implementing ML algorithms:
- Write tests defining expected algorithm behavior
- Implement the algorithm to pass the tests
- Refactor while ensuring tests continue to pass
- Interactive ML Experimentation: Users can experiment with different algorithms and parameters
- Real-time Visualization: Results update in real-time during training
- Dataset Management: Upload custom datasets or use provided samples
- Extensible Architecture: New algorithms can be added by implementing the base interfaces
- Containerized Deployment: All components run in Docker containers for consistent deployment
- Frontend: Django, Tailwind CSS, Plotly.js
- Backend: FastAPI, NumPy for ML algorithms
- Infrastructure: Docker, WebSockets
- Development: Test-driven development (pytest)
This project is licensed under the MIT License.