How EcoMind AI Works
A technical deep-dive into the machine learning models, neural network architecture, and data science pipeline powering your ethical shopping recommendations — built entirely from scratch.
🧠 Custom Neural Network
📊 203 Products
95.1% Accuracy
⚡ Zero External APIs
🌿 100% Own Code
📈 Model Performance
🔬 Technology Stack
Pandas
Used to load, clean, and manipulate the product dataset. Handles filtering by category, budget, and keyword across 200+ products.
pandas · DataFrame · filtering
NumPy
Powers all array operations inside our neural network — matrix multiplications, gradient calculations, weight updates, and score normalisation.
numpy · arrays · linear algebra · gradients
Scikit-learn
Core ML library: RandomForestClassifier for ethical ratings, MinMaxScaler for normalisation, cosine_similarity for product similarity matching.
sklearn · RandomForest · cosine_similarity
EcoMind Neural Network
Our own multi-output neural network built entirely from scratch using NumPy — no PyTorch, no TensorFlow. Three hidden layers (256→128→64) with Batch Normalisation, Dropout regularisation, and four specialised output heads predicting eco score, ethics score, carbon level, and ethical tags simultaneously.
custom neural net · from scratch · multi-output · NumPy
Batch Normalisation
Custom BatchNorm layer stabilises training by normalising layer inputs to zero mean and unit variance. Includes learnable gamma and beta parameters updated via Adam, dramatically speeding up convergence.
batch norm · normalisation · gamma · beta
Multi-Label Classifier
Sigmoid output head predicts five ethical tags simultaneously — Organic, Fair Trade, Vegan, Recycled, Natural — as independent binary probabilities. Uses Binary Cross-Entropy loss with a 0.4 confidence threshold.
multi-label · sigmoid · BCE loss · ethical tags
Learning Rate Scheduler
Custom step-decay scheduler reduces learning rate across four stages (0.001 → 0.0005 → 0.0002 → 0.00005) over 120 training epochs — preventing overshooting while ensuring convergence to the global minimum.
lr scheduler · step decay · convergence · training
Django
Full-stack web framework serving the AI model through REST API endpoints — /api/chat/, /api/predict/, /api/recommend/ — with beautifully rendered HTML templates.
django · views · templates · REST API
🏗️ Neural Network Architecture
EcoMindNet — Multi-Output Deep Neural Network
···
Input512 TF-IDF
features
features
→
···
Hidden 1256 neurons
LeakyReLU + BN
LeakyReLU + BN
→
···
Hidden 2128 neurons
LeakyReLU + BN
LeakyReLU + BN
→
···
Hidden 364 neurons
LeakyReLU + BN
LeakyReLU + BN
→
Output4 heads
🌿 Eco Score Head
Linear activation → regression (0–10) · MSE loss
⚖️ Ethics Score Head
Linear activation → regression (0–10) · MSE loss
💨 Carbon Level Head
Softmax → 4 classes (ultra_low / low / moderate / high) · Cross-entropy loss
🏷️ Ethical Tags Head
Sigmoid → 5 binary labels (organic, fair_trade, vegan, recycled, natural) · BCE loss
🧮 Composite Score Formula
How every product gets its overall ethical score
Every product receives a single composite ethical score (0–10) — a weighted combination of three independently assessed dimensions. The EcoMind Neural Network predicts eco and ethics scores from product text, while carbon footprint is measured directly.
# ── EcoMind Composite Score (0–10) ──────────────────
composite_score = (
eco_score × 0.40 # 40% · environmental impact
+ ethics_score × 0.40 # 40% · labour & supply chain ethics
+ (10 - carbon_footprint) × 0.20 # 20% · low carbon = higher score
)
# ── EcoMindNet Overall Score (chatbot) ──────────────
overall_score = (
eco_score × 0.45
+ ethics_score × 0.45
+ max(3 - carbon_level, 0) × 0.50 # carbon class bonus
+ len(ethical_tags) × 0.10 # bonus per ethical tag
)
composite_score = (
eco_score × 0.40 # 40% · environmental impact
+ ethics_score × 0.40 # 40% · labour & supply chain ethics
+ (10 - carbon_footprint) × 0.20 # 20% · low carbon = higher score
)
# ── EcoMindNet Overall Score (chatbot) ──────────────
overall_score = (
eco_score × 0.45
+ ethics_score × 0.45
+ max(3 - carbon_level, 0) × 0.50 # carbon class bonus
+ len(ethical_tags) × 0.10 # bonus per ethical tag
)
Eco Score weight
40%
Ethics Score weight
40%
Carbon weight
20%
Carbon classes
4 levels
Ethical tag types
5 labels
Score range
0 – 10
⚙️ Full AI Pipeline
From raw text to ethical product recommendation
Every chatbot query passes through this 8-step pipeline — entirely on your own server, zero external API calls.
01
Data Ingestion with Pandas
203 real-world ethical products loaded into a Pandas DataFrame. Each product carries eco score, ethics score, carbon footprint, price, materials, sustainability certifications (GOTS, B-Corp, Fair Trade, USDA Organic), and a rich product description.
pandas · DataFrame · 203 products
02
Feature Engineering
Composite ethical score computed from weighted formula. Categories label-encoded with Scikit-learn LabelEncoder. Numerical features normalised via MinMaxScaler to [0,1] range. Price converted from USD to INR (₹) for Indian users.
sklearn · MinMaxScaler · LabelEncoder · composite score
03
TF-IDF Text Vectorisation
Custom TF-IDF vectoriser converts product descriptions, materials, certifications, and names into 512-dimensional numerical feature vectors. Bigram support means phrases like "fair trade" and "organic cotton" are understood as single semantic units.
tfidf · bigrams · 512 features · text → numbers
04
Data Augmentation
Training dataset expanded 6× from 203 to 1,218 samples using random word dropout (20% of description words removed per sample), Gaussian noise on numeric scores (±0.15 standard deviation), and description shuffling — giving the model broader generalisation without external data.
augmentation · word dropout · gaussian noise · 1,218 samples
05
EcoMindNet Neural Network Training
The neural network trains for 120 epochs with mini-batches of 32 samples. Adam optimiser with step-decay learning rate schedule. Backpropagation computes gradients through all layers via chain rule. Best weights saved automatically when validation loss improves. Final result: 95.1% carbon accuracy, 0.29 MAE on eco scores.
120 epochs · Adam · backprop · best-model saving
06
RandomForest Ethical Rating
A separate RandomForestClassifier (100 decision trees) trained on [eco_score, ethics_score, carbon_footprint, price] predicts the probability that a product qualifies as "highly ethical" (score ≥ 8.8). This percentage is shown on every product card. 80/20 train-test split.
RandomForest · 100 trees · ethical probability · 80/20 split
07
Content-Based Similarity Filtering
Cosine similarity computed between normalised feature vectors powers the "You Might Also Like" section on each product page. Products closest in ethical profile — not just category — are surfaced as similar recommendations.
cosine similarity · content-based filtering · similar products
08
NLP Intent Parser + Intent Guard
Custom rule-based NLP engine parses every chatbot message — extracting budget in ₹, product categories, and ethical filters using regex and keyword dictionaries. A multi-layer Intent Guard with 1,000+ signal keywords blocks off-topic, political, vulgar, and harmful queries before any product search runs.
NLP · regex · intent detection · content safety · 1000+ signals
🔌 API Endpoints
REST API Reference
EcoMind exposes a full REST API — every feature of the website is accessible programmatically. All endpoints are served entirely by your own Django backend with zero third-party dependencies.
GET
/api/recommend/?category=Clothing&budget=500&keyword=organic
AI product recommendations
POST
/api/recommend/
Recommendations via JSON body
POST
/api/chat/
EcoMind AI chatbot · natural language query
CHATBOT
POST
/api/predict/
EcoMindNet ethical score prediction for any product
OWN LLM
GET
/api/stats/
Dashboard statistics
GET
/api/categories/
All available product categories