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

auto_scaler=False error #44

Open
zys133 opened this issue Sep 8, 2021 · 0 comments
Open

auto_scaler=False error #44

zys133 opened this issue Sep 8, 2021 · 0 comments

Comments

@zys133
Copy link

zys133 commented Sep 8, 2021

Hi, there is a bug when we turn off the auto_scaler.

Sample code:
coxph = NonLinearCoxPHModel(auto_scaler=False)
coxph.fit(feature_train, time_train, event_train)

Error:

UnboundLocalError Traceback (most recent call last)
in
1 coxph = NonLinearCoxPHModel(auto_scaler=False)
----> 2 coxph.fit(feature_train, time_train, event_train)

/opt/conda/lib/python3.7/site-packages/pysurvival/models/semi_parametric.py in fit(self, X, T, E, init_method, optimizer, lr, num_epochs, dropout, batch_normalization, bn_and_dropout, l2_reg, verbose)
608 T = T[order]
609 E = E[order]
--> 610 X_original = X_original[order, :]
611 self.times = np.unique(T[E.astype(bool)])
612 self.nb_times = len(self.times)

UnboundLocalError: local variable 'X_original' referenced before assignment


def __init__(self, structure=None, auto_scaler = True):

fix suggestion (starting from line 602):

    # Scaling data
    if self.auto_scaler:
        X_original = self.scaler.fit_transform( X )
    else:
        X_original = X
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