Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
xgboost.sklearn Namespace Reference

Data Structures

class  XGBClassifier
 
class  XGBModel
 
class  XGBRanker
 
class  XGBRankerMixIn
 
class  XGBRegressor
 
class  XGBRFClassifier
 
class  XGBRFRegressor
 

Functions

None _check_rf_callback (Optional[int] early_stopping_rounds, Optional[Sequence[TrainingCallback]] callbacks)
 
bool _can_use_qdm (Optional[str] tree_method)
 
Objective _objective_decorator (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]] func)
 
Metric _metric_decorator (Callable func)
 
Metric ltr_metric_decorator (Callable func, Optional[int] n_jobs)
 
Callable[[Type], Type] xgboost_model_doc (str header, List[str] items, Optional[str] extra_parameters=None, Optional[str] end_note=None)
 
Tuple[Any, List[Tuple[Any, str]]] _wrap_evaluation_matrices (float missing, Any X, Any y, Optional[Any] group, Optional[Any] qid, Optional[Any] sample_weight, Optional[Any] base_margin, Optional[Any] feature_weights, Optional[Sequence[Tuple[Any, Any]]] eval_set, Optional[Sequence[Any]] sample_weight_eval_set, Optional[Sequence[Any]] base_margin_eval_set, Optional[Sequence[Any]] eval_group, Optional[Sequence[Any]] eval_qid, Callable create_dmatrix, bool enable_categorical, Optional[FeatureTypes] feature_types)
 
PredtT _cls_predict_proba (int n_classes, PredtT prediction, Callable vstack)
 
Tuple[ArrayLike, Optional[ArrayLike]] _get_qid (ArrayLike X, Optional[ArrayLike] qid)
 

Variables

 SklObjective
 
int DEFAULT_N_ESTIMATORS = 100
 
 PredtT = TypeVar("PredtT", bound=np.ndarray)
 

Detailed Description

Scikit-Learn Wrapper interface for XGBoost.

Function Documentation

◆ _get_qid()

Tuple[ArrayLike, Optional[ArrayLike]] xgboost.sklearn._get_qid ( ArrayLike  X,
Optional[ArrayLike]   qid 
)
protected
Get the special qid column from X if exists.

◆ _metric_decorator()

Metric xgboost.sklearn._metric_decorator ( Callable  func)
protected
Decorate a metric function from sklearn.

Converts an metric function that uses the typical sklearn metric signature so that
it is compatible with :py:func:`train`

◆ _objective_decorator()

Objective xgboost.sklearn._objective_decorator ( Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]   func)
protected
Decorate an objective function

Converts an objective function using the typical sklearn metrics
signature so that it is usable with ``xgboost.training.train``

Parameters
----------
func:
    Expects a callable with signature ``func(y_true, y_pred)``:

    y_true: array_like of shape [n_samples]
        The target values
    y_pred: array_like of shape [n_samples]
        The predicted values

Returns
-------
new_func:
    The new objective function as expected by ``xgboost.training.train``.
    The signature is ``new_func(preds, dmatrix)``:

    preds: array_like, shape [n_samples]
        The predicted values
    dmatrix: ``DMatrix``
        The training set from which the labels will be extracted using
        ``dmatrix.get_label()``

◆ _wrap_evaluation_matrices()

Tuple[Any, List[Tuple[Any, str]]] xgboost.sklearn._wrap_evaluation_matrices ( float  missing,
Any  X,
Any  y,
Optional[Any]  group,
Optional[Any]  qid,
Optional[Any]  sample_weight,
Optional[Any]  base_margin,
Optional[Any]  feature_weights,
Optional[Sequence[Tuple[Any, Any]]]  eval_set,
Optional[Sequence[Any]]  sample_weight_eval_set,
Optional[Sequence[Any]]  base_margin_eval_set,
Optional[Sequence[Any]]  eval_group,
Optional[Sequence[Any]]  eval_qid,
Callable  create_dmatrix,
bool  enable_categorical,
Optional[FeatureTypes]  feature_types 
)
protected
Convert array_like evaluation matrices into DMatrix.  Perform validation on the
way.

◆ ltr_metric_decorator()

Metric xgboost.sklearn.ltr_metric_decorator ( Callable  func,
Optional[int]  n_jobs 
)
Decorate a learning to rank metric.

◆ xgboost_model_doc()

Callable[[Type], Type] xgboost.sklearn.xgboost_model_doc ( str  header,
List[str]  items,
Optional[str]   extra_parameters = None,
Optional[str]   end_note = None 
)
Obtain documentation for Scikit-Learn wrappers

Parameters
----------
header: str
   An introducion to the class.
items : list
   A list of common doc items.  Available items are:
     - estimators: the meaning of n_estimators
     - model: All the other parameters
     - objective: note for customized objective
extra_parameters: str
   Document for class specific parameters, placed at the head.
end_note: str
   Extra notes put to the end.

Variable Documentation

◆ SklObjective

xgboost.sklearn.SklObjective
Initial value:
1= Optional[
2 Union[str, Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]]
3]