#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Data Science · E-commerce

Data Science Applications in E-commerce: Real-World Examples

Online stores use data science to decide what to show, what to stock and how to reduce returns. Here are the main applications, with working Python for each.

Tracks
E-commerce DS Uses · Live Interactive
Use case
—
Application
Situation
—
Business moment
Model
—
What DS provides
Clicks → Features → Model → Shopper
Click a use case to see the business situation and what data science provides.

Home / Tutorials / Career Guides / Data Science Applications in E-commerce: Real-World Examples

Data Science · E-commerce

Data Science Applications in E-commerce: Real-World Examples

RECOMMEND FORECAST SEARCH RETURNS Recommendations Similar items Bought together Recommend Forecasting Demand by item Festive peaks Forecast Search Ranking Relevance Click signals Search Returns Return risk Size guidance Returns
Four data science applications in e-commerce: recommendations, forecasting, search ranking and returns.

Quick summary — data science in e-commerce

E-commerce companies use data science for product recommendations, demand forecasting before sales and festivals, search ranking based on relevance and behaviour, experiments on pricing and page design, and predicting return risk to improve size guidance and reduce costs. Each example can become a portfolio project with public data.

In this guide you will learn:

  1. Recommendation systems — item similarity and co-purchase.
  2. Demand forecasting — with seasonality and features.
  3. Search, experiments and returns — with working code.
  4. E-commerce project templates — for your portfolio.
  5. Interview questions — for e-commerce data science roles.

SECTION 01Recommendations: helping shoppers find products

Recommendations appear on home pages, product pages, carts and emails. They help shoppers discover products they may like and can increase basket size. Approaches range from simple rules, such as showing items often bought together, to models based on user behaviour. Many teams start with simple, explainable approaches and improve them through testing. Common types include:

Type How it works Where it appears Data needed
Popular items Most viewed or bought in a category Home page, new users Orders, views
Bought together Items often in the same order Product page, cart Order line items
Similar items Items with similar attributes or viewers Product page Attributes, view history
Personalised Based on a user's own behaviour Home page, emails User history
from collections import Counter
from itertools import combinations

orders = [
    ["phone", "case", "charger"],
    ["phone", "case"],
    ["laptop", "mouse"],
    ["phone", "charger"],
    ["laptop", "mouse", "bag"],
]
pairs = Counter()
for items in orders:
    for a, b in combinations(sorted(set(items)), 2):
        pairs[(a, b)] += 1

def bought_with(item, top=2):
    scores = Counter({(b if a == item else a): n
                      for (a, b), n in pairs.items() if item in (a, b)})
    return scores.most_common(top)

print(bought_with("phone"))
recommend.py
Key insight: Simple co-purchase recommendations are easy to explain and often a strong baseline. More complex models should beat them in a fair test.

SECTION 02Demand forecasting: stocking the right products

E-commerce companies and their sellers need to know how much stock to keep in each warehouse. Too little stock means lost sales during peaks; too much means storage costs and discounting later. Data scientists build demand forecasts using past sales, seasonality, promotions and events such as festivals and sale days. These are the key elements:

Element What it captures Example feature Why it matters
Trend Long-term growth or decline Rolling average Base level of demand
Seasonality Repeating patterns Day of week, month Weekly and yearly cycles
Events Festivals and sales Is-sale-day flag Sharp demand spikes
Price and promotions Discounts and offers Discount percent Demand responds to price
import numpy as np
import pandas as pd
from sklearn.ensemble import GradientBoostingRegressor

rng = np.random.default_rng(0)
dates = pd.date_range("2025-01-01", periods=400, freq="D")
df = pd.DataFrame({"date": dates})
df["dow"] = df["date"].dt.dayofweek
df["month"] = df["date"].dt.month
df["sale_day"] = (df["date"].dt.day == 10).astype(int)
df["units"] = (50 + 10 * (df["dow"] >= 5) + 80 * df["sale_day"]
               + rng.normal(0, 5, len(df))).round()

train, test = df.iloc[:360], df.iloc[360:]
X = ["dow", "month", "sale_day"]
m = GradientBoostingRegressor(random_state=0).fit(train[X], train["units"])
mae = (m.predict(test[X]) - test["units"]).abs().mean()
print("MAE on last 40 days:", round(mae, 1))
forecast.py
Key insight: Forecasts should be tested on later dates, not random rows. Random splits leak future information and make results look better than they are.

