dask_ml.xgboost.XGBRegressor

class dask_ml.xgboost.XGBRegressor(max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective='reg:linear', booster='gbtree', n_jobs=1, nthread=None, gamma=0, min_child_weight=1, max_delta_step=0, subsample=1, colsample_bytree=1, colsample_bylevel=1, reg_alpha=0, reg_lambda=1, scale_pos_weight=1, base_score=0.5, random_state=0, seed=None, missing=None, **kwargs)
Attributes:
feature_importances_

Returns

Methods

apply(X[, ntree_limit]) Return the predicted leaf every tree for each sample.
evals_result() Return the evaluation results.
fit(X[, y]) Fit the gradient boosting model
get_booster() Get the underlying xgboost Booster of this model.
get_params([deep]) Get parameters.
get_xgb_params() Get xgboost type parameters.
load_model(fname) Load the model from a file.
save_model(fname) Save the model to a file.
score(X, y[, sample_weight]) Returns the coefficient of determination R^2 of the prediction.
set_params(**params) Set the parameters of this estimator.
predict  
__init__(max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective='reg:linear', booster='gbtree', n_jobs=1, nthread=None, gamma=0, min_child_weight=1, max_delta_step=0, subsample=1, colsample_bytree=1, colsample_bylevel=1, reg_alpha=0, reg_lambda=1, scale_pos_weight=1, base_score=0.5, random_state=0, seed=None, missing=None, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

apply(X, ntree_limit=0)

Return the predicted leaf every tree for each sample.

Parameters:
X : array_like, shape=[n_samples, n_features]

Input features matrix.

ntree_limit : int

Limit number of trees in the prediction; defaults to 0 (use all trees).

Returns:
X_leaves : array_like, shape=[n_samples, n_trees]

For each datapoint x in X and for each tree, return the index of the leaf x ends up in. Leaves are numbered within [0; 2**(self.max_depth+1)), possibly with gaps in the numbering.

evals_result()

Return the evaluation results.

If eval_set is passed to the fit function, you can call evals_result() to get evaluation results for all passed eval_sets. When eval_metric is also passed to the fit function, the evals_result will contain the eval_metrics passed to the fit function

Returns:
evals_result : dictionary
feature_importances_
Returns:
feature_importances_ : array of shape = [n_features]
fit(X, y=None)

Fit the gradient boosting model

Parameters:
X : array-like [n_samples, n_features]
y : array-like
Returns:
self : the fitted Regressor

Notes

This differs from the XGBoost version not supporting the eval_set, eval_metric, early_stopping_rounds and verbose fit kwargs.

get_booster()

Get the underlying xgboost Booster of this model.

This will raise an exception when fit was not called

Returns:
booster : a xgboost booster of underlying model
get_params(deep=False)

Get parameters.

get_xgb_params()

Get xgboost type parameters.

load_model(fname)

Load the model from a file. Parameters ———- fname : string or a memory buffer

Input file name or memory buffer(see also save_raw)
save_model(fname)

Save the model to a file. Parameters ———- fname : string

Output file name
score(X, y, sample_weight=None)

Returns the coefficient of determination R^2 of the prediction.

The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.

Parameters:
X : array-like, shape = (n_samples, n_features)

Test samples. For some estimators this may be a precomputed kernel matrix instead, shape = (n_samples, n_samples_fitted], where n_samples_fitted is the number of samples used in the fitting for the estimator.

y : array-like, shape = (n_samples) or (n_samples, n_outputs)

True values for X.

sample_weight : array-like, shape = [n_samples], optional

Sample weights.

Returns:
score : float

R^2 of self.predict(X) wrt. y.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
self