Skip to content

Commit

Permalink
fix(fuzzy_overlay): fix sum overlay and sum term in gamma overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaarnio committed Apr 28, 2024
1 parent f1b9c0c commit 9a5e7a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eis_toolkit/prediction/fuzzy_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def sum_overlay(data: Union[Sequence[np.ndarray], np.ndarray]) -> np.ndarray:
InvalidParameterValueException: If data values are not in range [0, 1].
"""
data = _prepare_data_for_fuzzy_overlay(data)
return data.sum(axis=0) - np.prod(data, axis=0)
return 1 - np.prod(1 - data, axis=0)


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

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

0 comments on commit 9a5e7a0

Please sign in to comment.