Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dtype bug in combine-preds field lists #577

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix dtype bug in combine-preds field lists
  • Loading branch information
bfhealy committed Apr 9, 2024
commit 641314f031f4693e0f1518a49e077f42128fc19c
19 changes: 16 additions & 3 deletions tools/combine_preds.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,23 @@ def combine_preds(
os.makedirs(path_to_preds / combined_preds_dirname, exist_ok=True)

done_fields = [
str(x).split("/")[-1].split(".")[0]
int(str(x).split("/")[-1].split(".")[0].split("_")[1])
for x in (path_to_preds / combined_preds_dirname).glob("field_*.parquet")
]
fields_to_list = done_fields.copy()

if fields_to_exclude is not None:
fields_to_list.extend(fields_to_exclude)

fields_to_do = list(set(fields_dnn_dict).difference(done_fields))
fields_to_do = list(
set([int(x.split("_")[1]) for x in fields_dnn_dict.keys()]).difference(
fields_to_list
)
)
fields_to_list.extend(fields_to_do)

# Use set to drop duplicate fields before sorting
fields_to_list = list(set(fields_to_list))
fields_to_list.sort()

if save:
Expand All @@ -127,8 +133,15 @@ def combine_preds(
counter = 0
print(f"Processing {len(fields_to_do)} fields/files...")

import code

code.interact(local=locals())

# Reformat fields in field_N format to match filenames
listed_fields = [f"field_{x}" for x in fields_to_list]

for field in fields_dnn_dict.keys():
if field not in done_fields:
if field not in listed_fields:
if field in fields_xgb_dict.keys():
try:
dnn_preds = read_parquet(
Expand Down