|
Download README.md from mnoorchenar/loss-function-playground: direct link, hf CLI and curl.
- Browser
- Download file 7.41 kB
-
https://huggingface.co/spaces/mnoorchenar/loss-function-playground/resolve/main/README.md
- Command line
-
hf download hf://spaces/mnoorchenar/loss-function-playground/README.md
-
curl -L -o README.md https://huggingface.co/spaces/mnoorchenar/loss-function-playground/resolve/main/README.md
7.41 kB
| title: ML Loss Function Playground | |
| emoji: π§ | |
| colorFrom: purple | |
| colorTo: blue | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| <div align="center"> | |
| <h1>π§ ML Loss Function Playground</h1> | |
| <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=22&duration=3000&pause=1000&color=7c3aed¢er=true&vCenter=true&width=700&lines=Compare+Loss+Functions+Side+by+Side;Regression+Β·+Binary+Β·+Multi-Class;Train+Live+with+PyTorch" alt="Typing SVG"/> | |
| <br/> | |
| [](https://www.python.org/) | |
| [](https://flask.palletsprojects.com/) | |
| [](https://pytorch.org/) | |
| [](https://plotly.com/python/) | |
| [](https://www.docker.com/) | |
| [](#) | |
| <br/> | |
| [](https://huggingface.co/spaces/mnoorchenar/loss-function-playground) | |
| [](https://github.com/mnoorchenar/loss-function-playground) | |
| <br/> | |
| **π§ ML Loss Function Playground** β An interactive web application for exploring and comparing loss functions in regression and classification tasks using **PyTorch**. | |
| <br/> | |
| --- | |
| </div> | |
| ## Table of Contents | |
| - [Features](#-features) | |
| - [Technical Overview](#-technical-overview) | |
| - [Getting Started](#-getting-started) | |
| - [Docker Deployment](#-docker-deployment) | |
| - [How It Works](#οΈ-how-it-works) | |
| - [Project Structure](#-project-structure) | |
| - [Author](#-author) | |
| - [Disclaimer](#οΈ-disclaimer) | |
| - [License](#-license) | |
| --- | |
| ## β¨ Features | |
| - Compare multiple loss functions side by side: | |
| - MSE, MAE, Huber (for regression) | |
| - BCE, Cross Entropy, Sparse Categorical Cross Entropy (for classification) | |
| - Switch between: | |
| - Regression | |
| - Binary classification | |
| - Multi-class classification | |
| - Generate synthetic datasets with adjustable: | |
| - Noise level | |
| - Outlier percentage and magnitude | |
| - Number of samples and features | |
| - Visualize: | |
| - Training vs validation loss curves | |
| - Total training time per loss function | |
| - Metric tables (Accuracy, F1, RΒ², etc.) | |
| - View convergence epochs and speed comparisons | |
| --- | |
| ## π§° Technical Overview | |
| - **Framework**: Flask + PyTorch | |
| - **Frontend**: HTML + Plotly.js | |
| - **Dataset Generation**: `scikit-learn` synthetic datasets | |
| - **Metrics**: | |
| - Regression: MSE, MAE, RΒ² | |
| - Classification: Accuracy, Precision, Recall, F1 | |
| --- | |
| ## π Getting Started | |
| ### Prerequisites | |
| - Python 3.10+ | |
| - Git | |
| - Docker (optional) | |
| ### Local Installation | |
| ```bash | |
| # 1. Clone the repository | |
| git clone https://github.com/mnoorchenar/loss-function-playground.git | |
| cd loss-function-playground | |
| # 2. Create a virtual environment | |
| python -m venv venv | |
| source venv/bin/activate # Windows: venv\Scripts\activate | |
| # 3. Install dependencies | |
| pip install -r requirements.txt | |
| # 4. Run the application | |
| python app.py | |
| ``` | |
| Open your browser at `http://localhost:7860` π | |
| --- | |
| ## π³ Docker Deployment | |
| ```bash | |
| docker build -t loss-function-playground . | |
| docker run -p 7860:7860 loss-function-playground | |
| ``` | |
| --- | |
| ## ποΈ How It Works | |
| 1. The app generates a synthetic dataset for the chosen task. | |
| 2. For each selected loss function: | |
| - It builds a simple fully connected PyTorch network. | |
| - Trains it for the specified number of epochs. | |
| - Tracks loss, convergence, and timing. | |
| 3. The results are visualized interactively in the browser. | |
| --- | |
| ## π Project Structure | |
| ``` | |
| loss-function-playground/ | |
| β | |
| βββ π Dockerfile # Container definition (port 7860) | |
| βββ π app.py # Application entry point | |
| βββ π requirements.txt # Python dependencies | |
| ``` | |
| --- | |
| ## π¨βπ» Author | |
| <div align="center"> | |
| <table> | |
| <tr> | |
| <td align="center" width="100%"> | |
| <img src="https://avatars.githubusercontent.com/mnoorchenar" width="120" style="border-radius:50%; border: 3px solid #4f46e5;" alt="Mohammad Noorchenarboo"/> | |
| <h3>Mohammad Noorchenarboo</h3> | |
| <code>Data Scientist</code> | <code>AI Researcher</code> | <code>Biostatistician</code> | |
| π Ontario, Canada π§ [mohammadnoorchenarboo@gmail.com](mailto:mohammadnoorchenarboo@gmail.com) | |
| ββββββββββββββββββββββββββββββββββββββ | |
| [](https://www.linkedin.com/in/mnoorchenar) | |
| [](https://mnoorchenar.github.io/) | |
| [](https://huggingface.co/mnoorchenar) | |
| [](https://scholar.google.ca/citations?user=nn_Toq0AAAAJ&hl=en) | |
| [](https://github.com/mnoorchenar) | |
| </td> | |
| </tr> | |
| </table> | |
| </div> | |
| --- | |
| ## β οΈ Disclaimer | |
| > [!WARNING] | |
| > This project is developed strictly for educational purposes and does not constitute professional advice of any kind. All datasets used are either synthetically generated or publicly available. This software is provided "as is" without warranty of any kind; use at your own risk. | |
| --- | |
| ## π License | |
| Β© 2025 Mohammad Noorchenarboo. All rights reserved. | |
| This project and all associated code are the intellectual property of the author. Reproduction, redistribution, or modification of any part of this repository is strictly prohibited without prior written permission. For permissions or inquiries, contact: [LinkedIn](https://www.linkedin.com/in/mnoorchenar) | |
| --- | |
| <div align="center"> | |
| <img src="https://capsule-render.vercel.app/api?type=waving&color=0:7c3aed,100:06b6d4&height=120§ion=footer&text=Made%20with%20%E2%9D%A4%EF%B8%8F%20by%20Mohammad%20Noorchenarboo&fontColor=ffffff&fontSize=18&fontAlignY=80" width="100%"/> | |
| [](https://github.com/mnoorchenar/loss-function-playground/stargazers) | |
| [](https://github.com/mnoorchenar/loss-function-playground/fork) | |
| <sub>The name "ML Loss Function Playground" is used purely for academic and research purposes. Any similarity to existing product names or trademarks is entirely coincidental. This project has no affiliation with any commercial entity.</sub> | |
| </div> | |