Skip to main content

OntoSample

Downloads Downloads Pypi

OntoSample is a python package that offers classic sampling techniques for OWL ontologies/knowledge bases. Furthermore, we have tailored the classic sampling techniques to the setting of concept learning making use of learning problem.

Paper: Accelerating Concept Learning via Sampling

Installation

pip install ontosample

or

# 1. clone 
git clone https://github.com/dice-group/Ontolearn.git 
# 2. setup virtual environment
python -m venv venv 
# 3. activate the virtual environment
source venv/bin/activate # for Unix and macOS
.\venv\Scripts\activate  # for Windows
# 4. install dependencies
pip install -r requirements.txt

Usage

from ontolearn_light.knowledge_base import KnowledgeBase
from ontosample.classic_samplers import RandomNodeSampler

# 1. Initialize KnowledgeBase object using the path of the ontology
kb = KnowledgeBase(path="KGs/Family/family-benchmark_rich_background.owl")

# 2. Initialize the sampler and generate the sample
sampler = RandomNodeSampler(kb)
sampled_kb = sampler.sample(30)  # will generate a sample with 30 nodes

# 3. Save the sampled ontology
sampler.save_sample(kb=sampled_kb, filename='sampled_kb')

Check the examples folder for more.

Citing

@inproceedings{10.1145/3583780.3615158,
author = {Baci, Alkid and Heindorf, Stefan},
title = {Accelerating Concept Learning via Sampling},
year = {2023},
isbn = {9798400701245},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3583780.3615158},
doi = {10.1145/3583780.3615158},
abstract = {Node classification is an important task in many fields, e.g., predicting entity types in knowledge graphs, classifying papers in citation graphs, or classifying nodes in social networks. In many cases, it is crucial to explain why certain predictions are made. Towards this end, concept learning has been proposed as a means of interpretable node classification: given positive and negative examples in a knowledge base, concepts in description logics are learned that serve as classification models. However, state-of-the-art concept learners, including EvoLearner and CELOE exhibit long runtimes. In this paper, we propose to accelerate concept learning with graph sampling techniques. We experiment with seven techniques and tailor them to the setting of concept learning. In our experiments, we achieve a reduction in training size by over 90\% while maintaining a high predictive performance.},
booktitle = {Proceedings of the 32nd ACM International Conference on Information and Knowledge Management},
pages = {3733–3737},
numpages = {5},
keywords = {knowledge bases, concept learning, graph sampling},
location = {Birmingham, United Kingdom},
series = {CIKM '23}
}

In case of any question please feel free to open an issue.

Metadata

Release files for ontosample 0.2.6

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

Source distribution (sdist)

Source distribution for ontosample 0.2.6
File Size Uploaded
ontosample-0.2.6.tar.gz 43.8 kB Details

Built distribution (wheel)

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

Total release size: 92.4 kB

Release files / ontosample-0.2.6.tar.gz

Download URL ontosample-0.2.6.tar.gz
Size 43.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf6a80dfb976b1390c2eae4f3d7b9c0c193beac868f8041204169deb3699af26
BLAKE2b-256 checksum
How to use checksums
1280f95d55ae2016caf93e8ec6607edd2a4a4614d1340bf55a2357070c71865a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.5

Release files / ontosample-0.2.6-py3-none-any.whl

Download URL ontosample-0.2.6-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae8452f0d1d55e0608f3c0a78ea55344c03aa72505ab2cab1c6038d6f47604f2
BLAKE2b-256 checksum
How to use checksums
b690d579385d6cbe15b41c0f1ffc79ac39b4e10bb4340bea03242484eabd3194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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