Skip to main content

Polylearner

The Polylearner algorithm is a learning algorithm that, given a set of polyhedra P1, .., Pn, learns a minimal parametrized polyhedron P with parametrizations θ1, .., θn such that P[θ1] yields the same solution set of θ1. In simple terms, P generalizes P1, .., Pn by learning a higher-level polyhedron and its groundings to the lower-level polyhedra.

We represent polyhedra as linear systems of the form Ax <= b, where A is a coefficient matrix, and b is vector of coefficients. Take the following parametrized system

defined by a system P:

x + y <= c
    y <= b
    x <= a

by setting a, b, c to 1 we obtain the triangle on the left, while by setting a, b to 1 and c to 2, we obtain the square on the left; that is, P generalized both the triangle and rectangle.

Quickstart

Installation

mkvirtualenv -p python3.11 polylearner
pip install -r requirements.txt

Python interface

Polyhedra are defined as systems (System objects) representing systems of linear inequalities. The Polylearner class provides a fit(Iterable[System]) -> Optional[SymbolicParametricSystem] learning method to learn the generalizing parametric polyhedron.

Note that not all collections of low-level polyhedra admit a solution, hence fit may also return None.

from hyperplanes.planes import Hyperplane
from hyperplanes.systems import System
from learner.polylearner import Polylearner

# [-X =< 0, X =< 3, -Y =< 0, Y =< 2]
h1 = Hyperplane([-1., 0.], 0.)
h2 = Hyperplane([1., 0.], 3.)
h3 = Hyperplane([0., -1.], 0.)
h4 = Hyperplane([0., 1.], 2.)
s1 = System([h1, h2, h3, h4])

# [-X =< 0, X =< 2, -Y =< 0, Y =< 3]
h5 = Hyperplane([-1., 0.], 0.)
h6 = Hyperplane([1., 0.], 2.)
h7 = Hyperplane([0., -1.], 0.)
h8 = Hyperplane([0., 1.], 3.)
s2 = System([h5, h6, h7, h8])

learner = Polylearner()
learned_system = learner.fit([s1, s2])

The learned_system is an instance of SymbolicParametrizedSystem, a system of SymbolicInequality, which can be grounded into a SymbolicGroundedSystem:

grounding_0 = learned_system.solutions[0]
grounded_system = learned_system.ground(grounding_0)

Examples

Examples on Polylearner usage can be found in the notebooks/ folder.

Cite

Work based on the original implementation of the "Learning from Polyhedral Sets" by S. Ruggieri. Cite as

@inproceedings{DBLP:conf/ijcai/Ruggieri13,
  author    = {Salvatore Ruggieri},
  editor    = {Francesca Rossi},
  title     = {Learning from Polyhedral Sets},
  booktitle = {{IJCAI} 2013, Proceedings of the 23rd International Joint Conference
               on Artificial Intelligence, Beijing, China, August 3-9, 2013},
  pages     = {1069--1075},
  publisher = {{IJCAI/AAAI}},
  year      = {2013},
  url       = {http://www.aaai.org/ocs/index.php/IJCAI/IJCAI13/paper/view/6700},
  timestamp = {Tue, 08 Mar 2022 17:41:51 +0100},
  biburl    = {https://dblp.org/rec/conf/ijcai/Ruggieri13.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}

Metadata

Release files for polylearner 0.1.1

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

Source distribution (sdist)

Source distribution for polylearner 0.1.1
File Size Uploaded Provenance Actions
polylearner-0.1.1.tar.gz 64.6 kB Without provenance Details for polylearner-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 92.6 kB

Release files / polylearner-0.1.1.tar.gz

Download URL polylearner-0.1.1.tar.gz
Size 64.6 kB
Tags Source
SHA-256 checksum
How to use checksums
003d3d1e231d494edc8067d6351ca897ac9430dfc166fb40e1f6181e191c15bb
BLAKE2b-256 checksum
How to use checksums
907c9c7444dbdf8df413c4be9c3dc2938a8aaabf3d0d0521a73ba042be0b0c99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / polylearner-0.1.1-py3-none-any.whl

Download URL polylearner-0.1.1-py3-none-any.whl
Size 28.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
782ca0d7703ed8cce4eb21c2923525e114c4d8a3266a33595c5f49c2407c0a80
BLAKE2b-256 checksum
How to use checksums
a427a3e65eb25cef212b6035358cccc6e1d607c0d047862f0d584fcf2f1f5215
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for polylearner 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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