MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / train

Function train

python-package/lightgbmmt/engine.py:18–273  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

16
17
18def 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,

Callers 1

fitMethod · 0.85

Calls 15

set_train_data_nameMethod · 0.95
add_validMethod · 0.95
updateMethod · 0.95
eval_trainMethod · 0.95
eval_validMethod · 0.95
model_from_stringMethod · 0.95
model_to_stringMethod · 0.95
_InnerPredictorClass · 0.85
popMethod · 0.80
formatMethod · 0.80
_to_predictorMethod · 0.80

Tested by

no test coverage detected