SECTION 03Search ranking, experiments and return prediction

When shoppers search for a product, the order of results strongly affects what they buy. E-commerce teams also run controlled experiments to test changes before launching them widely, and they analyse returns, which are costly in fashion and electronics. Data science supports all three areas, often working closely with product and operations teams:

Application Question Method Outcome
Search ranking Which results should appear first? Relevance plus click and purchase signals More useful results
A/B testing Did the new product page help? Randomised test with control group Evidence-based launches
Return prediction Which orders are likely to be returned? Classification on order and item features Better size guidance
Review analysis What do customers complain about? Text grouping and keyword analysis Product and listing fixes
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity

products = [
    "cotton kurta for women blue",
    "running shoes for men lightweight",
    "blue denim jeans slim fit",
    "women cotton saree printed",
]
vec = TfidfVectorizer()
P = vec.fit_transform(products)

query = "blue cotton kurta"
scores = cosine_similarity(vec.transform([query]), P)[0]
for score, name in sorted(zip(scores, products), reverse=True)[:3]:
    print(round(score, 2), name)
ecom_models.py
Key insight: Return risk is best used to help shoppers, for example with better size guidance, rather than to penalise them.

SECTION 04E-commerce data science project templates

Use public e-commerce datasets to build these projects for your portfolio:

1. Bought-together recommender from public order data
   Metric: hit rate on held-out orders vs popular-items baseline

2. Demand forecast for top 20 products
   Metric: MAE vs seasonal naive baseline, time-based split

3. Review analysis for one category
   Output: top complaint themes with examples
ecom-ds-projects.md

SECTION 05Tips for e-commerce data science roles

These habits help you stand out for e-commerce data science roles:

  • Start with baselines — popular items and last-week demand are strong benchmarks.
  • Use time-based splits — never let future data leak into training.
  • Think about the shopper — use models to help customers, not frustrate them.
  • Learn experimentation — A/B testing is central to e-commerce decisions.
  • Understand seasonality — festivals and sale days shape demand in India.
Pro tip: In interviews, explain how you would measure whether a recommendation change helped. Mention an A/B test and a business metric.

SECTION 06Interview Q&A — e-commerce DS

Q1How would you build a simple recommendation system?

Start with popular items and co-purchase counts, evaluate on held-out orders, then try similarity or personalised models and test the best in an A/B experiment.

Q2How do you evaluate a demand forecast?

Use a time-based split, compare errors such as MAE with a seasonal naive baseline, and check performance on peaks and promotions.

Q3Why can a random train/test split be wrong for forecasting?

It lets the model see future data while training, which leaks information and makes performance look better than in real use.

Q4How would you test a new product page design?

Randomly split users into control and test groups, define a primary metric such as conversion, run for enough time and check significance and side effects.

Q5How could return prediction be used responsibly?

To improve size guidance, product descriptions and quality checks, rather than to penalise individual customers.

SECTION 07Test yourself — e-commerce DS quiz

Five questions. No sign-up.

0 / 5

Pick an answer to see why it is right or wrong.

SECTION 08Frequently asked questions

How is data science used in e-commerce?

For recommendations, demand forecasting, search ranking, pricing and page experiments, return prediction, fraud checks and review analysis. These help shoppers find products and help companies plan stock and operations.

What skills do e-commerce data scientists need?

Python, SQL, statistics, machine learning, forecasting, experimentation and the ability to connect models to business metrics.

Can I build e-commerce data science projects with public data?

Yes. Public e-commerce, retail and review datasets are available and suitable for recommendation, forecasting and text analysis projects.

Is recommendation system knowledge needed for e-commerce roles?

It helps, especially basic approaches and how to evaluate them. Many roles also focus on forecasting, experiments and analytics.

How is this different from data analytics in e-commerce?

Analytics focuses more on reporting and explaining what happened. Data science adds predictive models, experiments and systems that make or support decisions automatically.

Classroom & online · Noida

Build real e-commerce data science projects

Our Data Science Training Course covers Python, statistics, machine learning, forecasting and experimentation with industry-style projects.

Talk to a counsellor for current fees
  • Recommendation projects
  • Forecasting and experiments
  • Portfolio support
  • Weekday & weekend batches