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
title: ML Loss Function Playground
emoji: π§
colorFrom: purple
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
π§ ML Loss Function Playground
π§ ML Loss Function Playground β An interactive web application for exploring and comparing loss functions in regression and classification tasks using PyTorch.
Table of Contents
- Features
- Technical Overview
- Getting Started
- Docker Deployment
- How It Works
- Project Structure
- Author
- Disclaimer
- 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-learnsynthetic datasets - Metrics:
- Regression: MSE, MAE, RΒ²
- Classification: Accuracy, Precision, Recall, F1
π Getting Started
Prerequisites
- Python 3.10+
- Git
- Docker (optional)
Local Installation
# 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
docker build -t loss-function-playground .
docker run -p 7860:7860 loss-function-playground
ποΈ How It Works
- The app generates a synthetic dataset for the chosen task.
- 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.
- 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
Mohammad Noorchenarboo
π Ontario, Canada π§ mohammadnoorchenarboo@gmail.com ββββββββββββββββββββββββββββββββββββββ |
β οΈ Disclaimer
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