ltnjax.fuzzy_ops ¶
Classes:
| Name | Description |
|---|---|
AggregBoltzmann | |
AggregCMean | Cubic mean or root mean square aggregation operator. Intended for |
AggregGMean | |
AggregHMean | |
AggregInverted | Inversion operator, that inverts conjunction operators to disjunction |
AggregLogProd | Log-product aggregation operator. |
AggregLogSumExp | |
AggregLukMax | Lukasiewicz fuzzy maximum operator. |
AggregLukMin | Lukasiewicz fuzzy minimum aggregation operator. Intended for |
AggregMax | Max fuzzy aggregation operator. Intended for disjunction. |
AggregMean | (Weighted) Mean fuzzy aggregation operator. |
AggregMellowmax | |
AggregMin | Min fuzzy aggregation operator. Intended for conjunction. |
AggregPMean | |
AggregPMeanError |
|
AggregProbSum | Probabilistic sum aggregation operator. Intended for disjunction as it |
AggregProd | (Weighted) Product fuzzy aggregation operator. |
AggregQMean | Quadratic mean or root mean square aggregation operator. Intended for |
AggregSum | (Weighted) Sum aggregation operator. |
AggregYager2 | yager2 fuzzy aggregation operation. Intended for disjunction |
AggregationOperator | Abstract class for aggregation operators. |
AndLuk | Lukasiewicz fuzzy conjunction operator. |
AndMin | Godel fuzzy conjunction operator (min operator). |
AndProd | Goguen fuzzy conjunction operator (product operator). |
BinaryConnectiveOperator | Abstract class for binary connective operators. |
ConnectiveOperator | Abstract class for connective operators. |
Equiv | Equivalence (\(\leftrightarrow\)) fuzzy operator. |
Implies | Implies (\(\Rightarrow\)) fuzzy operator. |
ImpliesGodel | Godel fuzzy implication operand. |
ImpliesGoguen | Goguen fuzzy implication operator. |
ImpliesKleeneDienes | Kleene Dienes fuzzy implication operator. |
ImpliesLuk | Lukasiewicz fuzzy implication operator. |
ImpliesReichenbach | Reichenbach fuzzy implication operator. |
NotGodel | Godel fuzzy negation operator. |
NotStandard | Standard fuzzy negation operator. |
OrLuk | Lukasiewicz fuzzy disjunction operator. |
OrMax | Godel fuzzy disjunction operator (max operator). |
OrProbSum | Goguen fuzzy disjunction operator (probabilistic sum). |
OrSmoothMaximumUnit | |
UnaryConnectiveOperator | Abstract class for unary connective operators. |
Functions:
| Name | Description |
|---|---|
not_ones | Smoothly transforms an array to avoid one-values. |
not_zeros | Smoothly transforms an array to avoid zero-values. |
sigmoid | Computes sigmoid. |
tanh | Computes hyperbolic tangent (tanh). |
Attributes:
| Name | Type | Description |
|---|---|---|
AggregSumLog | | |
Axis | | |
eps | |
Attributes¶
Axis module-attribute ¶
- API Reference
ltnjaxfuzzy_ops Classes-
AggregBoltzmann Methods:__call__ -
AggregCMean Methods:__call__ -
AggregGMean Methods:__call__ -
AggregHMean Methods:__call__ -
AggregInverted Methods:__call__ -
AggregLogProd Methods:__call__ -
AggregLogSumExp Methods:__call__ -
AggregLukMax Methods:__call__ -
AggregLukMin Methods:__call__ -
AggregMax Methods:__call__ -
AggregMean Methods:__call__ -
AggregMellowmax Methods:__call__ -
AggregMin Methods:__call__ -
AggregPMean Methods:__call__ -
AggregPMeanError Methods:__call__ -
AggregProbSum Methods:__call__ -
AggregProd Methods:__call__ -
AggregQMean Methods:__call__ -
AggregSum Methods:__call__ -
AggregYager2 Methods:__call__
-
Classes¶
AggregBoltzmann ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregBoltzmann[AggregBoltzmann]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregBoltzmann
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregBoltzmann href "" "ltnjax.fuzzy_ops.AggregBoltzmann"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Boltzmann fuzzy aggregation operator. This is intended to be used as an disjunction operator as it approximates the maximum aggregation.
\(S_\alpha(x_1,...,x_n)= \sum_{i = 1}^n x_i * \exp(\alpha x_i) / \sum_{i = 1}^n exp(\alpha x_i)\)
Attributes:
| Name | Type | Description |
|---|---|---|
alpha | \(\alpha\) parameter for \(S_\alpha(x_1,...,x_n)\). |
Notes: - \(S_\alpha \rightarrow \max\) as \(\alpha \rightarrow \infty\). - \(S_0\) is the arithmetic mean of its inputs. - \(S_\alpha \rightarrow \min\) as \(\alpha \rightarrow -\infty\). - With zero-only mask, the function will return nan as we divide by a sum, that will be \(0\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Boltzmann aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the Boltzmann aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Boltzmann aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregCMean ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregCMean[AggregCMean]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregCMean
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregCMean href "" "ltnjax.fuzzy_ops.AggregCMean"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Cubic mean or root mean square aggregation operator. Intended for disjunction as it approximates the maximum operator.
Cubic mean: \(\left( \sum_{i = 1}^n x_i^3 / n \right)^{\frac{1}{3}}\)
Weighted cubic mean: \(\left( \frac{\sum_{i=1}^n w_i x_i^3}{\sum_{i=1}^n w_i} \right)^{1/3}\)
Methods:
| Name | Description |
|---|---|
__call__ | It applies the quadratic mean aggregation operator to the given |
__init__ | Constructor. |
Attributes:
| Name | Type | Description |
|---|---|---|
stable | |
Source code in src/ltnjax/fuzzy_ops.py
1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the quadratic mean aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | Cubic mean aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | |
AggregGMean ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregGMean[AggregGMean]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregGMean
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregGMean href "" "ltnjax.fuzzy_ops.AggregGMean"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Geometric Mean fuzzy aggregation operator. Intended for conjunction as it approximates the minimum aggregation operator.
Geometric mean: \((\prod_{i = 1}^n x_i)^{1/n} = \exp(\sum_{i = 1}^n \ln(x_i) / n)\)
Weighted geometric mean: \((\prod_{i = 1}^n x_i^{w_i})^{1/(\sum_{i=1}^n w_i)} = \exp(\sum_{i = 1}^n \ln(x_i) / n)\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Methods:
| Name | Description |
|---|---|
__call__ | It applies the geometric mean aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the geometric mean aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | Geometric mean aggregation applied to the expression. |
Note: -jax.numpy.log computes the natural logarithm.
Source code in src/ltnjax/fuzzy_ops.py
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | |
AggregHMean ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregHMean[AggregHMean]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregHMean
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregHMean href "" "ltnjax.fuzzy_ops.AggregHMean"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Harmonic mean fuzzy aggregation operator.
The harmonic mean is the special case of the Power Mean with \(p=-1\).
Harmonic mean: \(n / (\sum_{i = 1}^n \frac{1}{x_i}\)
Weighted harmonic mean: \(\frac{\sum_{i=1}^n w_i}{\sum_{i=1}^n \frac{w_i}{x_i}}\) \(= \left( \frac{\sum_{i=1}^n w_i x_i^{-1}}{\sum_{i=1}^n w_i} \right)^{-1}\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - As we divide by \((\sum_{i = 1}^n \frac{1}{x_i})\), the values \(x_i\) must not be \(0\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the harmonic mean aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the harmonic mean aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | harmonic mean aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | |
AggregInverted ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregInverted[AggregInverted]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregInverted
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregInverted href "" "ltnjax.fuzzy_ops.AggregInverted"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Inversion operator, that inverts conjunction operators to disjunction operators and vise verca. The given aggreg_op is inverted.
For that, we make use of the fact \(\bigvee(x1,x2,x3) = \neg(\bigwedge(\neg(x1), \neg(x2), \neg(x3)))\)
For example we have Aggreg_Inverted(Aggreg_pMeanError(p=2))) == Aggreg_pMean(p=2))
Attributes:
| Name | Type | Description |
|---|---|---|
aggreg_op | The aggregation operator that is inverted. |
Methods:
| Name | Description |
|---|---|
__call__ | It applies the inverted aggregation operator |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
**kwargs: Any,
) -> Array
It applies the inverted aggregation operator aggreg_op to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| Any | Further arguments to pass to | {} |
Returns:
| Type | Description |
|---|---|
Array | Inverted aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
__init__ ¶
__init__(aggreg_op: AggregationOperator)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| AggregationOperator | The aggregation operator that is inverted. | required |
AggregLogProd ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregLogProd[AggregLogProd]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregLogProd
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregLogProd href "" "ltnjax.fuzzy_ops.AggregLogProd"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Log-product aggregation operator.
\(\sum_{i = 1}^n \log x_i\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - The values in xs should not be \(0\) as we take its logarithm.
- API Reference
ltnjaxfuzzy_ops AttributesAggregSumLog
Methods:
| Name | Description |
|---|---|
__call__ | It applies the LogProd aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the LogProd aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | LogProd aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
__init__ ¶
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| bool | (default=True) Flag indicating whether to use the stable version of the operator or not. | True |
Source code in src/ltnjax/fuzzy_ops.py
AggregLogSumExp ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregLogSumExp[AggregLogSumExp]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregLogSumExp
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregLogSumExp href "" "ltnjax.fuzzy_ops.AggregLogSumExp"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
LogSumExp operator Intended for disjunction as it approximates the maximum aggregation.
\(LSE_\alpha(x_1,\dotsc,x_n) = (1/\alpha) \log \sum_{i = 1}^n \exp (\alpha x_i)\)
Attributes:
| Name | Type | Description |
|---|---|---|
alpha | \(\alpha\) parameter for \(LSE_\alpha(x_1,\dotsc,x_n)\). |
Notes: - With zero-only mask, the function will return -np.infty as we take the logarithm of an empty sum, i.e. of \(0\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the LogSumExp aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the LogSumExp aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | LogSumExp aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregLukMax ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregLukMax[AggregLukMax]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregLukMax
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregLukMax href "" "ltnjax.fuzzy_ops.AggregLukMax"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Lukasiewicz fuzzy maximum operator. This is intended to be used as an conjunction operator.
\(\max(\sum_{i = 1}^n x_i - n + 1, 0)\)
Notes: - Luk_Max has vanishing gradiens for \(\sum_{i = 1}^n x_i - n + 1 < 0\). If \(\sum_{i = 1}^n x_i - n + 1 = 0\), all gradients are \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Lukasiewicz fuzzy disjunction aggregation operator |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the Lukasiewicz fuzzy disjunction aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Lukasiewicz fuzzy disjunction aggregation applied to the |
Array | expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregLukMin ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregLukMin[AggregLukMin]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregLukMin
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregLukMin href "" "ltnjax.fuzzy_ops.AggregLukMin"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Lukasiewicz fuzzy minimum aggregation operator. Intended for disjunction.
\(\min(\sum_{i = 1}^n x_i, 1)\)
Notes: - We have vanishing gradients for the case \(\sum_{i = 1}^n x_i > 1\). For the case that \(\sum_{i = 1}^n x_i = 1\), all gradients are \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Lukasiewicz fuzzy conjunction aggregation operator |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the Lukasiewicz fuzzy conjunction aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Lukasiewicz fuzzy aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregMax ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregMax[AggregMax]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregMax
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregMax href "" "ltnjax.fuzzy_ops.AggregMax"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Max fuzzy aggregation operator. Intended for disjunction.
\(A_{T_{M}}(x_1, \dots, x_n) = \max(x_1, \dots, x_n)\)
Notes: - This aggregator has a single-passing gradient for the maximum value. If \(n\) values attain the maximum, they get the gradients \(\frac{1}{n}\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the max fuzzy aggregation operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the max fuzzy aggregation operator to the given formula's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Max fuzzy aggregation of the formula. |
Source code in src/ltnjax/fuzzy_ops.py
AggregMean ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregMean[AggregMean]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregMean
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregMean href "" "ltnjax.fuzzy_ops.AggregMean"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
(Weighted) Mean fuzzy aggregation operator.
Arithmetic mean \(A_{M}(x_1, \dots, x_n) = \frac{1}{n} \sum_{i = 1}^n x_i\)
Weighted arithmetic mean \(A_{M}(x_1, \dots, x_n) = \frac{1}{\sum_{i = 1}^n w_i} \sum_{i = 1}^n w_i x_i\)
Methods:
| Name | Description |
|---|---|
__call__ | It applies the mean fuzzy aggregation operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
weights: ArrayLike | None = None,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the mean fuzzy aggregation operator to the given formula's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| ArrayLike | None | (default=None) The weights for the aggregation operator. | None |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Mean fuzzy aggregation of the formula. |
Source code in src/ltnjax/fuzzy_ops.py
AggregMellowmax ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregMellowmax[AggregMellowmax]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregMellowmax
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregMellowmax href "" "ltnjax.fuzzy_ops.AggregMellowmax"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Mellowmax fuzzy aggregation operator. This is intended to be used as an disjunction operator as it approximates the maximum aggregation.
\(mm_\alpha(x_1,...,x_n) = (1/\alpha) \log \frac{1}{n} \sum_{i = 1}^n \exp (\alpha x_i)\)
Attributes:
| Name | Type | Description |
|---|---|---|
alpha | \(\alpha\) parameter for \(mm_\alpha(x_1,...,x_n)\). |
Notes: - The result is undefined if we set \(\alpha=0\). - \(mm_\alpha \rightarrow \max\) as \(\alpha \rightarrow \infty\). - \(mm_\alpha \rightarrow 0\) is the arithmetic mean of its inputs. - \(mm_\alpha \rightarrow \min\) as \(\alpha \rightarrow -\infty\). - With zero-only mask, the function will return nan as we divide by a \(n=0\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Mellowmax aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the Mellowmax aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Mellowmax aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregMin ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregMin[AggregMin]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregMin
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregMin href "" "ltnjax.fuzzy_ops.AggregMin"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Min fuzzy aggregation operator. Intended for conjunction.
\(A_{T_{M}}(x_1, \dots, x_n) = \min(x_1, \dots, x_n)\)
Notes: - This aggregator has a single-passing gradient for the minimum value. If \(n\) values attain the minimum, they get the gradients \(\frac{1}{n}\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the min fuzzy aggregation operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the min fuzzy aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Min fuzzy aggregation of the formula. |
Source code in src/ltnjax/fuzzy_ops.py
AggregPMean ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregPMean[AggregPMean]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregPMean
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregPMean href "" "ltnjax.fuzzy_ops.AggregPMean"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
(Weighted) power mean (pmean) / generalized mean aggregation operator see logictensornetwors.
Generalized mean with \(p \neq 0\): \(\left( 1/n * \sum_{i = 1}^n u_i^p \right)^{1/p}\)
Generalized mean with \(p = 0\): \(\left( \prod_{i=1}^n x_i \right)^{\frac{1}{n}}\)
Weighted generalized mean with \(p \neq 0\): \(\left( \frac{\sum_{i=1}^n w_i x_i^p}{\sum_{i=1}^n w_i} \right)^{1/p}\)
Weighted generalized mean with \(p = 0\): \(\left( \prod_{i=1}^n x_i^{w_i} \right)^{\frac{1}{\sum_{i=1}^n w_i}}\)
pMean can be understood as a smooth-maximum that depends on the hyper-parameter \(p\):, - \(p \rightarrow -\infty\): the operator tends to \(\min\), - \(p = -1\): harmonic mean, - \(p = 0\): geometric mean, - \(p = 1\): mean, - \(p = 2\): quadratic mean, - \(p = 3\): cubic mean, - \(p \rightarrow +\infty\): the operator tends to \(\max\).
Attributes:
| Name | Type | Description |
|---|---|---|
p | (default=2) Value of the parameter p. | |
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - pMean has exploding gradients for \(a_1= \dotsc =a_n=0\). - If not all values are \(0\), these who has get a vanishing gradient.
Methods:
| Name | Description |
|---|---|
__call__ | It applies the |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
p: int | None = None,
stable: bool | None = None,
) -> Array
It applies the pMean aggregation operator to the given formula's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| int | None | (default=2) Value of the parameter p. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array |
|
Source code in src/ltnjax/fuzzy_ops.py
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | |
AggregPMeanError ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregPMeanError[AggregPMeanError]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregPMeanError
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregPMeanError href "" "ltnjax.fuzzy_ops.AggregPMeanError"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
pMeanError fuzzy aggregation operator.
\(A_{pME}(x_1, \dots, x_n) = 1 - (\frac{1}{n} \sum_{i = 1}^n (1 - x_i)^p)^{\frac{1}{p}}\)
Attributes:
| Name | Type | Description |
|---|---|---|
p | (default=2) Value of the parameter p. | |
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - pMeanError has exploding gradients for \(a_1= \dotsc =a_n=1\). - If not all values are \(1\), these who has get a vanishing gradient.
Methods:
| Name | Description |
|---|---|
__call__ | It applies the |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
p: int | None = None,
stable: bool | None = None,
) -> Array
It applies the pMeanError aggregation operator to the given formula's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| int | None | (default=2) Value of the parameter p. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array |
|
Source code in src/ltnjax/fuzzy_ops.py
AggregProbSum ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregProbSum[AggregProbSum]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregProbSum
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregProbSum href "" "ltnjax.fuzzy_ops.AggregProbSum"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Probabilistic sum aggregation operator. Intended for disjunction as it is the inverse of AggregProd.
\(1-\prod_{i = 1}^n (1-x_i)\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - ProbSum has vanishing gradients for the case that at least two values \(a_i\) are \(1.\). For the case that exactly one \(a_i\) equals \(1.\), we have a single-passing gradient for this value.
Methods:
| Name | Description |
|---|---|
__call__ | It applies the ProbSum fuzzy aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the ProbSum fuzzy aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | ProbSum fuzzy aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregProd ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregProd[AggregProd]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregProd
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregProd href "" "ltnjax.fuzzy_ops.AggregProd"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
(Weighted) Product fuzzy aggregation operator. Intended for conjunction.
Product: \(\prod_{i = 1}^n x_i\)
Weighted Product: \(\prod_{i = 1}^n x_i^{w_i}\) \(= \exp( \sum_{i = 1}^n w_i \ln x_i )\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - prod has vanishing gradients if at least two values of \(a_i\) are \(0\). If exactly one value is \(0\), we have a single-passing gradient for that value.
- API Reference
ltnjaxfuzzy_ops ClassesAggregProbSum
Methods:
| Name | Description |
|---|---|
__call__ | It applies the prod fuzzy aggregation operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the prod fuzzy aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | Prod fuzzy aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregQMean ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregQMean[AggregQMean]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregQMean
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregQMean href "" "ltnjax.fuzzy_ops.AggregQMean"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Quadratic mean or root mean square aggregation operator. Intended for disjunction as it approximates the maximum operator.
Quadratic mean: \(\sqrt{\sum_{i = 1}^n x_i^2 / n}\)
Weighted quadratic mean: \(\sqrt{ \frac{\sum_{i=1}^n w_i x_i^2}{\sum_{i=1}^n w_i} }\)
Methods:
| Name | Description |
|---|---|
__call__ | It applies the quadratic mean aggregation operator to the given |
__init__ | Constructor. |
Attributes:
| Name | Type | Description |
|---|---|---|
stable | |
Source code in src/ltnjax/fuzzy_ops.py
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | |
Attributes¶
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
stable: bool | None = None,
) -> Array
It applies the quadratic mean aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | Quadratic mean aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | |
AggregSum ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregSum[AggregSum]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregSum
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregSum href "" "ltnjax.fuzzy_ops.AggregSum"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
(Weighted) Sum aggregation operator.
\(\sum_{i = 1}^n w_i x_n\)
Methods:
| Name | Description |
|---|---|
__call__ | It applies the (weighted) sum operator to the given expression's |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | |
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
weights: ArrayLike | None = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the (weighted) sum operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| ArrayLike | None | (default=None) The weights for the aggregation operator. If | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | (Weighted) sum aggregator applied to the expression. |
Raises:
| Type | Description |
|---|---|
ValueError | If |
Source code in src/ltnjax/fuzzy_ops.py
2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | |
__init__ ¶
Constructor.
Source code in src/ltnjax/fuzzy_ops.py
AggregYager2 ¶
Bases: AggregationOperator
flowchart TD
ltnjax.fuzzy_ops.AggregYager2[AggregYager2]
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.AggregationOperator --> ltnjax.fuzzy_ops.AggregYager2
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregYager2 href "" "ltnjax.fuzzy_ops.AggregYager2"
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
yager2 fuzzy aggregation operation. Intended for disjunction aggregation operator as it approximates :class.Aggreg_Luk_Min.
\(\min(1, \sqrt(\sum_{i = 1}^n x_i^2))\)
Notes: - We have vanishing gradients for the case \(\sqrt(\sum_{i = 1}^n x_i^2) > 1\). For the case that \(\sqrt(\sum_{i = 1}^n x_i^2) = 1\), all gradients are \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Yager2 fuzzy aggregation operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(
xs: ArrayLike,
axis: Axis = None,
keepdims: bool = False,
mask: ArrayLike | None = None,
) -> Array
It applies the Yager2 fuzzy aggregation operator to the given expression's grounding on the selected dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Grounding of expression on which the aggregation has to be performed. | required |
| Axis | (default=None) Axis along which the aggregation to be computed. If None, the aggregation is computed along all the axes. | None |
| bool | (default=False) Flag indicating whether the output has to keep the same dimensions as the input after the aggregation. | False |
| ArrayLike | None | (default=None) Boolean mask for excluding values of 'xs' from the aggregation. It is internally used for guarded quantification. The mask must have the same shape of 'xs'. | None |
Returns:
| Type | Description |
|---|---|
Array | Yager2 fuzzy aggregation applied to the expression. |
Source code in src/ltnjax/fuzzy_ops.py
AggregationOperator ¶
Bases: ConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.AggregationOperator[AggregationOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.AggregationOperator
click ltnjax.fuzzy_ops.AggregationOperator href "" "ltnjax.fuzzy_ops.AggregationOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Abstract class for aggregation operators.
Raises:
| Type | Description |
|---|---|
NotImplementedError | Raised when call is not implemented in the sub-class. |
- API Reference
ltnjaxfuzzy_ops ClassesAggregInverted Methods:__init__
Methods:
| Name | Description |
|---|---|
__call__ | Implements the behavior of the aggregation operator. |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ abstractmethod ¶
Implements the behavior of the aggregation operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Any | Arguments. | () |
| Any | Keyword arguments. | {} |
Raises:
| Type | Description |
|---|---|
NotImplementedError | Always. |
- API Reference
ltnjaxfuzzy_ops ClassesAggregationOperator
Source code in src/ltnjax/fuzzy_ops.py
AndLuk ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.AndLuk[AndLuk]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.AndLuk
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.AndLuk href "" "ltnjax.fuzzy_ops.AndLuk"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Lukasiewicz fuzzy conjunction operator.
\(\land_{Lukasiewicz}(x, y) = \max(x + y - 1, 0)\)
Notes: - And_Luk has vanishing gradients if \(x+y < 1.\). If \(x+y = 1\), both gradients are \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Lukasiewicz fuzzy conjunction operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Lukasiewicz fuzzy conjunction operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Lukasiewicz fuzzy conjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
AndMin ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.AndMin[AndMin]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.AndMin
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.AndMin href "" "ltnjax.fuzzy_ops.AndMin"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Godel fuzzy conjunction operator (min operator).
\(\land_{Godel}(x, y) := \min(x,y)\)
Notes: - \(\min\) has a single-passing gradient if the values \(x\) and \(y\) are not equal, i.e. the smaller one has \(1\) and the other one is \(0\). If both values are equal, both gradients equal \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Godel fuzzy conjunction operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Godel fuzzy conjunction operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Godel fuzzy conjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
AndProd ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.AndProd[AndProd]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.AndProd
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.AndProd href "" "ltnjax.fuzzy_ops.AndProd"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Goguen fuzzy conjunction operator (product operator).
\(\land_{Goguen}(x, y) = xy\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - product t-norm has vanishing gradients for \(x=y=0\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Goguen fuzzy conjunction operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the Goguen fuzzy conjunction operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | The Goguen fuzzy conjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
BinaryConnectiveOperator ¶
Bases: ConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Abstract class for binary connective operators.
Raises:
| Type | Description |
|---|---|
NotImplementedError | Raised when call is not implemented in the sub-class. |
Methods:
| Name | Description |
|---|---|
__call__ | Implements the behavior of the connective binary operator. |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ abstractmethod ¶
Implements the behavior of the connective binary operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Any | Arguments. | () |
| Any | Keyword arguments. | {} |
Raises:
| Type | Description |
|---|---|
NotImplementedError | Always. |
- API Reference
ltnjaxfuzzy_ops ClassesBinaryConnectiveOperator
Source code in src/ltnjax/fuzzy_ops.py
ConnectiveOperator ¶
Bases: ABC
flowchart TD
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Abstract class for connective operators.
Raises:
| Type | Description |
|---|---|
NotImplementedError | Raised when call is not implemented in the sub-class. |
- API Reference
ltnjax
- API Reference
ltnjax
Methods:
| Name | Description |
|---|---|
__call__ | Implements the behavior of the connective operator. |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ abstractmethod ¶
Implements the behavior of the connective operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Any | Arguments. | () |
| Any | Keyword arguments. | {} |
Raises:
| Type | Description |
|---|---|
NotImplementedError | Always. |
- API Reference
ltnjaxfuzzy_ops ClassesConnectiveOperator
Source code in src/ltnjax/fuzzy_ops.py
Equiv ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.Equiv[Equiv]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.Equiv
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.Equiv href "" "ltnjax.fuzzy_ops.Equiv"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Equivalence (\(\leftrightarrow\)) fuzzy operator.
\(x \leftrightarrow y \equiv x \rightarrow y \land y \rightarrow x\)
Attributes:
| Name | Type | Description |
|---|---|---|
and_op | Fuzzy operator for the conjunction. | |
implies_op | Fuzzy operator for the implication. |
Notes: - the equivalence operator (\(\leftrightarrow\)) is implemented as an operator which computes: \(x \rightarrow y \land y \rightarrow x\); - the and_op parameter defines the operator for \(\land\); - the implies_op parameter defines the operator for \(\rightarrow\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the fuzzy equivalence operator to the given operands. |
__init__ | This constructor has to be used to set the operator for the |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the fuzzy equivalence operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The fuzzy equivalence of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
__init__ ¶
__init__(
and_op: BinaryConnectiveOperator, implies_op: BinaryConnectiveOperator
)
This constructor has to be used to set the operator for the conjunction and for the implication of the equivalence operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| BinaryConnectiveOperator | Fuzzy operator for the conjunction. | required |
| BinaryConnectiveOperator | Fuzzy operator for the implication. | required |
Source code in src/ltnjax/fuzzy_ops.py
Implies ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.Implies[Implies]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.Implies
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.Implies href "" "ltnjax.fuzzy_ops.Implies"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Implies (\(\Rightarrow\)) fuzzy operator.
An Implies operator that uses given negation and disjunction operators. This uses \(p \Rightarrow q \equiv \not p \lor q\).
Attributes:
| Name | Type | Description |
|---|---|---|
not_op | Fuzzy negation operator to use for the negation operator. or_op: Fuzzy disjunction operator to use for the disjunction operator. |
Methods:
| Name | Description |
|---|---|
__call__ | It applies the fuzzy implies operator to the given operands. |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the fuzzy implies operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The fuzzy implies of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
__init__ ¶
__init__(not_op: UnaryConnectiveOperator, or_op: BinaryConnectiveOperator)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| UnaryConnectiveOperator | Fuzzy negation operator to use for the negation operator. | required |
| BinaryConnectiveOperator | Fuzzy disjunction operator to use for the disjunction operator. | required |
Source code in src/ltnjax/fuzzy_ops.py
ImpliesGodel ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.ImpliesGodel[ImpliesGodel]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.ImpliesGodel
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.ImpliesGodel href "" "ltnjax.fuzzy_ops.ImpliesGodel"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Godel fuzzy implication operand.
\(\rightarrow_{Godel}(x, y) = \left\{\begin{array}{ c l }1 & \quad \textrm{if } x \le y \\ y & \quad \textrm{otherwise} \end{array} \right.\)
Notes: - Implies_Godel has vanishing gradients if \(x<=y\). Otherwise, it passes a single gradient for \(y\) if \(x>y\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Godel fuzzy implication operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Godel fuzzy implication operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Godel fuzzy implication of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
ImpliesGoguen ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.ImpliesGoguen[ImpliesGoguen]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.ImpliesGoguen
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.ImpliesGoguen href "" "ltnjax.fuzzy_ops.ImpliesGoguen"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Goguen fuzzy implication operator.
\(\rightarrow_{Goguen}(x, y) = \left\{\begin{array}{ c l }1 & \quad \textrm{if } x \le y \\ \frac{y}{x} & \quad \textrm{otherwise} \end{array} \right.\)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| bool | (default=True) Flag indicating whether to use the stable version of the operator or not. | True |
Notes: - This expression is only defined if \(x != 0\). - This expression has vanishing gradients if \(x <= y\). This can be prevented by using its stable version.
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Goguen fuzzy implication operator to the given |
__init__ | Constructor. |
Attributes:
| Name | Type | Description |
|---|---|---|
stable | |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the Goguen fuzzy implication operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | The Goguen fuzzy implication of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
ImpliesKleeneDienes ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.ImpliesKleeneDienes[ImpliesKleeneDienes]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.ImpliesKleeneDienes
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.ImpliesKleeneDienes href "" "ltnjax.fuzzy_ops.ImpliesKleeneDienes"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Kleene Dienes fuzzy implication operator.
\(\rightarrow_{KleeneDienes}(x, y) = \max(1 - x, y)\)
Notes: - Implies_KleeneDienes has a single-passing gradient for either \(x\) if \(1.-x>y\), or for \(y\) if \(1.-x<y\). If \(1.-x=y\), both gradients are \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Kleene Dienes fuzzy implication operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Kleene Dienes fuzzy implication operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Kleene Dienes fuzzy implication of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
ImpliesLuk ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.ImpliesLuk[ImpliesLuk]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.ImpliesLuk
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.ImpliesLuk href "" "ltnjax.fuzzy_ops.ImpliesLuk"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Lukasiewicz fuzzy implication operator.
\(\rightarrow_{Lukasiewicz}(x, y) = \min(1 - x + y, 1)\)
Notes: - Implies_Luk has vanishing gradients for \(-x+y>0\). For \(-x+y=0\), both gradients are \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Lukasiewicz fuzzy implication operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Lukasiewicz fuzzy implication operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Lukasiewicz fuzzy implication of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
ImpliesReichenbach ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.ImpliesReichenbach[ImpliesReichenbach]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.ImpliesReichenbach
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.ImpliesReichenbach href "" "ltnjax.fuzzy_ops.ImpliesReichenbach"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Reichenbach fuzzy implication operator.
\(\rightarrow_{Reichenbach}(x, y) = 1 - x + xy\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - The Reichenbach implication has vanishing gradients for \(x=0, y=1\). This can be prevented by using its stable version. - This implies operator is implemented using \(u \implies v \Leftrightarrow \neq p \lor q\) using NotStandard and OrProbSum.
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Reichenbach fuzzy implication operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the Reichenbach fuzzy implication operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | The Reichenbach fuzzy implication of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
NotGodel ¶
Bases: UnaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.NotGodel[NotGodel]
ltnjax.fuzzy_ops.UnaryConnectiveOperator[UnaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.UnaryConnectiveOperator --> ltnjax.fuzzy_ops.NotGodel
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.UnaryConnectiveOperator
click ltnjax.fuzzy_ops.NotGodel href "" "ltnjax.fuzzy_ops.NotGodel"
click ltnjax.fuzzy_ops.UnaryConnectiveOperator href "" "ltnjax.fuzzy_ops.UnaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Godel fuzzy negation operator.
\(x == 0\)
Notes: - This is not recommended for machine learning as the gradient will always be \(0\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Godel fuzzy negation operator to the given operand. |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(x: ArrayLike) -> Array
It applies the Godel fuzzy negation operator to the given operand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Godel fuzzy negation of the given operand. |
Source code in src/ltnjax/fuzzy_ops.py
NotStandard ¶
Bases: UnaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.NotStandard[NotStandard]
ltnjax.fuzzy_ops.UnaryConnectiveOperator[UnaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.UnaryConnectiveOperator --> ltnjax.fuzzy_ops.NotStandard
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.UnaryConnectiveOperator
click ltnjax.fuzzy_ops.NotStandard href "" "ltnjax.fuzzy_ops.NotStandard"
click ltnjax.fuzzy_ops.UnaryConnectiveOperator href "" "ltnjax.fuzzy_ops.UnaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Standard fuzzy negation operator.
\(1-x\)
Methods:
| Name | Description |
|---|---|
__call__ | It applies the standard fuzzy negation operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
__call__(x: ArrayLike) -> Array
It applies the standard fuzzy negation operator to the given operand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The standard fuzzy negation of the given operand. |
Source code in src/ltnjax/fuzzy_ops.py
OrLuk ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.OrLuk[OrLuk]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.OrLuk
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.OrLuk href "" "ltnjax.fuzzy_ops.OrLuk"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Lukasiewicz fuzzy disjunction operator.
\(\lor_{Lukasiewicz}(x, y) = \min(x + y, 1)\)
Notes: - Or_Luk has vanishing gradients for \(x+y>1\). If \(x+y=1\), both gradients will be \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Lukasiewicz fuzzy disjunction operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Lukasiewicz fuzzy disjunction operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Lukasiewicz fuzzy disjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
OrMax ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.OrMax[OrMax]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.OrMax
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.OrMax href "" "ltnjax.fuzzy_ops.OrMax"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Godel fuzzy disjunction operator (max operator).
\(\lor_{Godel}(x, y) = \max(x, y)\)
Notes: - \(\max\) has a single-passing gradient if the values \(x\) and \(y\) are not equal, i.e. the larger one has \(1\) and the other one is \(0\). If both values are equal, both gradients equal \(0.5\).
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Godel fuzzy disjunction operator to the given |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ ¶
It applies the Godel fuzzy disjunction operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
Returns:
| Type | Description |
|---|---|
Array | The Godel fuzzy disjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
OrProbSum ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.OrProbSum[OrProbSum]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.OrProbSum
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.OrProbSum href "" "ltnjax.fuzzy_ops.OrProbSum"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Goguen fuzzy disjunction operator (probabilistic sum).
\(\lor_{Goguen}(x, y) = x + y - xy\)
Attributes:
| Name | Type | Description |
|---|---|---|
stable | (default=True) Flag indicating whether to use the stable version of the operator or not. |
Notes: - The product t-conorm has vanishing gradients for \(x=y=1\). - This or operator is implemented using De Morgans's law \(u \lor v \Leftrightarrow \neq u \land \neq v\) and the implementations NotStandard and AndProd.
- API Reference
ltnjaxfuzzy_ops ClassesImpliesReichenbach
Methods:
| Name | Description |
|---|---|
__call__ | It applies the Goguen fuzzy disjunction operator to the given |
__init__ | Constructor. |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the Goguen fuzzy disjunction operator to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
| bool | None | (default=None) Flag indicating whether to use the stable version of the operator or not. | None |
Returns:
| Type | Description |
|---|---|
Array | The Goguen fuzzy disjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
OrSmoothMaximumUnit ¶
Bases: BinaryConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.OrSmoothMaximumUnit[OrSmoothMaximumUnit]
ltnjax.fuzzy_ops.BinaryConnectiveOperator[BinaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.BinaryConnectiveOperator --> ltnjax.fuzzy_ops.OrSmoothMaximumUnit
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.BinaryConnectiveOperator
click ltnjax.fuzzy_ops.OrSmoothMaximumUnit href "" "ltnjax.fuzzy_ops.OrSmoothMaximumUnit"
click ltnjax.fuzzy_ops.BinaryConnectiveOperator href "" "ltnjax.fuzzy_ops.BinaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Smooth maximum unit fuzzy disjunction operator, that approximates the maximum.
\(\max_\epsilon(a,b) = (a+b+|a-b|_\epsilon) / 2\), where we approximate \(|a-b|\) by \(\sqrt((a-b)^2 + \epsilon)\).
Attributes:
| Name | Type | Description |
|---|---|---|
epsilon | A parameter for \(|a-b|_\epsilon\) that approximates \(|a-b|\). |
Methods:
| Name | Description |
|---|---|
__call__ | It applies the smooth maximum unit fuzzy disjunction to the given |
__init__ | This constructor has to be used to set the epsilon parameter. |
Source code in src/ltnjax/fuzzy_ops.py
Attributes¶
Methods:¶
__call__ ¶
It applies the smooth maximum unit fuzzy disjunction to the given operands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | First operand on which the operator has to be applied. | required |
| ArrayLike | Second operand on which the operator has to be applied. | required |
| float | None | (default=None) Parameter for \(|a-b|_\epsilon\) that approximates \(|a-b|\). | None |
Returns:
| Type | Description |
|---|---|
Array | The smooth maximum unit fuzzy disjunction of the two operands. |
Source code in src/ltnjax/fuzzy_ops.py
UnaryConnectiveOperator ¶
Bases: ConnectiveOperator
flowchart TD
ltnjax.fuzzy_ops.UnaryConnectiveOperator[UnaryConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator[ConnectiveOperator]
ltnjax.fuzzy_ops.ConnectiveOperator --> ltnjax.fuzzy_ops.UnaryConnectiveOperator
click ltnjax.fuzzy_ops.UnaryConnectiveOperator href "" "ltnjax.fuzzy_ops.UnaryConnectiveOperator"
click ltnjax.fuzzy_ops.ConnectiveOperator href "" "ltnjax.fuzzy_ops.ConnectiveOperator"
Abstract class for unary connective operators.
Raises:
| Type | Description |
|---|---|
NotImplementedError | Raised when call is not implemented in the sub-class. |
Methods:
| Name | Description |
|---|---|
__call__ | Implements the behavior of the unary connective operator. |
Source code in src/ltnjax/fuzzy_ops.py
Methods:¶
__call__ abstractmethod ¶
Implements the behavior of the unary connective operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Any | Arguments. | () |
| Any | Keyword arguments. | {} |
Raises:
| Type | Description |
|---|---|
NotImplementedError | Always. |
- API Reference
ltnjaxfuzzy_ops ClassesUnaryConnectiveOperator
Source code in src/ltnjax/fuzzy_ops.py
Functions:¶
not_ones ¶
not_ones(x: ArrayLike) -> Array
Smoothly transforms an array to avoid one-values.
Function that has to be used when we need to assure that the truth value in input to a fuzzy operator is never equal to one, in such a way to avoid gradient problems. It maps the interval \([0, 1]\) in the interval \([0, 1[\), where the \(1\) is excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Array of truth-values. | required |
Returns:
| Type | Description |
|---|---|
Array | The input truth values changed in such a way to prevent gradient |
Array | problems (1 is changed with a small number near 1). |
Source code in src/ltnjax/fuzzy_ops.py
not_zeros ¶
not_zeros(x: ArrayLike) -> Array
Smoothly transforms an array to avoid zero-values.
Function that has to be used when we need to assure that the truth value in input to a fuzzy operator is never equal to zero, in such a way to avoid gradient problems. It maps the interval \([0, 1]\) in the interval \(]0, 1]\), where the \(0\) is excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Array of truth-values. | required |
Returns:
| Type | Description |
|---|---|
Array | The input truth values changed in such a way to prevent gradient |
Array | problems (0 is changed with a small number near 0). |
Source code in src/ltnjax/fuzzy_ops.py
sigmoid ¶
sigmoid(x: ArrayLike) -> Array
Computes sigmoid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ArrayLike | Array. | required |
Returns:
| Type | Description |
|---|---|
Array |
|