Framework for Fuzzy Logic Rule Definition
The module hybrid_learning.fuzzy_logic
defines a framework to
define (logical) operations as functions that accept a grounding and provide the rule truth value
define (fuzzy) logic rules as computational trees of operations
parse rules to and from string representation
define logics as collections of operation builders
For details have a look at the API Reference and the user guide.
Base Classes
Base class for operations and operation trees on dictionary inputs. |
|
Generic merge operation allowing to define both a torch and a numpy operation. |
|
Basic definition of a logic. |
|
Base class to parse string formula specifiers in infix notation to merge operations. |
Standard Fuzzy Logics
The following (fuzzy) logics with standard connectives from Boolean or t-norms fuzzy logic
are defined in hybrid_learning.fuzzy_logic.tnorm_connectives
.
Select one of them by key using hybrid_learning.fuzzy_logic.logic_by_name()
.
Boolean logic and parser. |
|
Product fuzzy logic parser. |
|
Lukasiewicz logic parser. |
|
Goedel fuzzy logic parser. |
Parsing
See FormulaParser
.
Standard Connectives
Fuzzy logic NOT. |
|
Intersection/AND operation on binary masks and scalars. |
|
Union/OR operation on binary masks and scalars. |
|
Pixel-wise implication logical connective on binary masks and scalars. |
|
Goedel inverted logic IMPLIES connective. |
|
Product AND operation. |
|
Product OR operation. |
|
Product logic IMPLIES connective. |
|
Goedel inverted logic IMPLIES connective. |
|
Lukasiewicz AND operation. |
|
Lukasiewicz OR operation. |
|
Lukasiewicz logic IMPLIES connective. |
|
Goedel inverted logic IMPLIES connective. |
|
Goedel or Minimum AND operation. |
|
Goedel or Maximum OR operation. |
|
Goedel logic IMPLIES connective. |
|
Goedel inverted logic IMPLIES connective. |
Standard Quantifiers
Reduce a single tensor along given dimensions using logical AND. |
|
Reduce a single tensor along given dimensions using logical OR. |
|
Filter the dimensions in tensor |
Predicates
Arithmetic Predicates
Predicate of arity 2 that checks element-wise equality between two arrays. |
|
Predicate of arity 2 that thresholds number values at a given threshold. |
|
Predicate of arity 2 that thresholds number values at a given threshold. |
|
Predicate of arity 2 that checks whether an input is below or equals a threshold. |
|
Predicate of arity 2 that checks whether an input is below a threshold. |
Custom Operations
Given a mask of truth values representing the output of a formula apply average pooling. |
|
Given two stacked sets of masks |
|
Calculate the proportion of one mask covered by another. |
|
Calculate the intersection over union between two masks. |
|
Unary predicate that calculates for each pixel location whether it is part of an object segmentation. |
|
Provide a custom transformation on the sequence of values extracted from the annotations dict. |