{"action":"created","issue":{"url":"https://api.github.com/repos/dnouri/skorch/issues/180","repository_url":"https://api.github.com/repos/dnouri/skorch","labels_url":"https://api.github.com/repos/dnouri/skorch/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/dnouri/skorch/issues/180/comments","events_url":"https://api.github.com/repos/dnouri/skorch/issues/180/events","html_url":"https://github.com/dnouri/skorch/pull/180","id":314341372,"number":180,"title":"ENH: Adds CyclicLR","user":{"login":"thomasjpfan","id":5402633,"avatar_url":"https://avatars2.githubusercontent.com/u/5402633?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasjpfan","html_url":"https://github.com/thomasjpfan","followers_url":"https://api.github.com/users/thomasjpfan/followers","following_url":"https://api.github.com/users/thomasjpfan/following{/other_user}","gists_url":"https://api.github.com/users/thomasjpfan/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasjpfan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasjpfan/subscriptions","organizations_url":"https://api.github.com/users/thomasjpfan/orgs","repos_url":"https://api.github.com/users/thomasjpfan/repos","events_url":"https://api.github.com/users/thomasjpfan/events{/privacy}","received_events_url":"https://api.github.com/users/thomasjpfan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-14T16:18:17Z","updated_at":"2018-04-17T18:29:48Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/dnouri/skorch/pulls/180","html_url":"https://github.com/dnouri/skorch/pull/180","diff_url":"https://github.com/dnouri/skorch/pull/180.diff","patch_url":"https://github.com/dnouri/skorch/pull/180.patch"},"body":"Closes https://github.com/dnouri/skorch/issues/168.\r\n\r\n1. Adds `on_batch_begin` to `LRScheduler` to step through `CyclicLR`. This uses `len(net.history[-1, 'batches'])` to get the batch index for the current epoch. Once there are more than one epoch, the total number of batches per epoch is obtained by `len(net.history[-2, 'batches'])` . \r\n2. `CyclicLR` is a subclass of `_LRScheduler` which allows for `LRScheduler(CyclicLR)`.\r\n3. Tests were refactored a little to use `@pytest.mark.parametrize`. Additional tests were added to confirm that `LRScheduler` is calling `step` or `batch_step`  the expected number of times."},"comment":{"url":"https://api.github.com/repos/dnouri/skorch/issues/comments/382095479","html_url":"https://github.com/dnouri/skorch/pull/180#issuecomment-382095479","issue_url":"https://api.github.com/repos/dnouri/skorch/issues/180","id":382095479,"user":{"login":"thomasjpfan","id":5402633,"avatar_url":"https://avatars2.githubusercontent.com/u/5402633?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasjpfan","html_url":"https://github.com/thomasjpfan","followers_url":"https://api.github.com/users/thomasjpfan/followers","following_url":"https://api.github.com/users/thomasjpfan/following{/other_user}","gists_url":"https://api.github.com/users/thomasjpfan/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasjpfan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasjpfan/subscriptions","organizations_url":"https://api.github.com/users/thomasjpfan/orgs","repos_url":"https://api.github.com/users/thomasjpfan/repos","events_url":"https://api.github.com/users/thomasjpfan/events{/privacy}","received_events_url":"https://api.github.com/users/thomasjpfan/received_events","type":"User","site_admin":false},"created_at":"2018-04-17T18:29:48Z","updated_at":"2018-04-17T18:29:48Z","author_association":"CONTRIBUTOR","body":"There are two places where `_LRScheduler` stores state:\r\n\r\n1. It uses last_epoch to remember the last epoch. `LRscheduler` avoids using this internal state by always passing in the current epoch to the `step` function.\r\n\r\n2. It stores `initial_lr` in `optimizer.param_groups`, this must be done once when the `last_epoch` parameter is -1. My latest updates uses `net.history` to get this information and passes it along.\r\n\r\nAll other parameters are stored in `LRScheduler`'s kwargs which works with `set_params`. With the latest updates, I think leaving the initialization in `on_train_begin` is okay, and we won't need change the `callback.initialize` interface.\r\n\r\nI made a few more additional tweaks:\r\n\r\n1. The accuracy score in `test_net_learns` went to 0.693 so I lowered the test from 0.7 to 0.65. The `test_net.py` tests does not use LRScheduler, so this was a bit strange.\r\n2. I converted `CyclicLR` to not be a subclass of `_LRScheduler` just like how `ReduceLROnPlateau` is not a subclass. A user would have to pass in the strings: \"CyclicLR\" or \"ReduceLROnPlateau\" to `LRScheduler` to use them."}}
{"actor":{"display_login":"thomasjpfan"}}