Perform the training with given parameters. Parameters ---------- params : dict Parameters for training. train_set : Dataset Data to be trained on. num_boost_round : int, optional (default=100) Number of boosting iterations. valid_sets : list of Datas
(params, train_set, num_boost_round=100,
valid_sets=None, valid_names=None,
fobj=None, feval=None, init_model=None,
feature_name='auto', categorical_feature='auto',
early_stopping_rounds=None, evals_result=None,
verbose_eval=True, learning_rates=None,
keep_training_booster=False, callbacks=None)
| 16 | |
| 17 | |
| 18 | def train(params, train_set, num_boost_round=100, |
| 19 | valid_sets=None, valid_names=None, |
| 20 | fobj=None, feval=None, init_model=None, |
| 21 | feature_name='auto', categorical_feature='auto', |
| 22 | early_stopping_rounds=None, evals_result=None, |
| 23 | verbose_eval=True, learning_rates=None, |
| 24 | keep_training_booster=False, callbacks=None): |
| 25 | """Perform the training with given parameters. |
| 26 | |
| 27 | Parameters |
| 28 | ---------- |
| 29 | params : dict |
| 30 | Parameters for training. |
| 31 | train_set : Dataset |
| 32 | Data to be trained on. |
| 33 | num_boost_round : int, optional (default=100) |
| 34 | Number of boosting iterations. |
| 35 | valid_sets : list of Datasets or None, optional (default=None) |
| 36 | List of data to be evaluated on during training. |
| 37 | valid_names : list of strings or None, optional (default=None) |
| 38 | Names of ``valid_sets``. |
| 39 | fobj : callable or None, optional (default=None) |
| 40 | Customized objective function. |
| 41 | Should accept two parameters: preds, train_data, |
| 42 | and return (grad, hess). |
| 43 | |
| 44 | preds : list or numpy 1-D array |
| 45 | The predicted values. |
| 46 | train_data : Dataset |
| 47 | The training dataset. |
| 48 | grad : list or numpy 1-D array |
| 49 | The value of the first order derivative (gradient) for each sample point. |
| 50 | hess : list or numpy 1-D array |
| 51 | The value of the second order derivative (Hessian) for each sample point. |
| 52 | |
| 53 | For multi-class task, the preds is group by class_id first, then group by row_id. |
| 54 | If you want to get i-th row preds in j-th class, the access way is score[j * num_data + i] |
| 55 | and you should group grad and hess in this way as well. |
| 56 | |
| 57 | feval : callable or None, optional (default=None) |
| 58 | Customized evaluation function. |
| 59 | Should accept two parameters: preds, train_data, |
| 60 | and return (eval_name, eval_result, is_higher_better) or list of such tuples. |
| 61 | |
| 62 | preds : list or numpy 1-D array |
| 63 | The predicted values. |
| 64 | train_data : Dataset |
| 65 | The training dataset. |
| 66 | eval_name : string |
| 67 | The name of evaluation function (without whitespaces). |
| 68 | eval_result : float |
| 69 | The eval result. |
| 70 | is_higher_better : bool |
| 71 | Is eval result higher better, e.g. AUC is ``is_higher_better``. |
| 72 | |
| 73 | For multi-class task, the preds is group by class_id first, then group by row_id. |
| 74 | If you want to get i-th row preds in j-th class, the access way is preds[j * num_data + i]. |
| 75 | To ignore the default metric corresponding to the used objective, |
no test coverage detected