NeuralRetail / RetailPulse is an enterprise-grade, end-to-end Data Science, Machine Learning, and Business Intelligence web application built with Python, Streamlit, and Scikit-Learn / Meta Prophet. It transforms raw e-commerce transaction data into actionable decision-making metricsโenabling real-time KPI tracking, dynamic RFM customer segmentation, AI-powered time-series demand forecasting, and automated inventory stockout risk prevention.
NeuralRetail leverages a modern, robust data science stack engineered for performance, scalability, and interactive data visualization.
| Component / Layer | Technology / Library | Version | Purpose & Technical Function |
|---|---|---|---|
| Frontend Framework | Streamlit |
>= 1.28.0 |
Powers the reactive web interface, tabbed navigation, sidebar controls, dynamic metrics, and session state. |
| Custom Styling | HTML5 / CSS3 |
Native | Pink Theme Luminous theme with soft pink gradients, glassmorphism cards, micro-animations, and elevated UI hierarchy. |
| Data Processing | Pandas |
>= 2.0.0 |
Performs data manipulation, daily time-series resampling (resample('D')), groupby aggregations, and datatypes normalization. |
| Numeric Engine | NumPy |
>= 1.24.0 |
Fast vector operations, logarithmic transformations (np.log1p), array math, and metric calculations. |
| Excel Parser | OpenPyXL |
>= 3.1.0 |
Engine for reading .xlsx e-commerce spreadsheet files. |
| Machine Learning | Scikit-Learn |
>= 1.3.0 |
Features StandardScaler normalization, KMeans clustering for customer segmentation, and silhouette_score evaluation. |
| AI Time-Series | Meta Prophet |
>= 1.1.4 |
Additive time-series forecasting model handling trend changepoints, daily seasonality, zero-filled non-trading dates, and confidence bands. |
| Predictive Benchmark | XGBoost |
>= 1.7.0 |
Extreme Gradient Boosting engine used for benchmark regression tasks. |
| Interactive Visuals | Plotly Express / Graph Objects |
>= 5.15.0 |
Renders interactive 3D scatter plots, dynamic line charts, dual-axis trend graphs, and hover tooltips. |
| Static Graphics | Matplotlib & Seaborn |
>= 3.7.0 |
Clean enterprise whitegrid-styled static visual distributions. |
| DevOps & Deploy | Docker & Streamlit Cloud |
Cross-platform | Containerized deployment configuration and cloud hosting support. |
- Real-Time Enterprise KPIs: Track Total Revenue ($), Total Completed Invoices, Active Unique Buyers, and Average Order Value (AOV).
- Dynamic Daily Revenue Trends: Interactive revenue line charts overlaid with a 7-Day Moving Average (MA) to smooth out weekly seasonality.
- Geographic Breakdown: Multi-country revenue distribution comparison and regional market analysis.
- Top Product Performance: Highlights top 10 best-selling items by both sales volume (quantity) and revenue generated.
-
RFM Metric Calculation:
-
Recency (
$R$ ): Days elapsed since customer's last invoice date. -
Frequency (
$F$ ): Count of unique completed purchases. -
Monetary (
$M$ ): Total revenue spend generated by the customer.
-
Recency (
-
Machine Learning Pipeline:
- Applies Logarithmic Transformation
$\log(1 + x)$ to handle heavily skewed RFM distributions. - Standardizes features using
StandardScaler($\mu=0, \sigma=1$ ). - Clusters customer profiles using
KMeanswith automaticsilhouette_scoreevaluation. - Profiles clusters into actionable tiers: Champions ๐, Loyal Customers ๐, Potential / Core ๐ฏ, and At-Risk / Dormant
โ ๏ธ .
- Applies Logarithmic Transformation
- Interactive 3D Visualization: Plotly 3D scatter plot of Recency vs Frequency vs Monetary with exportable segment CSV tables.
- Continuous Time-Series Ingestion: Resamples transaction logs to daily totals, automatically backfilling missing non-trading days with zero revenue to avoid structural bias.
- Flexible Horizons: Forecast 7, 14, 30, 60, or 90 days into the future for both Revenue ($) and Order Volume (Invoices).
-
Contiguous Projections: Seamless visual transition from historical trendlines into future predictions, complete with 80% confidence interval upper and lower error bounds (
$yhat_{\text{lower}}, yhat_{\text{upper}}$ ).
- Sales Velocity: Calculates average daily consumption rate per product over the historical trading window.
-
Statistical Safety Stock & ROP Formulas:
$$\text{Safety Stock} = Z \times \sigma_{\text{daily}} \times \sqrt{\text{Lead Time}}$$ $$\text{Reorder Point (ROP)} = (\text{Daily Velocity} \times \text{Lead Time}) + \text{Safety Stock}$$ -
Stockout Risk Badging: Automatically flags inventory items into clear operational categories:
- ๐ด CRITICAL REORDER: Current stock below Reorder Point.
- ๐ก WARNING ROP: Current stock approaching safety threshold.
- ๐ข ADEQUATE: Stock levels sufficient for current lead time window.
- Searchable, paginated transaction data viewer with multi-column filtering.
- One-click CSV export functionality for reporting and downstream BI integration (PowerBI / Tableau).
flowchart TD
A[Raw Retail Data Excel/CSV] --> B[Data Cleaning & Schema Normalization]
B --> C[Feature Engineering: TotalPrice, Daily Resampling, RFM Metrics]
C --> D[Streamlit Reactive Web App]
D --> E[Tab 1: Revenue & KPI Overview]
D --> F[Tab 2: RFM Customer K-Means Clustering]
D --> G[Tab 3: Meta Prophet Demand Forecasting]
D --> H[Tab 4: Inventory ROP & Safety Stock Planning]
D --> I[Tab 5: Data Explorer & CSV Export]
F --> J[StandardScaler + KMeans Model]
G --> K[Prophet Time-Series Engine]
H --> L[Statistical ROP Formula Engine]
ZidioDataScience/
โโโ NeuralRetail_app.py # Main enterprise Streamlit web application
โโโ RetailPulse.py # Alternative lightweight Streamlit implementation
โโโ requirements.txt # Python dependencies with version bounds
โโโ LICENSE # MIT Open Source License
โโโ README.md # Comprehensive platform documentation
โโโ Command.txt # Launch reference commands
โโโ RetailPulse Architecture.txt# System architecture notes
โโโ RetailPulse PowerBI Dashboards.txt # PowerBI dashboard specifications
โโโ docs/
โ โโโ neuralretail_hero.png # Top-class visual header banner
โ โโโ neuralretail_demo.gif # UI animation preview
โ โโโ neuralretail_preview.png# Dashboard screenshot preview
โโโ data/
โโโ raw/
โโโ online_retail.xlsx # Primary transaction dataset (~45.6 MB)
- Python 3.9+ installed on your system.
- Git (optional, for cloning).
git clone https://github.com/heyyypalak/ZidioDataScience.git
cd ZidioDataScience# On Windows (PowerShell)
python -m venv .venv
.venv\Scripts\activate
# On macOS / Linux
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtstreamlit run NeuralRetail_app.pyThe app will automatically open in your default browser at http://localhost:8501.
To containerize and deploy NeuralRetail using Docker:
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "NeuralRetail_app.py", "--server.port=8501", "--server.address=0.0.0.0"]docker build -t neuralretail-app .
docker run -p 8501:8501 neuralretail-app- Push this repository to GitHub.
- Go to share.streamlit.io.
- Connect your GitHub account and click New App.
- Select repository:
ut3av/ZidioDataScience. - Set Main file path to
NeuralRetail_app.py. - Click Deploy!
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.
Built for data-driven retail analytics, customer intelligence, and automated inventory optimization.
