{"action":"created","issue":{"url":"https://api.github.com/repos/dmlc/xgboost/issues/1264","repository_url":"https://api.github.com/repos/dmlc/xgboost","labels_url":"https://api.github.com/repos/dmlc/xgboost/issues/1264/labels{/name}","comments_url":"https://api.github.com/repos/dmlc/xgboost/issues/1264/comments","events_url":"https://api.github.com/repos/dmlc/xgboost/issues/1264/events","html_url":"https://github.com/dmlc/xgboost/pull/1264","id":159417021,"number":1264,"title":"[R-package] callbacks per #892","user":{"login":"khotilov","id":1613551,"avatar_url":"https://avatars.githubusercontent.com/u/1613551?v=3","gravatar_id":"","url":"https://api.github.com/users/khotilov","html_url":"https://github.com/khotilov","followers_url":"https://api.github.com/users/khotilov/followers","following_url":"https://api.github.com/users/khotilov/following{/other_user}","gists_url":"https://api.github.com/users/khotilov/gists{/gist_id}","starred_url":"https://api.github.com/users/khotilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khotilov/subscriptions","organizations_url":"https://api.github.com/users/khotilov/orgs","repos_url":"https://api.github.com/users/khotilov/repos","events_url":"https://api.github.com/users/khotilov/events{/privacy}","received_events_url":"https://api.github.com/users/khotilov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-06-09T14:08:02Z","updated_at":"2016-06-28T03:29:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dmlc/xgboost/pulls/1264","html_url":"https://github.com/dmlc/xgboost/pull/1264","diff_url":"https://github.com/dmlc/xgboost/pull/1264.diff","patch_url":"https://github.com/dmlc/xgboost/pull/1264.patch"},"body":"The majority of stuff is working, but some things are raw. The code docs would need some more work, and some changes in how things are handled might be needed (see below and also some TODO markers in the code). I'm pr-ing it mainly to get some feedback.\r\nNote that this coming weekend I would not be able to do any work on all this.\r\n\r\nWork notes:\r\n- Added the callbacks that are mostly similar as in python, plus the cb.save_model one. The 'cb.' prefix is purely for convenience when using the tab-completion, and I'm open to other naming suggestions. Some callbacks have a \"finalizer\" functionality.\r\n- Instead of the reset_learning_rates callback, added  a more general cb.reset_parameters\r\n- The cb.save_model callback uses save_period=0 to save the last model (the changed default save_period=NULL in xgb.train would not enable the saving). It also allows to include iteration number into the file name.\r\n- The cb.early_stop callback allows to set a specific metric column name to use. If it is not set, *the last* evaluation column is used. Choosing the last one is more natural, and python API does that too.\r\n- Added training continuation to xgb.train\r\n- Cleaning: making the training flow better structured, commented, with reusable blocks, and the code to be more R-ish\r\n- WARNING: return value change for the train and cv methods. My goal was to have a somewhat unified output interface among the two, that would also be what an R user would normally expect, which is a list of various output data items (as opposed to the previous part-list/part-attributes mix, or CV's output changing to a different structure when prediction in CV is required).\r\n- Changed iteration index to be consistently 1-indexed in R\r\n- Added formatted print methods for xgb.Booster and xgb.cv.result\r\n- Changed to use the roxygen-handled `useDynLib` library loading mechanism in place of doing it manually via onLoad/onUnload. That plays better with devtools.\r\n- Merged the documentation of xgboost and xgb.Booster to reduce the redundancy\r\n- Added extra examples to the docs of xgb.train and xgboost\r\n- Added bunch of additional unit tests\r\n\r\nList of some things and questions to consider:\r\n- predictions from CV: 0) leave them as they are 1) create a callback for that 2) return folds' models, and have a separate predict method to use with the cv-output object? I'm torn b/w #1 and #2.\r\n- It might make sense to ensure that the early stopping callback is the last\r\n- Why not to use the limit on number of iterations in `predict` instead on the number of trees?\r\n- I was using the style option of \"single statement after 'if' goes on a new line with no curly brackets\". I find that easier to read when there are many if-checks. But I can change it to the \"lots-of-{}\" style if you wish.\r\n- There is still a fair amount of parameter name style inconsistencies among the R package methods. Would it be a good time to make those consistent? Or even as close to python interface as makes sense? (can leave the old ones for some time with deprecation warning)\r\n- In addition to the current 'synchronous' CV method, I would like to add some time later a simple 'sequential' CV-wrapper for xgb.train, which would be better suited for the classic CV-based model evaluation. I'm mentioning it here because it might be done either as a separate strategy option within xgb.cv, or as a separate function (I prefer the latter). Since it might affect the current xgb.cv interface, I'm looking for some thoughts on that.\r\n"},"comment":{"url":"https://api.github.com/repos/dmlc/xgboost/issues/comments/228938929","html_url":"https://github.com/dmlc/xgboost/pull/1264#issuecomment-228938929","issue_url":"https://api.github.com/repos/dmlc/xgboost/issues/1264","id":228938929,"user":{"login":"hetong007","id":1289856,"avatar_url":"https://avatars.githubusercontent.com/u/1289856?v=3","gravatar_id":"","url":"https://api.github.com/users/hetong007","html_url":"https://github.com/hetong007","followers_url":"https://api.github.com/users/hetong007/followers","following_url":"https://api.github.com/users/hetong007/following{/other_user}","gists_url":"https://api.github.com/users/hetong007/gists{/gist_id}","starred_url":"https://api.github.com/users/hetong007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hetong007/subscriptions","organizations_url":"https://api.github.com/users/hetong007/orgs","repos_url":"https://api.github.com/users/hetong007/repos","events_url":"https://api.github.com/users/hetong007/events{/privacy}","received_events_url":"https://api.github.com/users/hetong007/received_events","type":"User","site_admin":false},"created_at":"2016-06-28T03:29:31Z","updated_at":"2016-06-28T03:29:31Z","body":"Hi @khotilov , thanks for the work! I am currently attending the useR! 2016 conference and busying with my slides :P \r\n\r\nWill review the code asap."}}
{"actor":{"display_login":"hetong007"}}