Ontolearn is an open-source software library for structured machine learning in Python. Ontolearn includes modules for processing knowledge bases, inductive logic programming and ontology engineering.
Project description
Ontolearn
Ontolearn is an open-source software library for explainable structured machine learning in Python.
Installation
Installation from source
git clone https://github.com/dice-group/Ontolearn.git
cd Ontolearn
conda create --name temp python=3.8
conda activate temp
conda env update --name temp
python -c 'from setuptools import setup; setup()' develop
python -c "import ontolearn"
tox # to test
Installation via pip
pip install ontolearn # https://pypi.org/project/ontolearn/ only a place holder.
Building (sdist and bdist_wheel)
tox -e build
Building the docs
tox -e docs
Usage
See the manual, tests and examples folder for details.
from ontolearn.concept_learner import CELOE
from ontolearn.model_adapter import ModelAdapter
from owlapy.model import OWLNamedIndividual, IRI
from owlapy.namespaces import Namespaces
from owlapy.render import DLSyntaxObjectRenderer
from experiments_standard import ClosedWorld_ReasonerFactory
NS = Namespaces('ex', 'http://example.com/father#')
positive_examples = {OWLNamedIndividual(IRI.create(NS, 'stefan')),
OWLNamedIndividual(IRI.create(NS, 'markus')),
OWLNamedIndividual(IRI.create(NS, 'martin'))}
negative_examples = {OWLNamedIndividual(IRI.create(NS, 'heinz')),
OWLNamedIndividual(IRI.create(NS, 'anna')),
OWLNamedIndividual(IRI.create(NS, 'michelle'))}
# Only the class of the learning algorithm is specified
model = ModelAdapter(learner_type=CELOE,
reasoner_factory=ClosedWorld_ReasonerFactory,
path="KGs/father.owl")
model.fit(pos=positive_examples,
neg=negative_examples)
dlsr = DLSyntaxObjectRenderer()
for desc in model.best_hypotheses(1):
print('The result:', dlsr.render(desc.concept), 'has quality', desc.quality)
Contribution
Feel free to create a pull request
Simple Linting
Run
flake8
For any further questions, please contact: onto-learn@lists.uni-paderborn.de
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
ontolearn-0.2.1.tar.gz
(188.6 kB
view hashes)
Built Distribution
ontolearn-0.2.1-py3-none-any.whl
(124.4 kB
view hashes)
Close
Hashes for ontolearn-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba8f8317dc4f8c4ff054930d6e182e43e65203c6c9b031b700d9b5256dd0a93 |
|
MD5 | 94443345f54e62ebbf385614a191ebdf |
|
BLAKE2b-256 | 7e9df6fddd2f65263f4104cdb1c416a437076133aca5adc1d1cf5831cd9f0c88 |