Spaces:
Sleeping
Sleeping
File size: 14,798 Bytes
9fb2e52 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | ---
title: Algoline
emoji: "\U0001F537"
colorFrom: indigo
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---
<p align="center">
<img src="./assets/banner.png" alt="Algoline" width="100%" />
</p>
<p align="center">
<a href="https://huggingface.co/spaces/Al1Abdullah/AutoML">
<img src="https://readme-typing-svg.demolab.com?font=Inter&weight=500&size=20&duration=3000&pause=1000&color=A78BFA¢er=true&vCenter=true&width=520&height=36&lines=From+Raw+Data+to+Deployed+Model+in+Minutes;Train+%C2%B7+Compare+%C2%B7+Tune+%C2%B7+Export;No+Notebooks.+No+Boilerplate.+Just+Results." alt="Slogan" />
</a>
</p>
<p align="center">
<a href="https://python.org"><img src="https://img.shields.io/badge/Python-3.10-4f46e5?style=flat-square&logo=python&logoColor=white" alt="Python" /></a>
<a href="https://fastapi.tiangolo.com"><img src="https://img.shields.io/badge/FastAPI-0.100+-6366f1?style=flat-square&logo=fastapi&logoColor=white" alt="FastAPI" /></a>
<a href="https://pycaret.org"><img src="https://img.shields.io/badge/PyCaret-3.3-818cf8?style=flat-square" alt="PyCaret" /></a>
<a href="https://optuna.org"><img src="https://img.shields.io/badge/Optuna-3.5+-a78bfa?style=flat-square" alt="Optuna" /></a>
<a href="https://docker.com"><img src="https://img.shields.io/badge/Docker-Ready-c4b5fd?style=flat-square&logo=docker&logoColor=white" alt="Docker" /></a>
<a href="https://github.com/Al1Abdullah/Algoline/actions"><img src="https://img.shields.io/github/actions/workflow/status/Al1Abdullah/Algoline/ci.yml?branch=main&style=flat-square&label=CI" alt="CI" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-4f46e5?style=flat-square" alt="License" /></a>
</p>
<br>
## Table of Contents
| Section | Description |
|:--|:--|
| [Overview](#overview) | What Algoline does and how it works |
| [Getting Started](#getting-started) | Local setup and Docker instructions |
| [Platform Walkthrough](#platform-walkthrough) | Data ingestion, exploration, training, tuning, export |
| [Supported Algorithms](#supported-algorithms) | Classification and regression models |
| [Architecture](#architecture) | System design, tech stack, project structure |
| [Continuous Integration](#continuous-integration) | CI/CD pipeline details |
| [API Reference](#api-reference) | All 31 endpoints documented |
| [Contributing](#contributing) | How to report issues and contribute |
<br>
## Overview
Algoline is a web-based machine learning platform that takes a raw dataset and turns it into a deployable model pipeline, entirely in the browser. There is no notebook to configure, no boilerplate to write, and no environment to set up. You upload a file, explore the data through interactive visualizations, train and compare models with a single click, optionally tune with Bayesian optimization, and download a production-ready `.pkl` file.
Under the hood, a FastAPI server handles all computation. PyCaret orchestrates model comparison across scikit-learn, XGBoost, LightGBM, and CatBoost. Optuna drives hyperparameter search. Plotly renders every chart. The frontend is vanilla HTML, CSS, and JavaScript with zero build dependencies. The whole thing ships as a Docker container.
<br>
## Getting Started
### Local Setup
```bash
git clone https://github.com/Al1Abdullah/Algoline.git
cd Algoline
pip install -r requirements.txt
python main.py
```
The server starts at `http://localhost:7860`.
### Docker
```bash
docker build -t algoline .
docker run -p 7860:7860 algoline
```
<br>
## Platform Walkthrough
### Data Ingestion and Profiling
Drop a CSV, TSV, or Excel file into the upload zone. Algoline parses it on the spot and returns four headline metrics (rows, columns, missing values, duplicates), a full statistical breakdown, inferred column types, and automated quality insights. These insights flag class imbalance, high-cardinality categoricals, constant columns, correlated features, and missing value patterns before you even ask. Select a target column and the system infers whether you are working on classification or regression.
### Exploratory Analysis
Eighteen interactive chart types are available, organized into five analytical categories. Every chart is rendered with Plotly, so you can zoom, pan, hover for values, and export.
| Category | Visualizations |
|:--|:--|
| **Distribution** | Histogram, KDE, Box plot, Violin |
| **Missing Data** | Missing value bar chart, Missing value heatmap |
| **Correlation** | Correlation heatmap, Pair plot, Scatter, Joint plot |
| **Target Analysis** | Count plot, Pie chart, Class distribution, Target histogram, Mean target per category |
| **Advanced** | Scatter vs index, Grouped box plot, Faceted small multiples |
### Model Training and Comparison
Eight preprocessing toggles can be configured independently before training:
| Option | Default | Purpose |
|:--|:--|:--|
| Drop Duplicates | On | Remove exact row copies |
| Remove Outliers | Off | Filter statistical outliers |
| Normalize | On | Scale numeric features |
| Drop Multicollinear | On | Remove highly correlated pairs |
| Transform Skew | Off | Power transforms on skewed distributions |
| Feature Selection | Off | Automatic dimensionality reduction |
| Polynomial Features | Off | Generate interaction terms |
| Fix Class Imbalance | Off | Balance underrepresented classes |
Set the test split ratio and cross-validation fold count, then train. PyCaret runs every relevant algorithm, scores each with cross-validation, and returns a ranked leaderboard. Evaluation diagnostics (confusion matrices, ROC curves, precision-recall curves, residual plots, feature importance) are generated automatically from real model predictions.
### Hyperparameter Tuning
Three tuning strategies are available after initial training:
| Strategy | Engine | Best For |
|:--|:--|:--|
| **Bayesian** | Optuna TPE | Smart, sample-efficient search |
| **Random Search** | scikit-learn | Broad exploration |
| **Grid Search** | scikit-learn | Exhaustive evaluation |
If the tuned model does not outperform the original, Algoline preserves the original automatically.
### Export
| Artifact | Format | Description |
|:--|:--|:--|
| **Pipeline** | `.pkl` | Serialized model ready for `predict()` in any Python environment |
| **Leaderboard** | `.csv` | Full model comparison with cross-validated metrics |
| **Predictions** | `.csv` | Model output on the holdout test set |
Load the pipeline with `joblib` or PyCaret's `load_model()`, pass new data, and get predictions. No retraining required.
<br>
## Supported Algorithms
<table>
<tr>
<td width="50%" valign="top">
**Classification**
Logistic Regression, K-Nearest Neighbors, Naive Bayes, Decision Tree, Random Forest, Extra Trees, Gradient Boosting, AdaBoost, XGBoost, LightGBM, CatBoost, SVM (Linear and RBF), Ridge Classifier, LDA, QDA
</td>
<td width="50%" valign="top">
**Regression**
Linear Regression, Lasso, Ridge, Elastic Net, Decision Tree, Random Forest, Extra Trees, Gradient Boosting, AdaBoost, XGBoost, LightGBM, CatBoost, SVR, KNN Regressor, Huber Regressor, Passive Aggressive Regressor
</td>
</tr>
</table>
<br>
## Architecture
### System Design
```mermaid
flowchart TD
subgraph Browser["Browser"]
UI["index.html + style.css + app.js"]
end
subgraph Server["FastAPI Server"]
direction TB
subgraph Routes["Route Modules"]
D["data.py\nUpload and Profiling"]
E["explore.py\n18 Chart Endpoints"]
B["build.py\nTrain, Compare, Tune"]
X["export.py\nDownload Artifacts"]
end
subgraph Core["Core"]
H["helpers.py"]
S["state.py"]
end
end
subgraph ML["ML Engine"]
PC["PyCaret 3.3"]
SK["scikit-learn"]
XG["XGBoost"]
LG["LightGBM"]
CB["CatBoost"]
OP["Optuna"]
PL["Plotly"]
end
UI -->|"fetch()"| Routes
Routes --> Core
B --> PC
PC --> SK & XG & LG & CB
B --> OP
E --> PL
B --> PL
style Browser fill:#1e1b4b,stroke:#6366f1,color:#e4e4e7
style Server fill:#0f0d1a,stroke:#4f46e5,color:#e4e4e7
style Routes fill:#1a1730,stroke:#818cf8,color:#c4b5fd
style Core fill:#1a1730,stroke:#818cf8,color:#c4b5fd
style ML fill:#0c0a14,stroke:#a78bfa,color:#e4e4e7
style UI fill:#2d2a5e,stroke:#818cf8,color:#fff
style D fill:#312e81,stroke:#6366f1,color:#e0e7ff
style E fill:#312e81,stroke:#6366f1,color:#e0e7ff
style B fill:#312e81,stroke:#6366f1,color:#e0e7ff
style X fill:#312e81,stroke:#6366f1,color:#e0e7ff
style H fill:#1e1b4b,stroke:#a78bfa,color:#c4b5fd
style S fill:#1e1b4b,stroke:#a78bfa,color:#c4b5fd
style PC fill:#312e81,stroke:#818cf8,color:#e0e7ff
style SK fill:#1e1b4b,stroke:#6366f1,color:#c4b5fd
style XG fill:#1e1b4b,stroke:#6366f1,color:#c4b5fd
style LG fill:#1e1b4b,stroke:#6366f1,color:#c4b5fd
style CB fill:#1e1b4b,stroke:#6366f1,color:#c4b5fd
style OP fill:#1e1b4b,stroke:#a78bfa,color:#c4b5fd
style PL fill:#1e1b4b,stroke:#a78bfa,color:#c4b5fd
```
### Tech Stack
| Layer | Technology |
|:--|:--|
| **Server** | FastAPI with Uvicorn |
| **Runtime** | Python 3.10 |
| **ML Engine** | PyCaret 3.3 (wraps scikit-learn, XGBoost, LightGBM, CatBoost) |
| **Optimization** | Optuna 3.5+ with Tree-structured Parzen Estimator |
| **Visualization** | Plotly 5.24 |
| **Frontend** | Vanilla HTML, CSS, JavaScript |
| **CI/CD** | GitHub Actions |
| **Containerization** | Docker |
| **Hosting** | Hugging Face Spaces |
### Project Structure
```
algoline/
βββ .github/
β βββ workflows/
β βββ ci.yml CI pipeline (lint, validate, build, smoke test)
βββ app/
β βββ __init__.py
β βββ state.py Shared session state and Plotly configuration
β βββ helpers.py Utility functions (serialization, inference, formatting)
β βββ routes/
β βββ __init__.py
β βββ data.py Upload, profiling, target selection
β βββ explore.py 18 interactive visualization endpoints
β βββ build.py Model training, comparison, hyperparameter tuning
β βββ export.py Pipeline, leaderboard, and prediction downloads
βββ static/
β βββ index.html Single-page application structure
β βββ css/
β β βββ style.css Design system (dark/light themes, glassmorphism)
β βββ js/
β βββ app.js Frontend logic (navigation, API calls, chart rendering)
βββ main.py Application entrypoint
βββ requirements.txt Python dependencies
βββ Dockerfile Production container
βββ LICENSE MIT
```
### Design
The interface ships with a dual-theme system. Dark mode uses glassmorphism with translucent card surfaces, ambient indigo gradients, and subtle glow effects. Light mode uses an indigo-tinted palette with layered shadows and clean gridlines. Typography is set in Inter, and every Plotly chart re-renders to match the active theme. A toggle in the top-right corner switches between the two instantly.
<br>
## Continuous Integration
The CI pipeline ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs on every push and pull request to `main`.
**Stage 1: Lint and Validate** installs dependencies, confirms the server module imports cleanly, and verifies that all expected API routes are registered on the FastAPI application.
**Stage 2: Docker Build** builds the production image, starts the container, waits for the server to respond, and runs a smoke test against the root endpoint. If anything fails, container logs are captured for debugging.
<br>
## API Reference
<details>
<summary><strong>Data Endpoints</strong></summary>
<br>
| Method | Route | Description |
|:--|:--|:--|
| `POST` | `/api/upload` | Upload dataset (CSV, TSV, XLSX) with automatic profiling |
| `POST` | `/api/target` | Set target column and auto-detect task type |
</details>
<details>
<summary><strong>Exploration Endpoints (18 chart types)</strong></summary>
<br>
| Method | Route | Description |
|:--|:--|:--|
| `POST` | `/api/explore/distribution` | Histogram with marginal box plot |
| `POST` | `/api/explore/kde` | Kernel density estimation |
| `POST` | `/api/explore/boxplot` | Box plot (grouped by target if classification) |
| `POST` | `/api/explore/violin` | Violin plot |
| `POST` | `/api/explore/missing` | Missing value bar chart |
| `POST` | `/api/explore/missing_heatmap` | Missing value heatmap |
| `POST` | `/api/explore/correlation` | Annotated correlation heatmap |
| `POST` | `/api/explore/pairplot` | Pair plot of top correlated features |
| `POST` | `/api/explore/scatter_xy` | Two-feature scatter plot |
| `POST` | `/api/explore/jointplot` | Joint distribution with marginal histograms |
| `POST` | `/api/explore/countplot` | Count plot for categorical features |
| `POST` | `/api/explore/pie` | Pie chart of target distribution |
| `POST` | `/api/explore/target` | Target variable distribution |
| `POST` | `/api/explore/counts` | Class distribution |
| `POST` | `/api/explore/mean_target` | Mean target per category or bin |
| `POST` | `/api/explore/scatter_index` | Feature values vs row index |
| `POST` | `/api/explore/grouped_box` | Grouped box plot by target class |
| `POST` | `/api/explore/facetgrid` | Faceted small multiples |
| `POST` | `/api/explore/quality` | Feature quality statistics table |
</details>
<details>
<summary><strong>Training and Tuning Endpoints</strong></summary>
<br>
| Method | Route | Description |
|:--|:--|:--|
| `POST` | `/api/train` | Compare all models, return leaderboard and evaluation plots |
| `POST` | `/api/compare` | Re-render metric comparison chart |
| `POST` | `/api/tune` | Hyperparameter optimization (Bayesian, random, or grid) |
</details>
<details>
<summary><strong>Export Endpoints</strong></summary>
<br>
| Method | Route | Description |
|:--|:--|:--|
| `GET` | `/api/export/pipeline` | Download finalized model (.pkl) |
| `GET` | `/api/export/leaderboard` | Download model comparison (.csv) |
| `GET` | `/api/export/predictions` | Download holdout predictions (.csv) |
| `GET` | `/api/summary` | Pipeline metadata |
</details>
<br>
## Contributing
Contributions are welcome. If you find a bug or want to suggest a feature, please [open an issue](https://github.com/Al1Abdullah/Algoline/issues). For code contributions, fork the repository, create a feature branch, and submit a pull request.
## License
Open source under the [MIT License](LICENSE).
|