Activation
Activation
¶
Bases: ABC
Abstract class for activation methods.
Activation methods implement the criteria to activate the rules in a rule block. Activation methods should process every rule and determine whether the rule is to be activated or deactivated.
related
Functions¶
__repr__
¶
__repr__() -> str
Returns the code to construct the activation method in Python.
Returns:
Type | Description |
---|---|
str
|
code to construct the activation method in Python. |
__str__
¶
__str__() -> str
Return the code to construct the activation method in the FuzzyLite Language.
Returns:
Type | Description |
---|---|
str
|
code to construct the activation method in the FuzzyLite Language. |
activate
abstractmethod
¶
activate(rule_block: RuleBlock) -> None
Implement the activation method of the rule block.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_block
|
RuleBlock
|
rule block to activate |
required |
assert_is_not_vector
¶
assert_is_not_vector(activation_degree: Scalar) -> None
Assert that the activation degree is not a vector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activation_degree
|
Scalar
|
activation degree to assert |
required |
Raises:
Type | Description |
---|---|
ValueError
|
if the activation degree contains more than one element |
First
¶
Bases: Activation
Activate the first \(n\) rules (in insertion order) whose activation degrees are greater than or equal to the threshold.
related
Attributes¶
Functions¶
__init__
¶
activate
¶
activate(rule_block: RuleBlock) -> None
Activate the first \(n\) rules (in insertion order) whose activation degrees are greater than or equal to the threshold.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_block
|
RuleBlock
|
rule block to activate. |
required |
General
¶
Bases: Activation
Activation method that activates every rule of a rule block in insertion order.
Highest
¶
Bases: Activation
Activation method that activates only the rules with the highest activation degrees in descending order.
related
Attributes¶
Functions¶
activate
¶
activate(rule_block: RuleBlock) -> None
Activate the rules with the highest activation degrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_block
|
RuleBlock
|
rule block to activate. |
required |
Last
¶
Bases: Activation
Activation method that activates the first \(n\) rules (in reverse insertion order) whose activation degrees are greater than or equal to the threshold.
related
Attributes¶
Functions¶
__init__
¶
activate
¶
activate(rule_block: RuleBlock) -> None
Activate the last \(n\) rules (in reverse insertion order) whose activation degrees are greater than or equal to the threshold.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_block
|
RuleBlock
|
rule block to activate. |
required |
Lowest
¶
Bases: Activation
Activation method that activates only the rules with the lowest activation degrees in ascending order.
related
Attributes¶
Functions¶
activate
¶
activate(rule_block: RuleBlock) -> None
Activate the rules with the lowest activation degrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_block
|
RuleBlock
|
rule block to activate. |
required |
Proportional
¶
Bases: Activation
Activation method that activates the rules utilizing normalized activation degrees, thus the sum of the activation degrees is equal to one.
related
Threshold
¶
Bases: Activation
Activation method that activates the rules whose activation degrees satisfy the comparison operator and the threshold, and deactivates the rest.
related
Attributes¶
Classes¶
Comparator
¶
Bases: Enum
Six comparison operators between the activation degree \(a\) and the threshold \(\theta\).
Attributes¶
__operator__
class-attribute
instance-attribute
¶
__operator__: dict[str, Callable[[Scalar, Scalar], bool | Array[bool_]]] = {
LessThan: lt,
LessThanOrEqualTo: le,
EqualTo: eq,
NotEqualTo: ne,
GreaterThanOrEqualTo: ge,
GreaterThan: gt,
}
operator
property
¶
Functions¶
Functions¶
__init__
¶
__init__(comparator: Comparator | str = GreaterThan, threshold: float = 0.0) -> None
Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
comparator
|
Comparator | str
|
comparison operator |
GreaterThan
|
threshold
|
float
|
value for activation degrees. |
0.0
|
activate
¶
activate(rule_block: RuleBlock) -> None
Activates the rules whose activation degrees satisfy the comparator and threshold, and deactivate the rest.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rule_block
|
RuleBlock
|
rule block to activate. |
required |