Skip to main content
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 Python package for learning statistical relational models, and wraps BoostSRL (and other implementations) with a scikit-learn interface.

Getting Started

Prerequisites:

  • Java 1.8

  • Python (3.6, 3.7)

Installation

pip install srlearn

Basic Usage

The general setup should be similar to scikit-learn. But there are a few extra requirements in terms of setting background knowledge and formatting the data.

A minimal working example (using the Toy-Cancer data set imported with ‘load_toy_cancer’) is:

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(
    background=bk,
    target='cancer',
)
clf.fit(train)
clf.predict_proba(test)
# array([0.88079619, 0.88079619, 0.88079619, 0.3075821 , 0.3075821 ])
print(clf.classes_)
# array([1., 1., 1., 0., 0.])

train and test are each srlearn.Database objects, so this hides some of the complexity behind the scenes.

This example abstracts away some complexity in exchange for compactness. For more examples, see the Example Gallery.

Citing

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

@misc{hayes2019srlearn,
  title={srlearn: A Python Library for Gradient-Boosted Statistical Relational Models},
  author={Alexander L. Hayes},
  year={2019},
  eprint={1912.08198},
  archivePrefix={arXiv},
  primaryClass={cs.LG}
}

Contributing

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 CONTRIBUTING.md for information on submitting issues and pull requests.

Versioning and Releases

We use SemVer for versioning. See Releases for stable versions that are available, or the Project Page on PyPi.

Metadata

Release files for srlearn 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for srlearn 0.5.5
File Size Uploaded
srlearn-0.5.5.tar.gz 57.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for srlearn 0.5.5
File Interpreter ABI Platform
srlearn-0.5.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 MB

Release files / srlearn-0.5.5.tar.gz

Download URL srlearn-0.5.5.tar.gz
Size 57.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f6edace50fa0708324f5f8bbea49e4828bb0e584f05f44c2370342a2012791e7
BLAKE2b-256 checksum
How to use checksums
2a600fcb5811bd8b529e6a22571b33783685cd845a44b21bebba9877654a4f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / srlearn-0.5.5-py3-none-any.whl

Download URL srlearn-0.5.5-py3-none-any.whl
Size 10.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
02e660ca6322aad6f090b42a8fad8951c78ad7052fb76f7e7b023430dcf83c7e
BLAKE2b-256 checksum
How to use checksums
ea226d7771b3cf438ff0ee894aa200a69dc5d6f00f9dbfe5ec697227ff8ee726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.5.5 This release

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page