Skip to content

Commit

Permalink
fix duplicate for update batch
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorS67 committed Jun 17, 2022
1 parent 346d5f9 commit 8ce16b0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mooclet_engine/engine/utils/data_downloader_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def without_keys(d, keys):
if parameters and not policy_params and "update_record" in parameters:
record_df = pd.concat([record_df, pd.DataFrame(parameters["update_record"])])

update_datapoint_count = 0
for version_index, version_row in version_df.iterrows():
datapoint_dict = {
"study": version_row["study"],
Expand Down Expand Up @@ -210,7 +209,7 @@ def without_keys(d, keys):
reward_datapoint.update(context_datapoint)

# Check if reward is used for updating parameters
if update_datapoint_count < len(record_df.index):
if len(record_df.index) > 0:
# Get all checking conditions
check_update = record_df["user_id"] == version_row["learner_id"]
check_update &= record_df[reward_row["name"]] == reward_row["value"]
Expand All @@ -220,7 +219,7 @@ def without_keys(d, keys):
if len(record_df[check_update].index) != 0:
# We have a updating datapoint
reward_datapoint["update_group"] = update_group
update_datapoint_count += 1
record_df = record_df.iloc[1:, :].reset_index(drop=True)

reward_datapoint.update(datapoint_dict)

Expand Down

0 comments on commit 8ce16b0

Please sign in to comment.