https://github.com/datapuzzler/multilevel_py
A library that simplifies the construction of deep classification hierarchies
https://github.com/datapuzzler/multilevel_py
Last synced: 12 months ago
JSON representation
A library that simplifies the construction of deep classification hierarchies
- Host: GitHub
- URL: https://github.com/datapuzzler/multilevel_py
- Owner: dataPuzzler
- License: bsd-2-clause
- Created: 2020-12-30T09:57:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-13T12:47:52.000Z (almost 5 years ago)
- Last Synced: 2025-02-18T01:48:07.708Z (over 1 year ago)
- Language: Python
- Size: 2.71 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: LICENSE
Awesome Lists containing this project
README
.. image:: https://github.com/dataPuzzler/multilevel_py/workflows/Run%20unittests/badge.svg
:target: https://github.com/dataPuzzler/multilevel_py/workflows/Run%20unittests/badge.svg
:alt: Unittests Badge
.. image:: https://readthedocs.org/projects/multilevel-py/badge/?version=latest
:target: https://readthedocs.org/projects/multilevel-py/badge/?version=latest
:alt: Docs Badge
multilevel_py
=============
*Multilevel_py* is a library that simplifies the construction of classification hierarchies over more than two levels.
The framework depends on python3 only and implements a "deep instantiation" mechanism using pythons metaprogramming
facilities. In academia, the addressed topic is also discussed under the term "Multilevel (Meta-) Modelling". Since
there is no corresponding framework in the python community until this point, multilevel_py was built to fill this gap.
Installing
----------
Install and update using `pip`_:
.. code-block:: text
# Python only
pip install multilevel_py
# with graphical syntax
pip install multilevel_py[viz]
Note that for using the graphical syntax, an installation of the underlying visualisation engine `graphviz`_ is required.
A Simple Example
----------------
The following code constructs a classification structure that spans three levels.
.. code-block:: python
from multilevel_py.constraints import is_int_constraint, is_str_constraint
from multilevel_py.core import create_clabject_prop, Clabject
Breed = Clabject(name="Breed")
yearReg = create_clabject_prop(n="yearReg", t=1, f=0, i_f=True, c=[is_int_constraint])
age = create_clabject_prop(n="age", t=2, f=0, i_f=True, c=[is_int_constraint])
Breed.define_props([yearReg, age])
Collie = Breed(name="Collie", init_props={"yearReg": 1888})
lassie = Collie(name="Lassie", init_props={"age": 7}, declare_as_instance=True)
Visualisation
-------------
Using the viz module, the following graph can be rendered for the previous
example:
.. image:: https://github.com/dataPuzzler/multilevel_py/blob/master/docs/images/collie_chain_initial_example.png
:width: 400
:alt: Visulisation of the collie example
Links
-----
* Github Repository: https://github.com/dataPuzzler/multilevel_py
* Documentation: https://multilevel-py.readthedocs.io/en/latest/
* Releases: https://pypi.org/project/multilevel-py/#description
.. _pip: https://pip.pypa.io/en/stable/quickstart/
.. _graphviz: https://graphviz.org/