OCDocker.OCScore.XGBoost.OCxgboost module

Module to run the Extreme Gradient Boost algorithm.

It is imported as:

import OCDocker.OCScore.XGBoost.OCxgboost as OCxgboost

OCDocker.OCScore.XGBoost.OCxgboost.run_xgboost(X_train, y_train, X_test, y_test, params=None, verbose=False)[source]

A function to train an XGBoost model and calculate the AUC score.

Parameters:
  • X_train (np.ndarray) – The training dataset.

  • y_train (np.ndarray) – The training labels.

  • X_test (np.ndarray) – The test dataset.

  • y_test (np.ndarray) – The test labels.

  • params (dict, optional) – The hyperparameters for the XGBoost model. Default is None (treated as an empty dictionary).

  • verbose (bool, optional) – Whether to print the training logs. Default is False.

Returns:

  • model (XGBRegressor) – The trained XGBoost model.

  • roc_auc (float) – The AUC score of the trained model.

Return type:

tuple[XGBRegressor, float]