← Nabil Shehadeh

What I’ve built at USC

I’m doing an MS in Applied Data Science at USC Viterbi. Most of what I’ve built there is data mining at scale: Spark jobs over Yelp’s users, businesses and reviews, written to finish inside the time and memory a grader allows. Around that sits machine learning on small datasets, where every choice can be checked, and a dataframe library written from scratch. The three I’d show first are below, then everything else.

The data

Reviews
Yelp’s users, businesses, ratings, check-ins, photos and tips, one JSON record per line, too big to hold in memory whole.
Graphs
A user graph, with an edge wherever two people reviewed enough of the same businesses.
Streams
User IDs arriving in batches, checked, counted and sampled without being stored.
Baskets
Grocery transactions from Ta Feng, one basket per customer per day.
Sensors
9,568 hourly readings from a power plant: temperature, pressure, humidity and exhaust vacuum, against its output.
Clinical
Six spine and pelvis measurements for each of 310 patients.
Tables
NFL player salaries as CSV, read in chunks.
The web
Instagram metrics, Forbes earnings and Google Trends interest for 11 athletes.

Predicting Yelp ratings DSCI 553

The data mining course ends in a competition: given a user and a business, predict the stars. The grader runs it on Spark with RDDs only, about 1 GB of memory for the driver and 25 minutes on the clock.

Mine blends three predictors. Four XGBoost models, each with its own depth, seed and regularization, are averaged over 41 features: 10 about the user and 31 about the business, from reviews, check-ins, photos, tips, price and location. Item-based collaborative filtering adds a small correction, looking only at businesses the user has already rated, so its cost doesn’t grow with the catalog. A bias baseline, the overall mean plus per-user and per-business offsets, covers people and places with little history. The blend weights them 0.87, 0.08 and 0.05.

The memory limit shaped the design more than the model did. The user and business files are filtered down to the IDs in the training and test sets before they’re collected onto the driver, and the ratings are read once, cached, and reused for every average, profile and history.

PySpark (RDDs), XGBoost

Finding communities in a user graph DSCI 553

People become nodes, linked when they’ve reviewed at least a set number of the same businesses. Label propagation on GraphFrames gives a first answer. Then Girvan-Newman, written from scratch: score every edge by how many shortest paths cross it, using Brandes’ algorithm, cut the highest, score again, and keep the split where modularity peaks.

PySpark, GraphFrames

A dataframe library from scratch DSCI 551

For data management, a classmate and I wrote our own dataframe library in Python: CSV loading in chunks, filters, projections, joins and grouped aggregates. A Flask dashboard of NFL salaries, the top earners and each team’s average, runs on it, and the same pipeline runs in PySpark on Databricks to check it against.

Python, Flask, PySpark on Databricks

Everything else

Similar businesses and three recommenders DSCI 553

MinHash signatures and locality-sensitive hashing (20 bands of 2 rows) find business pairs with a Jaccard similarity of at least 0.5 without comparing every pair. Then three rating predictors: item-based collaborative filtering with Pearson similarity, a feature-based XGBoost model, and a hybrid of the two.

Clustering data that arrives in pieces DSCI 553

The Bradley-Fayyad-Reina algorithm over data loaded a fifth at a time. Each cluster is kept as a count, a sum and a sum of squares; points join by Mahalanobis distance, and outliers wait aside until enough gather to form clusters of their own.

Algorithms for data streams DSCI 553

A Bloom filter that reports its own false-positive rate each batch, Flajolet-Martin distinct counts over a sliding window, and reservoir sampling.

Frequent itemsets DSCI 553

The SON algorithm on Spark, with A-Priori inside each partition, over the Ta Feng baskets.

Power plant output DSCI 552

Linear, polynomial and interaction models pruned by p-value, against KNN regression. Multiple regression reaches an R² of 0.93; standardized KNN with k = 4 has the lowest test error, an MSE of 14.3 against 18.6 for the best linear model.

Spinal condition from six measurements DSCI 552

KNN with five distance metrics and distance-weighted voting. Euclidean with k = 4 did best: a test error of 0.12 and an F1 of 0.92.

What drives an athlete’s brand DSCI 510

Instagram, Forbes and Google Trends data for 11 of the highest-paid athletes, merged in pandas and compared in heatmaps.

These are graded assignments, so the code isn’t public. I’m glad to walk through any of it.