Perform the training with given parameters.
params (dict) – Parameters for training. Values passed through params
take precedence over those supplied via arguments.
train_set (Dataset) – Data to be trained on.
num_boost_round (int, optional (default=100)) – Number of boosting iterations.
valid_sets (list of Dataset, or None, optional (default=None)) – List of data to be evaluated on during training.
valid_names (list of str, or None, optional (default=None)) – Names of valid_sets
.
feval (callable, list of callable, or None, optional (default=None)) –
Customized evaluation function. Each evaluation function should accept two parameters: preds, eval_data, and return (eval_name, eval_result, is_higher_better) or list of such tuples.
- predsnumpy 1-D array or numpy 2-D array (for multi-class task)
The predicted values. For multi-class task, preds are numpy 2-D array of shape = [n_samples, n_classes]. If custom objective function is used, predicted values are returned before any transformation, e.g. they are raw margin instead of probability of positive class for binary task in this case.
- eval_dataDataset
A
Dataset
to evaluate.- eval_namestr
The name of evaluation function (without whitespaces).
- eval_resultfloat
The eval result.
- is_higher_betterbool
Is eval result higher better, e.g. AUC is
is_higher_better
.
To ignore the default metric corresponding to the used objective, set the metric
parameter to the string "None"
in params
.
init_model (str, pathlib.Path, Booster or None, optional (default=None)) – Filename of LightGBM model or Booster instance used for continue training.
keep_training_booster (bool, optional (default=False)) – Whether the returned Booster will be used to keep training. If False, the returned value will be converted into _InnerPredictor before returning. This means you won’t be able to use eval
, eval_train
or eval_valid
methods of the returned Booster. When your model is very large and cause the memory error, you can try to set this param to True
to avoid the model conversion performed during the internal call of model_to_string
. You can still use _InnerPredictor as init_model
for future continue training.
callbacks (list of callable, or None, optional (default=None)) – List of callback functions that are applied at each iteration. See Callbacks in Python API for more information.
Note
A custom objective function can be provided for the objective
parameter. It should accept two parameters: preds, train_data and return (grad, hess).
- predsnumpy 1-D array or numpy 2-D array (for multi-class task)
The predicted values. Predicted values are returned before any transformation, e.g. they are raw margin instead of probability of positive class for binary task.
- train_dataDataset
The training dataset.
- gradnumpy 1-D array or numpy 2-D array (for multi-class task)
The value of the first order derivative (gradient) of the loss with respect to the elements of preds for each sample point.
- hessnumpy 1-D array or numpy 2-D array (for multi-class task)
The value of the second order derivative (Hessian) of the loss with respect to the elements of preds for each sample point.
For multi-class task, preds are numpy 2-D array of shape = [n_samples, n_classes], and grad and hess should be returned in the same format.
booster – The trained Booster model.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4