Repository preview image: "srlearn. Python wrappers around BoostSRL with a scikit-learn-style interface. pip install srlearn."

License LGTM code quality analysis GitHub CI Builds Code coverage status Documentation status


srlearn is a project and set of packages for statistical relational artificial intelligence.

Standard machine learning tends to focus on learning and inference inside of a feature-vector (fit a model such that \(\boldsymbol{X}\) predicts \(y\)). Statistical Relational Learning attempts to generalize this to arbitrary graph and hypergraph data: where the prediction problem may include a set of objects with attributes and relations on those objects.

from srlearn.rdn import BoostedRDNClassifier
from srlearn import Background
from srlearn.datasets import load_toy_cancer
train, test = load_toy_cancer()
bk = Background(modes=train.modes)
clf = BoostedRDNClassifier(
# array([0.88079619, 0.88079619, 0.88079619, 0.3075821 , 0.3075821 ])
# array([1., 1., 1., 0., 0.])

Questions? Contact Alexander L. Hayes (

Getting started

Prerequisites and installation instructions for getting started with this package.

User guide

Guide to instantiate, parametrize, and invoke the core methods using a built-in data set.

API documentation

Full documentation for the modules.

Example gallery

A gallery of examples with figures and expected outputs. It complements and extends past the basic example from the User Guide.


If you find this helpful in your work, please consider citing:

  title={srlearn: A Python Library for Gradient-Boosted Statistical Relational Models},
  author={Alexander L. Hayes},


Many thanks to those who have already made contributions:

Many thanks to the known and unknown contributors to WILL/BoostSRL/SRLBoost, including: Navdeep Kaur, Nandini Ramanan, Srijita Das, Mayukh Das, Kaushik Roy, Devendra Singh Dhami, Shuo Yang, Phillip Odom, Tushar Khot, Gautam Kunapuli, Sriraam Natarajan, Trevor Walker, and Jude W. Shavlik.

We have adopted the Contributor Covenant Code of Conduct version 1.4. Please read, follow, and report any incidents which violate this.

Questions, Issues, and Pull Requests are welcome. Please refer to for information on submitting issues and pull requests.