pyreason.scripts.learning.classification.temporal_classifier

Module Contents

class TemporalLogicIntegratedClassifier(model, class_names: List[str], identifier: str = 'classifier', interface_options: pyreason.scripts.learning.utils.model_interface.ModelInterfaceOptions = None, logic_program=None, poll_interval: int | datetime.timedelta | None = None, poll_condition: str | None = None, input_fn: Callable[[], Any] | None = None)[source]

Bases: pyreason.scripts.learning.classification.logic_integration_base.LogicIntegrationBase

Wraps any torch.nn.Module whose forward(x) returns [N, C] logits (multi‐class), but additionally polls in the background (either every N timesteps or every N seconds) and injects new Facts into a PyReason logic program.

model[source]
class_names[source]
identifier = 'classifier'[source]
interface_options = None[source]
logic_program = None[source]
poll_interval = None[source]
poll_condition = None[source]
input_fn = None[source]
get_class_facts(t1: int, t2: int) List[pyreason.scripts.facts.fact.Fact][source]
Return PyReason facts to create nodes for each class. Each class node will have bounds [1,1] with the

predicate corresponding to the model name.

Parameters:
  • t1 – Start time for the facts

  • t2 – End time for the facts

Returns:

List of PyReason facts