StellarBasin is an advanced web application that visualizes and explains machine learning models with beautiful, interactive charts and comprehensive explanations.
StellarBasin supports 7 major machine learning model types:
-
๐ณ Decision Tree (Classifier & Regressor)
- Interactive tree structure visualization
- Node and leaf information
- Feature importance analysis
-
๐ Linear Regression (1D & 2D)
- 1D: Line plot with slope and intercept
- 2D: 3D surface visualization
- Multi-dimensional: Coefficient bar charts
-
๐ Logistic Regression
- 1D: Sigmoid curve visualization
- 2D: Decision boundary contour plots
- Probability distributions
-
๐ฏ Support Vector Machine (SVM)
- Support vector visualization
- Kernel information
- Decision boundary analysis
-
๐ K-Nearest Neighbors (KNN)
- Class distribution charts
- Neighbor configuration
- Distance metrics
-
๐ต K-Means Clustering
- Cluster center visualization (2D/3D)
- Cluster heatmaps
- Inertia and convergence info
-
๐ฒ Hierarchical Clustering
- Cluster size distribution
- Linkage method explanation
- Dendrogram information
-
๐ฒ Naive Bayes (Gaussian, Multinomial, Bernoulli)
- Prior probability visualization
- Variant-specific explanations
- Bayes theorem breakdown
- Python 3.8+
- Node.js 14+
- npm or yarn
git clone <your-repo-url>
cd StellarBasin# Navigate to backend
cd backend
# Create virtual environment (optional but recommended)
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt# Navigate to frontend
cd frontend
# Install dependencies
npm installcd backend
python app.pyThe Flask server will start on http://localhost:5000
Open a new terminal and run:
cd frontend
npm startThe React app will open automatically on http://localhost:3000
Train and save your scikit-learn model using joblib:
import joblib
from sklearn.tree import DecisionTreeClassifier
# Train your model
model = DecisionTreeClassifier()
model.fit(X_train, y_train)
# Save the model
joblib.dump(model, 'my_model.pkl')- Open the StellarBasin web app
- Click "Choose File" and select your
.pklmodel file - Click "Upload & Analyze"
The app will display:
- ๐ Interactive Visualizations - Plotly charts or matplotlib images
- ๐ง Detailed Explanations - How the model works, parameters, equations
- ๐ Mathematical Formulas - The underlying equations
- โ๏ธ Model Parameters - All hyperparameters and settings
- ๐ก Interpretations - What the results mean
- Full tree structure with nodes and leaves
- Color-coded by class or value
- Feature importance bars
- 3D surface plot showing prediction plane
- Interactive rotation and zoom
- Coefficient annotations
- 2D/3D scatter plots of cluster centers
- Heatmaps for high-dimensional data
- Cluster statistics
- Support vector highlights
- Decision boundary visualization
- Margin representation
- Flask - Web framework
- scikit-learn - ML model support
- Plotly - Interactive visualizations
- Matplotlib - Static visualizations
- NumPy - Numerical computations
- React 19 - UI framework
- Plotly.js - Interactive charts
- Axios - HTTP requests
- CSS3 - Styling and animations
StellarBasin/
โโโ backend/
โ โโโ app.py # Flask server
โ โโโ stellarbasin.py # Model visualization logic
โ โโโ requirements.txt # Python dependencies
โ โโโ uploads/ # Temporary upload folder
โโโ frontend/
โ โโโ src/
โ โ โโโ App.js # Main application
โ โ โโโ components/
โ โ โ โโโ ModelUploader.js # Upload component
โ โ โ โโโ ExplanationPanel.js # Explanation display
โ โ โโโ assets/ # Images and resources
โ โโโ package.json # Node dependencies
โ โโโ public/ # Static files
โโโ models/ # Sample models (optional)
โโโ README.md # This file
You can test the app with sample models from the models/ directory or create your own:
# Example: Create a simple Decision Tree
from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
import joblib
# Load data
iris = load_iris()
X, y = iris.data, iris.target
# Train model
model = DecisionTreeClassifier(max_depth=3)
model.fit(X, y)
# Save model
joblib.dump(model, 'iris_decision_tree.pkl').pkl(Pickle).joblib(Joblib).pickle(Pickle variant)
Problem: ModuleNotFoundError
# Solution: Install missing dependencies
pip install -r backend/requirements.txtProblem: Port 5000 already in use
# Solution: Change port in app.py
app.run(debug=True, port=5001)Problem: npm start fails
# Solution: Clear cache and reinstall
rm -rf node_modules package-lock.json
npm installProblem: CORS errors
# Solution: Ensure Flask-CORS is installed
pip install flask-cors- Support for ensemble models (Random Forest, Gradient Boosting)
- Neural network visualization
- Model comparison feature
- Export visualizations as images
- Batch model upload
- Model performance metrics
- Custom color themes
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
For questions or feedback, please open an issue on GitHub.
Made with โค๏ธ for the Machine Learning community
๐ Star this repo if you find it helpful!