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

Error calling partial_plot with UnboundLocalError: local variable 'weight_column' referenced before assignment #16584

Open
arunaryasomayajula opened this issue Mar 5, 2025 · 0 comments
Labels
bug cust-statefarm reporter-support Reported as a support issue by cuetomer

Comments

@arunaryasomayajula
Copy link

H2O version, Operating System and Environment
3.46.0.6

Actual behavior
The method parameter is named weights_column (with an "s"), but the code seems to be erroneously referencing weight_column (without the "s"). This typo causes an UnboundLocalError because weight_column is never assigned. The suspect code is located on this line:
if isinstance(weight_column, int) and not (weight_column == -1):

We should really fix this on our side so we need to ask Engg Team to resolve this, if they haven't done so already on the latest version.
In the meantime, we could ask Sateesh to use a temporary workaround on his side code is to call the function with the 's' in place.

Use the correct parameter name "weights_column" when calling partial_plot

model.partial_plot(..., weights_column="your_column_name")

In regard to Sateesh statement that...

Shouldn’t the partial_plot function check if weight is None like it does for parameter “col_pairs_2dpdp”?

He is correct. Our side code does not have a proactive guard clause on it that our Engg Team needs to include. Something like this, like what “col_pairs_2dpdp” has:

Current problematic code, change this...

if isinstance(weights_column, int) and not (weights_column == -1):

# ...

To this improved code:

if weights_column is not None:
if isinstance(weights_column, int) and weights_column != -1:
...

Expected behavior
The partial_plot should take "weights_column" as input.

Steps to reproduce
Steps to reproduce the behavior (with working code on a sample dataset, if possible):

  1. Do this
  2. Do that
  3. Do something else
  4. See error

Upload logs
If you can, please upload the H2O logs. More information on how to do that is available here, or you can use the h2o.downloadAllLogs() in R or the h2o.download_all_logs() function in Python.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@arunaryasomayajula arunaryasomayajula added bug cust-statefarm reporter-support Reported as a support issue by cuetomer labels Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cust-statefarm reporter-support Reported as a support issue by cuetomer
Projects
None yet
Development

No branches or pull requests

1 participant