genriesz: A Python Package for Automatic Debiased Machine Learning with Generalized Riesz Regression

Masahiro Kato

TL;DR

This paper introduces genriesz, a Python package that unifies and automates debiased machine learning (DML) for causal and structural inference. It achieves this by framing Riesz representer estimation as a generalized regression problem under Bregman divergences, offering a flexible and powerful tool for estimating complex parameters.

What Problem Does This Paper Address?

Estimating causal and structural parameters often involves complex statistical models and requires careful handling of nuisance parameters. Debiased machine learning (DML) provides a powerful framework to achieve valid statistical inference even when using flexible machine learning models for these nuisance parameters. However, implementing DML can be intricate, requiring specific knowledge of Riesz representation theorems and the construction of Neyman orthogonal scores. This paper addresses the need for a more unified, automated, and user-friendly approach to DML, particularly for problems that can be framed as linear functionals of unknown regression functions. The authors aim to simplify the process of estimating Riesz representers, which are central to DML, by providing a generalized framework that encompasses various existing methods.

Methods

The core of genriesz is generalized Riesz regression, which estimates Riesz representers by minimizing empirical Bregman divergences. This approach unifies several existing methods, including covariate balancing, nearest-neighbor matching, and density ratio estimation, under a single framework. A key innovation is Automatic Regressor Balancing (ARB). Given a Bregman generator and a representer model class, genriesz automatically constructs a compatible link function. This ensures that the resulting generalized Riesz regression estimator satisfies crucial balancing (moment-matching) optimality conditions in a user-specified basis.

The package offers a modular interface:

  • Target Linear Functional: Specified via a black-box evaluation oracle.
  • Representer Model: Can be defined using various basis functions, including polynomials, RKHS approximations, random forest leaf encodings, neural embeddings, and a nearest-neighbor catchment basis.
  • Bregman Generator: Users can provide their own or choose from built-in options (e.g., squared distance, unnormalized KL, binary KL, Basu's power, PU learning).

The package then outputs several estimators: Regression Adjustment (RA), Riesz Weighting (RW), Augmented Riesz Weighting (ARW), and TMLE-style estimators, all with cross-fitting, confidence intervals, and p-values.

Datasets

Not discussed in the paper. The paper focuses on the methodology and software implementation, providing examples with simulated data.

Key Insights and Ideas

  • Unified Framework for DML: By framing Riesz representer fitting as a generalized regression problem under Bregman divergences, genriesz provides a single, elegant interface for a wide range of DML tasks. This unifies seemingly disparate methods like covariate balancing and density ratio estimation.
  • Automatic Regressor Balancing (ARB): The automatic construction of a link function based on the Bregman generator is a significant contribution. This ensures that the representer estimation inherently satisfies balancing conditions, simplifying the implementation of valid DML.
  • Flexibility in Representer Models: The ability to use diverse basis functions (from simple polynomials to neural embeddings) allows users to leverage powerful machine learning models for representer estimation while maintaining the theoretical guarantees of DML.
  • Estimand-Centric API: The design emphasizes defining the target parameter (the "oracle m") and the representer model, abstracting away much of the underlying complexity of DML implementation.

Key Results

The paper demonstrates the functionality of genriesz through representative workflows for estimating:

  • Average Treatment Effect (ATE)
  • Average Treatment Effect on the Treated (ATT)
  • Average Marginal Effects (AME)
  • Panel Difference-in-Differences (DID)
  • Nearest-Neighbor Matching

The package outputs standard DML estimators (RA, RW, ARW, TMLE) with confidence intervals and p-values, leveraging cross-fitting for robust inference. The paper highlights the package's ability to handle various Bregman generators and basis functions, showcasing its versatility.

Limitations and Future Work

  • User-Defined Generators: While genriesz supports user-defined generators, it requires careful handling of domain constraints and branch selection, which can add numerical complexity.
  • Sampling and Inference: The default inference uses an i.i.d. approximation and Wald-type confidence intervals. For clustered or dependent data, users need to supply adaptations (e.g., cluster-robust variance estimators), which are not yet part of the core release.
  • Extensibility: While the package is designed for extensibility with optional modules for scikit-learn and PyTorch bases, further integration of advanced feature maps could be beneficial.

The authors suggest that the estimand-centric API makes it convenient to prototype new targets by simply defining the oracle m, implying that the framework is well-suited for exploring new causal inference problems.

Summary updated

BibTeX
@misc{kato2026genriesz,
  author = {Masahiro Kato},
  title = {{genriesz: A Python Package for Automatic Debiased Machine Learning with Generalized Riesz Regression}},
  year = {2026},
  eprint = {2602.17543},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.17543},
}

Loading related content...

Figure