Skip to content

Commit 9a5e7a0

Browse files
committed
fix(fuzzy_overlay): fix sum overlay and sum term in gamma overlay
1 parent f1b9c0c commit 9a5e7a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

eis_toolkit/prediction/fuzzy_overlay.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def sum_overlay(data: Union[Sequence[np.ndarray], np.ndarray]) -> np.ndarray:
9494
InvalidParameterValueException: If data values are not in range [0, 1].
9595
"""
9696
data = _prepare_data_for_fuzzy_overlay(data)
97-
return data.sum(axis=0) - np.prod(data, axis=0)
97+
return 1 - np.prod(1 - data, axis=0)
9898

9999

100100
@beartype
@@ -121,5 +121,5 @@ def gamma_overlay(data: Union[Sequence[np.ndarray], np.ndarray], gamma: float =
121121
raise InvalidParameterValueException("The gamma parameter must be in range [0, 1]")
122122

123123
product = np.prod(data, axis=0)
124-
sum = data.sum(axis=0) - product
124+
sum = 1 - np.prod(1 - data, axis=0)
125125
return product ** (1 - gamma) * sum**gamma

0 commit comments

Comments
 (0)