ontolearn.heuristics

Heuristic functions.

Module Contents

Classes

CELOEHeuristic

Heuristic like the CELOE Heuristic in DL-Learner.

DLFOILHeuristic

DLFOIL Heuristic.

OCELHeuristic

OCEL Heuristic.

CeloeBasedReward

Reward function for DRILL.

class ontolearn.heuristics.CELOEHeuristic(*, gainBonusFactor: float = 0.3, startNodeBonus: float = 0.1, nodeRefinementPenalty: float = 0.001, expansionPenaltyFactor: float = 0.1)[source]

Bases: ontolearn.abstracts.AbstractHeuristic[ontolearn.abstracts.AbstractOEHeuristicNode]

Heuristic like the CELOE Heuristic in DL-Learner.

__slots__ = ('gainBonusFactor', 'startNodeBonus', 'nodeRefinementPenalty', 'expansionPenaltyFactor')
name: Final = 'CELOE_Heuristic'
gainBonusFactor: Final[float]
startNodeBonus: Final[float]
nodeRefinementPenalty: Final[float]
expansionPenaltyFactor: Final[float]
apply(node: AbstractOEHeuristicNode, instances, learning_problem: EncodedLearningProblem)[source]

Apply the heuristic on a search tree node and set its heuristic property to the calculated value.

Parameters:
  • node – Node to set the heuristic on.

  • instances (set, optional) – Set of instances covered by this node.

  • learning_problem – Underlying learning problem to compare the heuristic to.

class ontolearn.heuristics.DLFOILHeuristic[source]

Bases: ontolearn.abstracts.AbstractHeuristic

DLFOIL Heuristic.

__slots__ = ()
name: Final = 'custom_dl_foil'
apply(node, instances, learning_problem: EncodedPosNegUndLP)[source]

Apply the heuristic on a search tree node and set its heuristic property to the calculated value.

Parameters:
  • node – Node to set the heuristic on.

  • instances (set, optional) – Set of instances covered by this node.

  • learning_problem – Underlying learning problem to compare the heuristic to.

class ontolearn.heuristics.OCELHeuristic(*, gainBonusFactor: float = 0.5, expansionPenaltyFactor: float = 0.02)[source]

Bases: ontolearn.abstracts.AbstractHeuristic

OCEL Heuristic.

__slots__ = ('accuracy_method', 'gainBonusFactor', 'expansionPenaltyFactor')
name: Final = 'OCEL_Heuristic'
apply(node: LBLNode, instances, learning_problem: EncodedPosNegLPStandard)[source]

Apply the heuristic on a search tree node and set its heuristic property to the calculated value.

Parameters:
  • node – Node to set the heuristic on.

  • instances (set, optional) – Set of instances covered by this node.

  • learning_problem – Underlying learning problem to compare the heuristic to.

class ontolearn.heuristics.CeloeBasedReward(reward_of_goal=5.0, beta=0.04, alpha=0.5)[source]

Reward function for DRILL.

property learning_problem
apply(rl_state: RL_State, next_rl_state: RL_State)[source]