Imputing Missing Values for Categorical Attributes, at Scale

Rushi Bhatt, Panos Ipeirotis, Bala Kishore, Sunil Patil4 Jan 2022

Problem

A team at Compass keeps a transaction database of almost 200 million records on real-estate agent activity. Many identifying fields (email, phone, mobile, contact name, license number) are empty in some rows, while other rows of the same agent have them filled. At this size nobody can write the fill rules by hand, so they have to be inferred automatically. The inference must also run on the Spark infrastructure the team already uses.

Example from the article: several rows belong to one agent, and the missing email, phone and company of one row can be read from the other rows.

Solution in brief

Mine rules of the form "if these attributes have these values, then the target attribute has this value" directly from the data. Count every attribute-value combination once with a Spark CUBE query, compute the confidence and support of each rule from those counts, and keep only rules with confidence 1.0 and high support. The rule table is then applied to the data with another join.

Questions this case answers
  • How to impute missing categorical values in a very large table by learning high-confidence rules from the table itself, when generic rule-mining joins do not scale
  • How to fill empty attribute values in a table with hundreds of millions of rows using the other rows of the same table?
  • How to mine high-confidence if-then rules between columns with Spark without a cross join?
  • How to choose support and confidence thresholds so that rule-based fills stay safe?

Tools and methods

  • Apache Spark — runs the CUBE count and the joins in parallel.
  • CUBE operator — counts all attribute-value combinations (itemsets) in one query.
  • Functional-dependency rules with confidence and support — decide which fills are safe.
  • Single-attribute equijoin with an exact filter — makes the rule join optimizable by Spark.
Continue reading — it's free

Google or a one-time email code. No password.