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

UnboundLocalError: local variable 'V' referenced before assignment #1579

Open
camferna opened this issue Nov 23, 2023 · 0 comments
Open

UnboundLocalError: local variable 'V' referenced before assignment #1579

camferna opened this issue Nov 23, 2023 · 0 comments

Comments

@camferna
Copy link

camferna commented Nov 23, 2023

Hello !

I am trying to fit AalenAdditiveFitter using sklearn_adapter function.

I am reading the dataset from a pol file:

df_trn = pd.read_pickle(f"df_trn_one_10.pkl")
df_trn.reset_index(drop = True, inplace = True)

Then, I tried two ways to set X_trn and y_trn:

  1. Straightforward using the pandas DataFrame

X_trn, y_trn = [df_trn.drop(columns = ['Employee Id','time']), df_trn['time']]

  1. Through the SMOTE resample which also gives me a pandas DataFrame

X_res_trn, y_res_trn = SMOTE().fit_resample( df_trn.drop(columns=["Employee Id",'time']), df_trn["time"] )

However, it only works with the second option, and I would like to fit AalenAdditiveFitter without resampling. I do not see the difference between the outputs of both options except for the extra number of individuals in the second one.

When I fit AalenAdditiveFitter with the first X_trn, y_trn I do:

AalenAdditiveRegression = sklearn_adapter(AalenAdditiveFitter, event_col='TargetAttrition')
ska_aaf = AalenAdditiveRegression()
ska_aaf.fit(X_trn, y_trn)

And I have the following error:

UnboundLocalError: local variable 'V' referenced before assignment

why does this happen?

Thank you in advance and have a nice day!

Camila F

@camferna camferna changed the title UnboundLocalError: local variable 'V' referenced before assigment UnboundLocalError: local variable 'V' referenced before assignment Nov 23, 2023
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

No branches or pull requests

1 participant