Skip to content

Commit

Permalink
Changed secondary loss calculation (solves #43) (#44)
Browse files Browse the repository at this point in the history
Co-authored-by: arognoni <[email protected]>
  • Loading branch information
arognoni and HI-Italy authored Nov 25, 2024
1 parent 5d8d298 commit e460f03
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pyfair/model/model_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,8 @@ def generate_multi(self, prefixed_target, count, kwargs_dict):
s = pd.Series(data)
# Put in dict
df_dict[target][column] = s
# Multiply
df1, df2 = df_dict.values()
combined_df = df1 * df2
# Sum
summed = combined_df.sum(axis=1)
# Get partial secondary losses and sum up all the values
summed = np.sum(df.prod(axis=1) for df in df_dict.values())
# Record params
new_target = 'multi_' + final_target
self._supplied_values[new_target] = kwargs_dict
Expand Down

0 comments on commit e460f03

Please sign in to comment.