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

How to use get_best_lr method? #25

Open
amitjslearn opened this issue Dec 13, 2019 · 1 comment
Open

How to use get_best_lr method? #25

amitjslearn opened this issue Dec 13, 2019 · 1 comment

Comments

@amitjslearn
Copy link

How to use get_best_lr method from the class LRFinder
I tried

lr_finder.get_best_lr(sma=20)

I got the following error.

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-28-407ca9d54a8d> in <module>
----> 1 lr_finder.get_best_lr(sma=20)

/kaggle/usr/lib/keras_lr_finder/keras_lr_finder.py in get_best_lr(self, sma, n_skip_beginning, n_skip_end)
    164     def get_best_lr(self, sma, n_skip_beginning=10, n_skip_end=5):
    165         derivatives = self.get_derivatives(sma)
--> 166         best_der_idx = np.argmax(derivatives[n_skip_beginning:-n_skip_end])[0]
    167         return self.lrs[n_skip_beginning:-n_skip_end][best_der_idx]

IndexError: invalid index to scalar variable.
@amitjslearn
Copy link
Author

Does removing [0] from the this line best_der_idx = np.argmax(derivatives[n_skip_beginning:-n_skip_end])[0] from get_best_lr method work? I tried and I didn't get any errors. Will it still return the best learning rate?

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