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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file polylearner-0.1.1.tar.gz
.
File metadata
- Download URL: polylearner-0.1.1.tar.gz
- Upload date:
- Size: 64.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 003d3d1e231d494edc8067d6351ca897ac9430dfc166fb40e1f6181e191c15bb |
|
MD5 | df8539f0aacc7acad944b66580988c58 |
|
BLAKE2b-256 | 907c9c7444dbdf8df413c4be9c3dc2938a8aaabf3d0d0521a73ba042be0b0c99 |
File details
Details for the file polylearner-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: polylearner-0.1.1-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 782ca0d7703ed8cce4eb21c2923525e114c4d8a3266a33595c5f49c2407c0a80 |
|
MD5 | 957afae510ae5315d17f3b6c16319aba |
|
BLAKE2b-256 | a427a3e65eb25cef212b6035358cccc6e1d607c0d047862f0d584fcf2f1f5215 |