AutoViML / Auto_ViML

Automatically Build Multiple ML Models with a Single Line of Code. Created by Ram Seshadri. Collaborators Welcome. Permission Granted upon Request.
Apache License 2.0
518 stars 101 forks source link

UnboundLocalError: local variable 'missing_cols' referenced before assignment` #17

Closed r0bb23 closed 4 years ago

r0bb23 commented 4 years ago

I'm getting the following error:

`Filling missing values with "missing" placeholder and adding a column for missing_flags

UnboundLocalError Traceback (most recent call last)

in 12 Stacking_Flag=False, 13 Imbalanced_Flag=True, ---> 14 verbose=2, 15 ) /sas_cambrian/Projects/hamilton_attrib_276597/rxb427/python3_env/lib/python3.6/site-packages/autoviml/Auto_ViML.py in Auto_ViML(train, target, test, sample_submission, hyper_param, feature_reduction, scoring_parameter, Boosting_Flag, KMeans_Featurizer, Add_Poly, Stacking_Flag, Binning_Flag, Imbalanced_Flag, verbose) 754 preds.append(new_missing_col) 755 missing_flag_cols.append(new_missing_col) --> 756 elif f in missing_cols: 757 #### YOu have to do nothing for missing column yet. Leave them as is for Iterative Imputer later ############## 758 continue UnboundLocalError: local variable 'missing_cols' referenced before assignment` I didn't have time to dig too deep in the code. But it does appear the missing_cols gets defined in an if statement that appears to be checking if the test dataset exist before it runs. So it appears there is a way that you can get to the 756 check without providing a test dataset. So either the defining of the missing_cols needs to change or you need to fix the logical error that allows the `f in missing_cols` check. You could also just get rid of that check since it doesn't do anything right now.
AutoViML commented 4 years ago

Robert I remember fixing this problem a few weeks ago. Are you sure you are using the latest version? Can you please do a pip install autoviml —upgrade

Or can you please print the version number that you see on your screen when you import AutoViML?

Thanks much Ram

On Fri, Jul 24, 2020 at 3:36 PM Robert B Beatty notifications@github.com wrote:

I'm getting the following error: `Filling missing values with "missing" placeholder and adding a column for missing_flags

UnboundLocalError Traceback (most recent call last) in 12 Stacking_Flag=False, 13 Imbalanced_Flag=True, ---> 14 verbose=2, 15 )

/sas_cambrian/Projects/hamilton_attrib_276597/rxb427/python3_env/lib/python3.6/site-packages/autoviml/Auto_ViML.py in Auto_ViML(train, target, test, sample_submission, hyper_param, feature_reduction, scoring_parameter, Boosting_Flag, KMeans_Featurizer, Add_Poly, Stacking_Flag, Binning_Flag, Imbalanced_Flag, verbose) 754 preds.append(new_missing_col) 755 missing_flag_cols.append(new_missing_col) --> 756 elif f in missing_cols: 757 #### YOu have to do nothing for missing column yet. Leave them as is for Iterative Imputer later ############## 758 continue

UnboundLocalError: local variable 'missing_cols' referenced before assignment`

I didn't have time to dig too deep in the code. But it does appear the missing_cols gets defined in an if statement that appears to be checking if the test dataset exist before it runs. So it appears there is a way that you can get to the 756 check without providing a test dataset.

So either the defining of the missing_cols needs to change or you need to fix the logical error that allows the f in missing_cols check. You could also just get rid of that check since it doesn't do anything right now.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AutoViML/Auto_ViML/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMKBH6AYCV6MLB6BML26M6DR5HPCFANCNFSM4PHAIBPQ .

r0bb23 commented 4 years ago

Version = 0.1.660

AutoViML commented 4 years ago

I have fixed this and uploading it right now. Should be in version 0.1.662

Please download it or upgrade to it and confirm

pip install autoviml --upgrade --ignore-installed

Is one way to do the upgrade. Thanks for your patience.