mowl.benchmarks

The mOWL benchmark set.

Benchmarks (dataset + task + evaluation protocol) and the results published for them in the literature, so that any method of mowl.catalog can be run on a benchmark and compared against published numbers.

from mowl.benchmarks import list_benchmarks, published_results

for b in list_benchmarks(task="deductive_inference"):
    print(b.key, b.name)

for r in published_results(benchmark="box2el-go-inference"):
    print(r.method, r.metrics, r.source.key, r.locator)

Listing benchmarks and published results does not need the JVM.

Functions

get_benchmark(key)

Return the benchmark registered under key.

list_benchmarks([task])

Return all benchmarks, optionally only those of one Task.

published_results([benchmark, method, subset])

Return published results, optionally filtered by benchmark, method and subset.

get_recipe(benchmark, method[, source, name])

The recipe of method on benchmark.

list_recipes([benchmark, method, source, name])

Recipes, optionally filtered by benchmark key, method key, source key and name.

Classes

Task(*values)

Evaluation tasks.

Benchmark(key, name, task, description, ...)

A benchmark: dataset, task and protocol.

PublishedResult(benchmark, method, metrics, ...)

One published result: a method on a benchmark, as printed in a paper.

Recipe(benchmark, method, source, name, ...)

How a publication trained a method for a benchmark.

Class Inheritance Diagram

Inheritance diagram of mowl.benchmarks.spec.Task, mowl.benchmarks.spec.Benchmark, mowl.benchmarks.spec.PublishedResult, mowl.benchmarks.recipes.Recipe

mowl.benchmarks.runner

Run a method on a benchmark and compare the result with the published numbers.

from mowl.benchmarks.runner import run_benchmark, compare

result = run_benchmark("box2el-galen-prediction", method="box2el",
                       model_kwargs={"embed_dim": 200}, epochs=1000, seed=0,
                       device="cuda")
result.save("result.json")
for row in compare(result):
    print(row["subset"], row["metric"], row["ours"], row["published"])

The same is available from the command line (python -m mowl.benchmarks). Runs are deterministic for a given seed on a given device and software stack: Python’s, NumPy’s and PyTorch’s generators are seeded, and PyTorch’s deterministic algorithms are requested (warn_only; some CUDA kernels have no deterministic variant).

Functions

register_family(family[, first])

Add a ModelFamily handler (before the built-in ones by default).

family_for(cls)

Return the ModelFamily handling cls.

set_seed(seed[, deterministic])

Seed Python, NumPy and PyTorch (CPU and CUDA).

environment()

Package version, git commit and versions of the main dependencies.

resolve_training_regime(regime)

An instance of mowl.training.TrainingRegime from an instance, a class, a catalogue key, a (key, kwargs) pair, or a list of these.

run_benchmark(benchmark[, method, ...])

Train a method on a benchmark and evaluate it with the benchmark's protocol.

settings_differences(ours, published)

Settings stated by the publication that differ from (or are absent in) ours, as {name: (ours, published)}.

compare(result[, method, published])

Compare a result with the published numbers of its benchmark.

Classes

UnsupportedModelError

The model cannot be run on the benchmark (no family handler applies).

BenchmarkResult(benchmark, method, metrics, ...)

Outcome of run_benchmark(); serialisable to JSON.

ModelFamily()

How the runner builds and trains models of one base class.

ELFamily()

EmbeddingELModel subclasses.

Class Inheritance Diagram

Inheritance diagram of mowl.benchmarks.runner.UnsupportedModelError, mowl.benchmarks.runner.BenchmarkResult, mowl.benchmarks.runner.ModelFamily, mowl.benchmarks.runner.ELFamily