Skip to content

Commit

Permalink
fix: set all possible NAs to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
pekasen committed Dec 5, 2024
1 parent 98ae989 commit 1cc08b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spiderexpress/strategies/spikyball.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def calc_norm(source: pd.Series, edge: pd.Series, target: pd.Series) -> float:
float : the normalization constant
"""
return sum(source.fillna(1) * edge.fillna(1) * target.fillna(1))
if any(source.isna(), edge.isna(), target.isna()):
log.warning("Input contains NaN values which will be replaced with 1.")
norm_const = (source.fillna(1) * edge.fillna(1) * target.fillna(1)).fillna(1).sum()
return norm_const


def calc_prob(table: pd.DataFrame, params: ProbabilityConfiguration) -> pd.Series:
Expand Down

0 comments on commit 1cc08b3

Please sign in to comment.