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 for model-build failure due to presence of survey inputs as a dictionary #954

Merged
merged 4 commits into from
Feb 10, 2024
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@ def _generate_predictions(self):
probability is estimated with label_count / total_labels.
"""
for _, bin_record in self.bins.items():
user_label_df = pd.DataFrame(bin_record['labels'])
# TODO: Revisit after we have unified label and survey inputs (https://github.com/e-mission/e-mission-docs/issues/1045)
logging.debug("Filtering out any nested dictionaries from the list of dictionary labels")
filtered_label_dicts = [label_dict for label_dict in bin_record['labels'] if not any(isinstance(x, dict) for x in label_dict.values())]
logging.debug("Number of entries after filtering changed %s -> %s" % (len(bin_record['labels']), len(filtered_label_dicts)))
user_label_df = pd.DataFrame(filtered_label_dicts)
user_label_df = lp.map_labels(user_label_df).dropna()
# compute the sum of trips in this cluster
sum_trips = len(user_label_df)
Expand Down
Loading