3Provides an extensible and optimized framework to compute T-norms
7from abc
import ABC, abstractmethod
11 Abstract base class for all T-norms.
13 Provides a standard interface for pairwise and reduction operations.
18 def __call__(self, a: np.ndarray, b: np.ndarray) -> np.ndarray:
20 Apply the T-norm to two arrays element-wise.
22 @param a: First input array.
23 @param b: Second input array.
24 @return: Element-wise result of the T-norm.
29 def reduce(self, arr: np.ndarray) -> np.ndarray:
31 Reduce a single array using the T-norm.
33 @param arr: Array of shape (n_samples, n_samples).
34 @return: Reduced value for each row/column on axis=1.
41 Minimum T-norm: min(a, b)
44 def __call__(self, a: np.ndarray, b: np.ndarray) -> np.ndarray:
45 return np.minimum(a, b)
47 def reduce(self, arr: np.ndarray) -> np.ndarray:
48 return np.min(arr, axis=0)
56 def __call__(self, a: np.ndarray, b: np.ndarray) -> np.ndarray:
59 def reduce(self, arr: np.ndarray) -> np.ndarray:
60 return np.prod(arr, axis=0)
66 Łukasiewicz T-norm: max(0, a + b - 1)
69 def __call__(self, a: np.ndarray, b: np.ndarray) -> np.ndarray:
70 return np.maximum(0.0, a + b - 1.0)
72 def reduce(self, arr: np.ndarray) -> np.ndarray:
75 result = max(0.0, result + x - 1.0)
np.ndarray reduce(self, np.ndarray arr)
np.ndarray __call__(self, np.ndarray a, np.ndarray b)
np.ndarray reduce(self, np.ndarray arr)
np.ndarray __call__(self, np.ndarray a, np.ndarray b)
np.ndarray reduce(self, np.ndarray arr)
np.ndarray __call__(self, np.ndarray a, np.ndarray b)
np.ndarray reduce(self, np.ndarray arr)
np.ndarray __call__(self, np.ndarray a, np.ndarray b)