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

GaussianCopula get_learned_distributions crashes if nothing was learned #2339

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

R-Palazzo
Copy link
Contributor

CU-86b2w3hf2
Resolve #2297

@R-Palazzo R-Palazzo self-assigned this Jan 9, 2025
@sdv-team
Copy link
Contributor

sdv-team commented Jan 9, 2025

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.58%. Comparing base (7384de0) to head (a36d7b5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2339      +/-   ##
==========================================
+ Coverage   98.57%   98.58%   +0.01%     
==========================================
  Files          58       58              
  Lines        6095     6099       +4     
==========================================
+ Hits         6008     6013       +5     
+ Misses         87       86       -1     
Flag Coverage Δ
integration 82.14% <20.00%> (-0.03%) ⬇️
unit 97.42% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@lajohn4747 lajohn4747 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@R-Palazzo R-Palazzo force-pushed the issue-2297-get_learned_distributions branch from e31f325 to 482cc97 Compare January 10, 2025 09:16
Comment on lines 219 to 220
if self._model is None:
return {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is the more future proof version, reason being that if we update self._model to be initialized earlier, but to_dict is empty, we will return the empty {} otherwise it will crash when accessing parameters['columns'] on an empty dict:

Suggested change
if self._model is None:
return {}
if not hasattr(self._model, 'to_dict') or not self._model.to_dict():
return {}

@R-Palazzo R-Palazzo merged commit 6b47f9d into main Jan 13, 2025
41 checks passed
@R-Palazzo R-Palazzo deleted the issue-2297-get_learned_distributions branch January 13, 2025 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GaussianCopula get_learned_distributions crashes if nothing was learned
4 participants