Data Science Portfolio Projects
A portfolio is the evidence behind a resume claim. Recruiters and hiring managers rarely trust a list of tools; they want to see that you can take a vague business question, gather or clean data, train a model, ship it, and explain the result to someone who does not code. Ten shallow notebooks hurt more than three projects that go end to end. This lesson gives you blueprints for high-signal projects, the architecture each one should show, and the presentation habits that make the work land.
What makes a portfolio project credible
Credibility comes from four things: a real problem statement with a stakeholder, an honest baseline, a deployed artefact rather than a notebook, and documentation of what failed. A project that beats a naive baseline by two points and explains why is stronger than a leaderboard screenshot with no context.
Hiring managers also look for reproducibility. If a reviewer cannot clone your repository, install dependencies, and run a pipeline that reproduces your headline number in under thirty minutes, the project is effectively unverifiable. Pin dependency versions, commit a small sample of data or a download script, and add a single command that runs the whole thing.
| Project type | Signals it sends | Ideal for |
|---|---|---|
| Real-time fraud or anomaly detection | Streaming, latency, class imbalance | Risk, fintech, platform roles |
| Recommendation system | Embeddings, A/B evaluation, cold start | Product, growth, media roles |
| NLP classification pipeline | Transformers, active learning, thresholds | NLP, support tooling, ML roles |
| Forecasting platform | Time series, ensembles, retraining | Supply chain, retail, planning roles |
| Experimentation framework | Statistics, causal reasoning, guardrails | Product data science, growth |
Pick one project that matches the role you want and invest deeply. Breadth is useful, but depth is what gets discussed in a technical interview.
Project one: real-time fraud detection
Fraction detection combines streaming ingestion, extreme class imbalance, and a hard latency budget. A strong version of this project reads transactions from Kafka, computes features in a feature store, scores with an ensemble of a gradient boosting model and an isolation forest, and serves predictions through a FastAPI endpoint with a ninety-fifth percentile latency under one hundred milliseconds.
import numpy as np
import pandas as pd
from sklearn.ensemble import IsolationForest, GradientBoostingClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import average_precision_score, classification_report
class FraudDetectionPipeline:
def __init__(self, contamination: float = 0.01):
self.anomaly = IsolationForest(
contamination=contamination, n_estimators=200, random_state=42
)
self.classifier = GradientBoostingClassifier(
n_estimators=200, max_depth=4, learning_rate=0.1, random_state=42
)
def engineer_features(self, df: pd.DataFrame) -> pd.DataFrame:
features = df.copy()
features["amount_log"] = np.log1p(features["amount"])
features["hour_sin"] = np.sin(2 * np.pi * features["hour"] / 24)
features["hour_cos"] = np.cos(2 * np.pi * features["hour"] / 24)
velocity = (
df.groupby("user_id")["amount"]
.rolling(window=10, min_periods=1)
.agg(["mean", "std", "count"])
.reset_index()
)
velocity.columns = ["user_id", "level_1", "vel_mean", "vel_std", "vel_count"]
features = features.merge(
velocity.drop(columns="level_1"), on="user_id", how="left"
)
features["vel_std"] = features["vel_std"].fillna(0)
return features
def fit(self, train_df: pd.DataFrame, label_col: str = "is_fraud"):
features = self.engineer_features(train_df)
X = features.drop(columns=[label_col, "user_id", "transaction_id"])
y = features[label_col]
X_train, X_val, y_train, y_val = train_test_split(
X, y, test_size=0.2, stratify=y, random_state=42
)
self.anomaly.fit(X_train)
self.classifier.fit(X_train, y_train)
val_proba = self.classifier.predict_proba(X_val)[:, 1]
ap = average_precision_score(y_val, val_proba)
report = classification_report(y_val, self.classifier.predict(X_val))
return {"average_precision": ap, "report": report}
synthetic = pd.DataFrame({
"transaction_id": range(5000),
"user_id": np.random.randint(0, 400, 5000),
"amount": np.random.exponential(80, 5000),
"hour": np.random.randint(0, 24, 5000),
"is_fraud": np.random.binomial(1, 0.02, 5000),
})
pipeline = FraudDetectionPipeline()
print(pipeline.fit(synthetic)["average_precision"])
Report area under the precision-recall curve rather than accuracy, because a two percent fraud rate makes accuracy meaningless. Also report latency at the ninetieth and ninety-ninth percentiles, and estimate the dollar value of fraud prevented versus the cost of false positives; that business translation is what non-technical stakeholders remember.
Project two: recommendation with a two-tower model
Two-tower models embed users and items into a shared vector space, score candidates by dot product or cosine similarity, and serve the top-k. The offline evaluation metric is usually NDCG at ten or recall at twenty, while the online truth comes from an A/B test on click-through rate or revenue per session.
import torch
import torch.nn as nn
import torch.nn.functional as F
class TwoTowerRecommender(nn.Module):
def __init__(self, num_users: int, num_items: int, embed_dim: int = 64):
super().__init__()
self.user_tower = nn.Sequential(
nn.Embedding(num_users, embed_dim),
nn.Linear(embed_dim, 128),
nn.ReLU(),
nn.Linear(128, 64)
)
self.item_tower = nn.Sequential(
nn.Embedding(num_items, embed_dim),
nn.Linear(embed_dim, 128),
nn.ReLU(),
nn.Linear(128, 64)
)
def forward(self, user_ids: torch.Tensor, item_ids: torch.Tensor) -> torch.Tensor:
user_emb = self.user_tower(user_ids)
item_emb = self.item_tower(item_ids)
return F.cosine_similarity(user_emb, item_emb)
model = TwoTowerRecommender(num_users=1000, num_items=5000)
users = torch.randint(0, 1000, (32,))
items = torch.randint(0, 5000, (32,))
scores = model(users, items)
print(scores.shape)
Address the cold-start problem explicitly in your write-up. A content-based fallback that embeds item metadata and a popularity baseline for new users show that you understand the production failure modes, not just the happy path.
Project three: NLP ticket classification with confidence routing
Multi-label classification of support tickets is a practical NLP project with a clear business hook: auto-route high-confidence predictions, send the rest to humans, and feed human decisions back through active learning. Show the confidence threshold trade-off with a curve, not a single number.
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.multiclass import OneVsRestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import precision_recall_curve, average_precision_score
class TicketRouter:
def __init__(self, threshold: float = 0.7):
self.vectorizer = TfidfVectorizer(max_features=8000, ngram_range=(1, 2))
self.classifier = OneVsRestClassifier(LogisticRegression(max_iter=1000))
self.threshold = threshold
def fit(self, texts: list, labels: np.ndarray):
X = self.vectorizer.fit_transform(texts)
self.classifier.fit(X, labels)
return self
def predict_with_confidence(self, texts: list):
X = self.vectorizer.transform(texts)
proba = self.classifier.predict_proba(X)
top = proba.max(axis=1)
auto = top >= self.threshold
return {
"auto_routed": auto.sum(),
"needs_human": (~auto).sum(),
"mean_confidence": float(top.mean()),
}
rng = np.random.default_rng(0)
sample_texts = [f"issue type {i} with detail {i * 7}" for i in range(200)]
sample_labels = rng.integers(0, 5, size=(200, 5))
router = TicketRouter(threshold=0.6).fit(sample_texts, sample_labels)
print(router.predict_with_confidence(["urgent billing problem", "thanks"]))
Present the routing policy as a business decision: what fraction of tickets can you automate given an acceptable error rate, and what does that save in agent hours per month? That framing turns a modelling exercise into a product recommendation.
Project four: forecasting with backtesting discipline
Demand forecasting projects live or die on evaluation honesty. Walk-forward backtesting that trains on past windows and predicts the next week is the minimum standard; a random train-test split leaks the future and produces numbers you cannot defend.
import numpy as np
import pandas as pd
def walk_forward_backtest(df: pd.DataFrame, target: str, horizon: int = 7,
n_splits: int = 5) -> dict:
results = []
for split in range(n_splits):
cut = len(df) - horizon * (n_splits - split)
train, test = df.iloc[:cut], df.iloc[cut:cut + horizon]
naive_forecast = np.repeat(train[target].iloc[-1], len(test))
mape = float(np.mean(np.abs((test[target].values - naive_forecast) /
(test[target].values + 1e-8))) * 100)
results.append({"split": split, "mape": mape, "rows": len(test)})
return {
"mean_mape": float(np.mean([r["mape"] for r in results])),
"std_mape": float(np.std([r["mape"] for r in results])),
"per_split": results,
}
dates = pd.date_range("2024-01-01", periods=90, freq="D")
series = pd.DataFrame({
"date": dates,
"sales": 100 + np.arange(90) * 0.5 + np.random.normal(0, 5, 90),
})
print(walk_forward_backtest(series, target="sales", horizon=7, n_splits=4))
Always include a seasonal-naive baseline that predicts last weekβs value for the same weekday. If your model cannot beat that, the project is not ready to present as a modelling win; the interesting story becomes what feature or regime break explains the failure.
Presentation and repository hygiene
The repository is part of the deliverable. A clean structure has a README that states the problem, the result, and how to reproduce it; a requirements file with pinned versions; a src directory with tested code rather than exploratory notebooks mixed with production logic; and a Dockerfile or Makefile that one command can run.
Write the blog post or case study as if explaining the project to a future teammate. Lead with the outcome, then the approach, then the trade-offs and what you would do differently. Include one architecture diagram, one honest failure, and one quantified business estimate. Those three elements separate a portfolio piece from a tutorial that happens to use your name.
Beyond the core repository, consider adding a short demo video or interactive dashboard. A two-minute screen recording that walks through the problem, the modelβs predictions, and the business impact is often more persuasive than a long README. Host it on YouTube or Vimeo and link it from the repository so recruiters can quickly grasp the projectβs value.
Version control hygiene also matters. Use feature branches for experiments, tag releases when you ship a stable version, and write descriptive commit messages that explain why you made a change, not just what you changed. Recruiters and hiring managers sometimes review the git history as a proxy for how you work professionally.
Community engagement can amplify your portfolio. Share the project on relevant forums, contribute the code back to open source if applicable, or write a guest post for a data science newsletter. These signals show that you can communicate technical work to an audience beyond your immediate team, which is a key skill in most data science roles.
Finally, keep the portfolio updated. Remove or archive projects that no longer represent your skill level, refresh the README on older projects with links to newer work, and ensure that all dependencies still install cleanly. A stale portfolio with broken requirements files creates a worse impression than a smaller, current one.
Common Mistakes
Shipping ten notebooks with no deployment or documentation
Fix: Cut down to three end-to-end projects with READMEs, pinned dependencies, and a single reproduction command.
Reporting accuracy on heavily imbalanced problems like fraud detection
Fix: Use precision-recall curves and business cost estimates instead of accuracy or ROC alone.
Evaluating forecasts with a random train-test split
Fix: Use walk-forward backtesting and compare against a seasonal-naive baseline.
Best Practices
- State the stakeholder and the decision the model supports in the first paragraph
- Quantify impact in dollars, hours, or latency, not only in AUC points
- Include a baseline, an honest failure, and what you would change next time
- Pin dependencies and provide a one-command reproduction path
- Match the project type to the role you are targeting
Key Takeaways
- Depth beats breadth: three polished end-to-end projects outperform ten shallow notebooks
- Credibility comes from baselines, deployed artefacts, and documented failures
- Match evaluation metrics to the business cost: precision-recall for imbalance, NDCG for ranking, MAPE for forecasts
- Reproducibility and clean repositories are part of the portfolio, not an afterthought
- Translate model metrics into business impact so non-technical reviewers remember the result