SemFORMS: Automatic Generation of Semantic Transforms By Mining Data Science Code

Ibrahim Abdelaziz, Julian Dolby, Udayan Khurana, Horst Samulowitz, Kavitha SrinivasIJCAI 2023

Introduction

Feature engineering is a critical yet labor-intensive phase of the machine learning pipeline, often requiring significant domain expertise. While Automated Machine Learning (AutoML) systems have made strides in model selection and hyperparameter tuning, they frequently struggle with semantic feature creation—transformations that require context beyond simple mathematical operations. For instance, calculating a specific medical ratio or a housing affordability index requires domain knowledge often absent in generic AutoML libraries.

SemFORMS addresses this gap by leveraging the vast repository of existing data science code on platforms like GitHub. By mining scripts written by data scientists for similar datasets, SemFORMS extracts semantic transformations and converts them into reusable components for AutoML pipelines.

Methodology

The SemFORMS framework automates the discovery and extraction of domain-specific features through a multi-stage pipeline.

The SemFORMS workflow: from dataset metadata to automated model improvement.
  1. Search and Retrieval: When presented with a new dataset, the system queries code repositories using table and column metadata to identify relevant Python scripts or Jupyter notebooks.
  2. Program Analysis: Retrieved scripts are processed using a custom analysis framework built on GraphGen4Code. This framework performs inter-procedural analysis to track data flow, specifically identifying operations that read from or write to pandas DataFrames.
  3. Normalization and Generation: The system extracts these transformations, normalizes variable names to ensure consistency, and generates standalone Python lambda functions.
  4. Integration: These functions are wrapped into scikit-learn FunctionTransformer objects, allowing them to be seamlessly integrated into standard machine learning pipelines.

Evaluation and Results

The system was evaluated using 155 OpenML datasets. Of these, 41 datasets had corresponding public scripts that SemFORMS could successfully analyze. The impact of the mined features was tested using a LightGBM baseline model, with performance measured by Mean Squared Error (MSE) for regression and balanced accuracy for classification.

Relative performance improvements across various datasets using SemFORMS-generated features.

SemFORMS achieved performance gains in 10 out of the 41 applicable datasets. Significant improvements were observed in several domains, most notably a 12.8% relative improvement in the BNG(heart-h) dataset and a 10.4% improvement in the Houses dataset. Qualitative analysis revealed that the system successfully extracted semantically meaningful features, such as boolean flags for medical thresholds (e.g., blood pressure limits) and room-to-bedroom ratios for real estate prediction.

Discussion

The success of SemFORMS highlights that open-source code serves as a massive, untapped knowledge graph for domain-specific data science. While analyzing dynamically typed languages like Python presents technical challenges, the ability to automate the extraction of "human-in-the-loop" insights provides a significant boost to AutoML systems.

A key advantage of the SemFORMS approach is its "fail-fast" nature. Since the extraction and evaluation are fully automated, the AutoML system can simply discard any mined features that do not improve model performance, ensuring that the inclusion of noisy or irrelevant scripts does not degrade the final output. Future work includes expanding the analysis to other languages like R and supporting a broader range of data manipulation frameworks beyond pandas.

Summary updated

BibTeX
@inproceedings{abdelaziz2023semforms,
  author = {Ibrahim Abdelaziz and Julian Dolby and Udayan Khurana and Horst Samulowitz and Kavitha Srinivas},
  title = {{SemFORMS: Automatic Generation of Semantic Transforms By Mining Data Science Code}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/827},
}
Figure