Skip to main content

mOWL: A machine learning library with ontologies

Project description

mOWL: Machine Learning Library with Ontologies

mOWL is a library that provides different machine learning methods in which ontologies are used as background knowledge. mOWL is developed mainly in Python, but we have integrated the functionalities of OWLAPI, which is written in Java, for which we use JPype to bind Python with the Java Virtual Machine (JVM).

Table of contents

Installation

Test PyPi (beta version)

pip install -i https://test.pypi.org/simple/ mowl-borg

From GitHub

Installation can be done with the following commands:

git clone https://github.com/bio-ontology-research-group/mowl.git

cd mowl

conda env create -f environment.yml
conda activate mowl

./build_jars.sh

The last line will generate the necessary jar files to bind Python with the code that runs in the JVM

Examples of use

Basic example

In this example we use the training data (which is an OWL ontology) from the built-in dataset PPIYeasSlimDataset to build a graph representation using the subClassOf axioms.

from mowl.datasets.ppi_yeast import PPIYeastSlimDataset
from mowl.graph.taxonomy.model import TaxonomyParser

dataset = PPIYeastSlimDataset()
parser = TaxonomyParser(dataset.ontology, bidirectional_taxonomy = True)
edges = parser.parse()

The projected edges is an edge list of a graph. One use of this may be to generate random walks:

from mowl.walking.deepwalk.model import DeepWalk
walker = DeepWalk(edges,
	              100, # number of walks
				  20, # length of each walk
				  0.2, # probability of restart
				  workers = 4, # number of usable CPUs
				  )

walker.walk()
walks = walker.walks

Ontology to graph

In the previous example we called the class TaxonomyParser to perform the graph projection. However, there are more ways to perform the projection. We include the following four:

Instead of instantianting each of them separately, there is the following factory method:

from mowl.graph.factory import parser_factory

parser = parser_factory("taxonomy_rels", dataset.ontology, bidirectional_taxonomy = True)

Now parser will be an instance of the TaxonomyWithRelsParser class. The string parameters for each method are listed above.

For the random walks method we have a similar factory method that can be found in mowl.walking.factory and is called walking_factory.

List of contributors

License

Documentation

Full documentation and API reference can be found in our ReadTheDocs website.

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

mowl-borg-0.0.24.tar.gz (61.8 MB view details)

Uploaded Source

Built Distribution

mowl_borg-0.0.24-py3-none-any.whl (61.8 MB view details)

Uploaded Python 3

File details

Details for the file mowl-borg-0.0.24.tar.gz.

File metadata

  • Download URL: mowl-borg-0.0.24.tar.gz
  • Upload date:
  • Size: 61.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mowl-borg-0.0.24.tar.gz
Algorithm Hash digest
SHA256 9a62f4dbbd6005d45ac78668e3175cf7e0b30bbcb184c7cc809e5b1b84a2d6eb
MD5 007757b315712f77ffd22be9493950b7
BLAKE2b-256 a4f9df28640053fb1d7857c956f373adc212acb41220a2801d808280de175234

See more details on using hashes here.

File details

Details for the file mowl_borg-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: mowl_borg-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 61.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mowl_borg-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 6d1c68d7866db7b503556a1a1dc12e17bd2b8b59f0c26198a86f7840408ece5b
MD5 719be31a2669805c111df2e8a21217a5
BLAKE2b-256 13f1d9564ffdbdc72e3f14ed3a3892158c9a4a0aed338f35cbc6ac2b98dcad84

See more details on using hashes here.

Supported by

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