Data Model
BOOMER is built on a structured data model that represents probabilistic facts and their relationships. Understanding this model is key to using BOOMER effectively.
Core Components
Knowledge Base (KB)
The KB class is the central container for all knowledge in BOOMER. It holds both deterministic facts and probabilistic facts.
from boomer.model import KB
kb = KB(
name="My Knowledge Base",
description="This is a sample knowledge base",
facts=[...], # Deterministic facts
pfacts=[...], # Probabilistic facts
comments="Additional information about this KB"
)
Properties:
name: Identifier for the knowledge basedescription: Human-readable descriptionfacts: List of deterministic facts (100% certainty)pfacts: List of probabilistic facts (with associated probabilities)comments: Additional metadata or notes
Facts
Facts represent logical assertions about entities. BOOMER supports several types of facts:
SubClassOf
Represents a taxonomic relationship where one class is a subclass of another.
ProperSubClassOf
Similar to SubClassOf, but enforces that the subclass is not equivalent to the superclass.
EquivalentTo
Represents that two entities are equivalent or identical.
NotInSubsumptionWith
Indicates that two entities are not in a subsumption relationship (neither is a subclass of the other).
from boomer.model import NotInSubsumptionWith
fact = NotInSubsumptionWith(sub="Fish", sibling="Mammal")
MemberOfDisjointGroup
Indicates that an entity belongs to a disjoint group, meaning it cannot be equivalent to any other entity in a different disjoint group.
from boomer.model import MemberOfDisjointGroup
fact = MemberOfDisjointGroup(sub="MONDO:0000001", group="MONDO")
Probabilistic Facts (PFacts)
A probabilistic fact combines a fact with a probability value representing the certainty of that fact.
from boomer.model import PFact, EquivalentTo
pfact = PFact(
fact=EquivalentTo(sub="Disease", equivalent="Disorder"),
prob=0.8 # 80% certainty
)
Search Configuration
The SearchConfig class controls how BOOMER searches for solutions:
from boomer.model import SearchConfig
config = SearchConfig(
max_iterations=1000000,
max_candidate_solutions=10000,
timeout_seconds=30,
reasoner_class="boomer.reasoners.nx_reasoner.NxReasoner"
)
Properties:
max_iterations: Maximum number of search iterationsmax_candidate_solutions: Maximum number of solutions to considertimeout_seconds: Maximum time in seconds to run the searchreasoner_class: The reasoner implementation to use
Solution
The Solution class represents the result of solving a knowledge base:
# The solve function returns a Solution object
from boomer.search import solve
solution = solve(kb, config)
print(f"Confidence: {solution.confidence}")
print(f"Prior probability: {solution.prior_prob}")
print(f"Posterior probability: {solution.posterior_prob}")
Properties:
solved_pfacts: List ofSolvedPFactobjects with truth values and posterior probabilitiesconfidence: Confidence in the best solution (0-1)prior_prob: Prior probability of the solutionposterior_prob: Posterior probability of the solutionnumber_of_combinations: Number of combinations explorednumber_of_satisfiable_combinations: Number of satisfiable combinations foundtime_started,time_finished,time_elapsed: Timing informationtimed_out: Whether the search timed out
SolvedPFact
Each probabilistic fact in the solution is represented by a SolvedPFact that includes the original fact, its determined truth value, and its posterior probability.
# Accessing solved facts
for spf in solution.solved_pfacts:
if spf.truth_value and spf.posterior_prob > 0.8:
print(f"High confidence: {spf.pfact.fact} (posterior: {spf.posterior_prob})")
Data Flow
The typical flow of data in BOOMER is:
- Create or load a
KBwith facts and probabilistic facts - Configure the search with
SearchConfig - Run
solve()to get aSolution - Analyze the
solved_pfactsfor results
This structured approach allows BOOMER to represent complex knowledge with uncertainty and find the most probable consistent interpretation.