Skip to main content

Learning from polyhedra: generalize multiple polyhedra into a parametric polyhedron.

Project description

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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polylearner-0.1.0.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

polylearner-0.1.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file polylearner-0.1.0.tar.gz.

File metadata

  • Download URL: polylearner-0.1.0.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for polylearner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ff39c8c5b1653a366176083479eb26d51d35e5bd3d1c3e0a536d04a0a4df6c5
MD5 39953e7602d58612e44654dcba913983
BLAKE2b-256 b7aec15ca5633114cd4f2f644c51033342459faf1f7744867aa4c4623abcec4c

See more details on using hashes here.

File details

Details for the file polylearner-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: polylearner-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for polylearner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02adc06a91eefa2ec057471194b373488403e60dbc772e88be2e288cb9f00532
MD5 a9447abd892b3a05f133079df8425883
BLAKE2b-256 7fc8581e4877e802e439c84979b16b39bc24df757431c1e2ce5078c55009657e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page