Repository Analysis

dmlc/xgboost

Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow

5.9 Low AI signal View on GitHub
5.9
Adjusted Score
5.9
Raw Score
100%
Time Factor
2026-05-28
Last Push
28,431
Stars
C++
Language
144,281
Lines of Code
766
Files
751
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 4HIGH 5MEDIUM 16LOW 726

Pattern Findings

751 matches across 14 categories. Click a row to expand file-level details.

Over-Commented Block319 hits · 299 pts
SeverityFileLineSnippet
LOWdemo/kaggle-higgs/speedtest.R41 nrounds <- 120
LOWdemo/kaggle-higgs/speedtest.R61# 111.682 0.777 35.963
LOWdemo/guide-python/generalized_linear_model.py21# alpha is the L1 regularizer
LOWR-package/R/xgb.DMatrix.save.R1#' Save xgb.DMatrix object to binary file
LOWR-package/R/xgb.plot.multi.trees.R1#' Project all trees on one tree
LOWR-package/R/xgb.plot.multi.trees.R21#'
LOWR-package/R/xgb.plot.multi.trees.R41#' nrounds = 30,
LOWR-package/R/xgb.plot.deepness.R1#' Plot model tree depth
LOWR-package/R/xgb.plot.deepness.R21#' Those could be helpful in determining sensible ranges of the `max_depth`
LOWR-package/R/xgb.plot.deepness.R41#'
LOWR-package/R/xgb.plot.deepness.R61#' xgb.plot.deepness(model)
LOWR-package/R/utils.R381
LOWR-package/R/utils.R421#' for objects produced by [xgboost()]), outside of its core components, might also keep:
LOWR-package/R/utils.R441#' not used for prediction / importance / plotting / etc.
LOWR-package/R/utils.R461#' preferred for long-term storage.
LOWR-package/R/utils.R481#'
LOWR-package/R/utils.R501#' xgb.save(bst, fname)
LOWR-package/R/utils.R521#' obj2 <- readRDS(fname)
LOWR-package/R/utils.R541#' that code calling xgboost will still work once those are removed in future releases.
LOWR-package/R/xgb.plot.importance.R1#' Plot feature importance
LOWR-package/R/xgb.plot.importance.R21#'
LOWR-package/R/xgb.plot.importance.R41#' - `xgb.ggplot.importance()`: A customizable "ggplot" object.
LOWR-package/R/xgb.plot.importance.R61#' xgb.plot.importance(
LOWR-package/R/xgb.plot.importance.R141# Avoid error messages during CRAN check.
LOWR-package/R/xgb.save.raw.R1#' Save XGBoost model to R's raw vector
LOWR-package/R/xgb.save.raw.R21#' train <- agaricus.train
LOWR-package/R/xgb.plot.shap.R1#' SHAP dependence plots
LOWR-package/R/xgb.plot.shap.R21#' The default (`NULL`) will use up to 100k data points.
LOWR-package/R/xgb.plot.shap.R41#' If `FALSE`, only a list of matrices is returned.
LOWR-package/R/xgb.plot.shap.R61#' a meaningful thing to do.
LOWR-package/R/xgb.plot.shap.R81#' data.table::setDTthreads(nthread)
LOWR-package/R/xgb.plot.shap.R101#'
LOWR-package/R/xgb.plot.shap.R121#' model = model_multiclass,
LOWR-package/R/xgb.plot.shap.R141#' )
LOWR-package/R/xgb.plot.shap.R241#' Visualizes SHAP contributions of different features.
LOWR-package/R/xgb.plot.shap.R261#' and the Python library <https://github.com/shap/shap>.
LOWR-package/R/xgboost.R821 if (is.na(early_stopping_rounds) || early_stopping_rounds <= 0L) {
LOWR-package/R/xgboost.R841#'
LOWR-package/R/xgboost.R861#' For package authors using 'xgboost' as a dependency, it is highly recommended to use
LOWR-package/R/xgboost.R881#' Note that categorical features are only supported for `data.frame` inputs, and are automatically
LOWR-package/R/xgboost.R901#' set as the last level.
LOWR-package/R/xgboost.R921#' prediction type (e.g. `multi:softmax` vs. `multi:softprob`) are not allowed, and neither are
LOWR-package/R/xgboost.R941#' - `"reg:gamma"`: gamma regression with log-link. Output is a mean of gamma distribution. It might be useful, e.g., fo
LOWR-package/R/xgboost.R961#' 2 (info), and 3 (debug).
LOWR-package/R/xgboost.R981#' @param early_stopping_rounds Number of boosting rounds after which training will be stopped
LOWR-package/R/xgboost.R1001#' A value of `+1` for a given feature makes the model predictions / scores constrained to be
LOWR-package/R/xgboost.R1021#' for more information.
LOWR-package/R/xgboost.R1041#' Note that, if it contains more than one column, then columns will not be matched by name to
LOWR-package/R/xgboost.R1061#' - For linear booster:
LOWR-package/R/xgboost.R1081#' @examples
LOWR-package/R/xgboost.R1101#'
LOWR-package/R/xgboost.R1241#'
LOWR-package/R/xgboost.R1261#' probabilities of belonging to the last class in the case of binary classification). Result will
LOWR-package/R/xgboost.R1281#' Output will be a numeric matrix with shape `[nrows, nfeatures+1]`, with the intercept being the
LOWR-package/R/xgboost.R1301#' @param iteration_range Sequence of rounds/iterations from the model to use for prediction, specified by passing
LOWR-package/R/xgboost.R1321#'
LOWR-package/R/xgboost.R1541 }
LOWR-package/R/xgboost.R1561#' School of Information and Computer Science.
LOWR-package/R/xgboost.R1581#' <https://archive.ics.uci.edu/ml/datasets/Mushroom>
LOWR-package/R/xgboost.R1601#' @importFrom data.table :=
259 more matches not shown…
Hyper-Verbose Identifiers276 hits · 297 pts
SeverityFileLineSnippet
LOWdemo/dask/gpu_training.py42def using_quantile_device_dmatrix(client: Client, X: da.Array, y: da.Array) -> da.Array:
LOWdemo/dask/dask_callbacks.py18def probability_for_going_backward(epoch: int) -> float:
LOWdemo/nvflare/horizontal/custom/controller.py48 def process_result_of_unknown_task(self, client: Client, task_name: str,
LOWdemo/nvflare/vertical/custom/controller.py48 def process_result_of_unknown_task(self, client: Client, task_name: str,
LOWdemo/guide-python/continuation.py50def training_continuation_early_stop(tmpdir: str, use_pickle: bool) -> None:
LOWtests/python/test_ordinal.py72def test_training_continuation() -> None:
LOWtests/python/test_ordinal.py80def test_recode_dmatrix_predict() -> None:
LOWtests/python/test_training_continuation.py37 def run_training_continuation(
LOWtests/python/test_training_continuation.py134 def test_training_continuation_json(self, tmp_path: Path) -> None:
LOWtests/python/test_training_continuation.py139 def test_training_continuation_updaters_json(self, tmp_path: Path) -> None:
LOWtests/python/test_training_continuation.py174def test_continuation_determinism(kwargs: Any) -> None:
LOWtests/python/test_basic.py191 def test_dmatrix_numpy_init_omp(self):
LOWtests/python/test_basic.py227 def test_cv_explicit_fold_indices(self):
LOWtests/python/test_basic.py241 def test_cv_explicit_fold_indices_labels(self):
LOWtests/python/test_early_stopping.py15 def test_early_stopping_nonparallel(self):
LOWtests/python/test_early_stopping.py122 def test_cv_early_stopping_with_multiple_eval_sets_and_metrics(self):
LOWtests/python/test_with_arrow.py39 def test_arrow_table_with_label(self):
LOWtests/python/test_data_iterator.py337def test_categorical_extmem_qdm(
LOWtests/python/test_interaction_constraints.py11 def test_exact_interaction_constraints(self) -> None:
LOWtests/python/test_interaction_constraints.py14 def test_hist_interaction_constraints(self) -> None:
LOWtests/python/test_interaction_constraints.py17 def test_approx_interaction_constraints(self) -> None:
LOWtests/python/test_interaction_constraints.py20 def test_interaction_constraints_feature_names(self) -> None:
LOWtests/python/test_interaction_constraints.py57 def test_hist_training_accuracy(self, tree_method: str) -> None:
LOWtests/python/test_model_io.py104 def test_categorical_model_io(self, tmp_path: Path) -> None:
LOWtests/python/test_model_io.py341def test_with_sklearn_obj_metric(tmp_path: Path) -> None:
LOWtests/python/generate_models.py37def generate_regression_model() -> None:
LOWtests/python/generate_models.py107def generate_classification_model() -> None:
LOWtests/python/generate_models.py178def generate_aft_survival_models() -> None:
LOWtests/python/test_callback.py124 def test_early_stopping_custom_eval(self, breast_cancer: BreastCancer) -> None:
LOWtests/python/test_callback.py144 def test_early_stopping_customize(self, breast_cancer: BreastCancer) -> None:
LOWtests/python/test_callback.py206 def test_early_stopping_custom_eval_skl(self, breast_cancer: BreastCancer) -> None:
LOWtests/python/test_callback.py218 def test_early_stopping_save_best_model(self, breast_cancer: BreastCancer) -> None:
LOWtests/python/test_callback.py258 def test_early_stopping_continuation(
LOWtests/python/test_callback.py292 def test_early_stopping_multiple_metrics(self):
LOWtests/python/test_callback.py314 def test_eta_decay_leaf_output(self, tree_method: str, objective: str) -> None:
LOWtests/python/test_basic_models.py104 def test_boost_from_prediction(self):
LOWtests/python/test_basic_models.py119 def test_boost_from_existing_model(self) -> None:
LOWtests/python/test_basic_models.py227 def test_feature_names_validation(self):
LOWtests/python/test_basic_models.py243 def test_special_model_dump_characters(self) -> None:
LOWtests/python/test_survival.py58def test_aft_survival_toy_data(
LOWtests/python/test_survival.py133def test_aft_survival_demo_data():
LOWtests/python/test_dmatrix.py413 def verify_numpy_feature_names():
LOWtests/python/test_predict.py74def test_base_margin_vs_base_score() -> None:
LOWtests/python/test_ranking.py93def test_ranking_with_unweighted_data():
LOWtests/python/test_ranking.py127def test_ranking_with_weighted_data():
LOWtests/python/test_ranking.py184def test_lambdarank_parameters(params):
LOWtests/python/test_multi_target.py45def test_shap_multi_output_tree() -> None:
LOWtests/python/test_multi_target.py191def test_feature_importance_strategy_compare() -> None:
LOWtests/python/test_multi_target.py205def test_gradient_based_sampling_accuracy() -> None:
LOWtests/python/test_interpret.py7def test_shap_values_matches_predict() -> None:
LOWtests/python/test_interpret.py20def test_shap_values_accepts_sklearn_model() -> None:
LOWtests/python/test_interpret.py34def test_shap_values_uses_sklearn_iteration_range() -> None:
LOWtests/python/test_interpret.py51def test_shap_values_rejects_background_data() -> None:
LOWtests/python/test_interpret.py61def test_shap_values_validates_get_booster() -> None:
LOWtests/python/test_interpret.py69def test_shap_values_uses_missing_for_array_like_data() -> None:
LOWtests/python/test_interpret.py83def test_shap_values_rejects_missing_with_dmatrix() -> None:
LOWtests/python/test_config.py10def test_global_config_verbosity(verbosity_level):
LOWtests/python/test_config.py23def test_global_config_use_rmm(use_rmm):
LOWtests/python/test_demos.py41def test_custom_multiclass_objective() -> None:
LOWtests/python/test_demos.py48def test_custom_rmsle_objective() -> None:
216 more matches not shown…
Unused Imports66 hits · 63 pts
SeverityFileLineSnippet
LOWdemo/multiclass_classification/train.py3
LOWdemo/dask/dask_learning_to_rank.py16
LOWdemo/nvflare/vertical/custom/trainer.py10
LOWdemo/guide-python/cat_in_the_dat.py24
LOWdemo/guide-python/learning_to_rank.py19
LOWtests/test_distributed/test_with_spark/test_spark.py6
LOWtests/test_distributed/test_gpu_with_dask/conftest.py21
LOWtests/test_distributed/test_with_dask/conftest.py3
LOWtests/test_distributed/test_with_dask/test_with_dask.py1951
LOWtests/test_distributed/test_with_dask/test_with_dask.py2042
LOWtests/python-sycl/test_sycl_with_sklearn.py3
LOWtests/python-sycl/test_sycl_prediction.py1
LOWtests/python-sycl/test_sycl_prediction.py7
LOWtests/python-sycl/test_sycl_updaters.py1
LOWtests/python-sycl/test_sycl_updaters.py2
LOWtests/python-sycl/test_sycl_updaters.py3
LOWtests/python-sycl/test_sycl_updaters.py5
LOWtests/python-sycl/test_sycl_updaters.py7
LOWpython-package/xgboost/objective.py28
LOWpython-package/xgboost/compat.py39
LOWpython-package/xgboost/compat.py40
LOWpython-package/xgboost/compat.py41
LOWpython-package/xgboost/compat.py81
LOWpython-package/xgboost/_typing.py34
LOWpython-package/xgboost/__init__.py6
LOWpython-package/xgboost/__init__.py6
LOWpython-package/xgboost/__init__.py6
LOWpython-package/xgboost/__init__.py12
LOWpython-package/xgboost/__init__.py12
LOWpython-package/xgboost/__init__.py12
LOWpython-package/xgboost/__init__.py12
LOWpython-package/xgboost/__init__.py12
LOWpython-package/xgboost/__init__.py12
LOWpython-package/xgboost/__init__.py20
LOWpython-package/xgboost/__init__.py21
LOWpython-package/xgboost/__init__.py21
LOWpython-package/xgboost/__init__.py24
LOWpython-package/xgboost/__init__.py24
LOWpython-package/xgboost/__init__.py24
LOWpython-package/xgboost/__init__.py25
LOWpython-package/xgboost/__init__.py25
LOWpython-package/xgboost/__init__.py25
LOWpython-package/xgboost/__init__.py26
LOWpython-package/xgboost/__init__.py26
LOWpython-package/xgboost/__init__.py26
LOWpython-package/xgboost/__init__.py26
LOWpython-package/xgboost/__init__.py26
LOWpython-package/xgboost/__init__.py26
LOWpython-package/xgboost/core.py93
LOWpython-package/xgboost/training.py42
LOWpython-package/xgboost/data.py82
LOWpython-package/xgboost/data.py83
LOWpython-package/xgboost/data.py85
LOWpython-package/xgboost/data.py85
LOWpython-package/xgboost/_data_utils.py41
LOWpython-package/xgboost/testing/__init__.py53
LOWpython-package/xgboost/testing/__init__.py53
LOWpython-package/xgboost/spark/params.py3
LOWpython-package/xgboost/spark/__init__.py8
LOWpython-package/xgboost/spark/__init__.py8
6 more matches not shown…
Hallucination Indicators4 hits · 45 pts
SeverityFileLineSnippet
CRITICALR-package/tests/testthat/test_dmatrix.R674 expect_equal(xgb.get.DMatrix.num.non.missing(dm1), 10)
CRITICALR-package/tests/testthat/test_dmatrix.R679 expect_equal(xgb.get.DMatrix.num.non.missing(dm2), 8)
CRITICALpython-package/xgboost/data.py501 # pandas.core.internals.managers.SingleBlockManager.array_values()
CRITICAL…rc/main/java/ml/dmlc/xgboost4j/java/flink/XGBoost.java170 return new XGBoostModel(ml.dmlc.xgboost4j.java.XGBoost.loadModel(opened));
Deep Nesting44 hits · 44 pts
SeverityFileLineSnippet
LOWdemo/guide-python/model_parser.py146
LOWtests/python/test_model_compatibility.py29
LOWtests/python/test_model_compatibility.py76
LOWtests/python/test_shap.py12
LOWtests/python/test_shap.py82
LOWtests/python/test_tracker.py222
LOWtests/python/test_tracker.py256
LOWtests/python/test_tracker.py227
LOWtests/python/test_tracker.py268
LOWtests/test_distributed/test_with_dask/test_with_dask.py1714
LOWtests/python-sycl/test_sycl_updaters.py61
LOWtests/python-sycl/test_sycl_training_continuation.py9
LOWtests/python-sycl/test_sycl_training_continuation.py29
LOWpython-package/xgboost/callback.py555
LOWpython-package/xgboost/callback.py634
LOWpython-package/xgboost/core.py2319
LOWpython-package/xgboost/core.py3082
LOWpython-package/xgboost/libpath.py19
LOWpython-package/xgboost/sklearn.py1173
LOWpython-package/xgboost/sklearn.py1403
LOWpython-package/xgboost/sklearn.py1833
LOWpython-package/xgboost/data.py370
LOWpython-package/xgboost/data.py534
LOWpython-package/xgboost/data.py1061
LOWpython-package/xgboost/dask/__init__.py1032
LOWpython-package/xgboost/dask/__init__.py1560
LOWpython-package/xgboost/dask/__init__.py1975
LOWpython-package/xgboost/testing/ordinal.py124
LOWpython-package/xgboost/testing/ordinal.py137
LOWpython-package/xgboost/testing/continuation.py14
LOWpython-package/xgboost/testing/continuation.py38
LOWpython-package/xgboost/testing/shared.py53
LOWpython-package/xgboost/spark/core.py1362
LOWpython-package/xgboost/spark/core.py1388
LOWpython-package/xgboost/spark/data.py174
LOWpython-package/xgboost/spark/data.py213
LOWjvm-packages/create_jni.py70
LOWdev/prepare_jvm_release.py106
LOWdoc/conf.py65
LOWops/script/run_clang_tidy.py103
LOWops/script/lint_cpp.py13
LOWops/script/lint_cpp.py135
LOWops/script/change_scala_version.py7
LOWops/script/test_r_package.py230
AI Slop Vocabulary11 hits · 24 pts
SeverityFileLineSnippet
LOWdemo/rmm_plugin/rmm_mgpu_with_dask.py44 # To use RMM pool allocator with a GPU Dask cluster, just add rmm_pool_size option
MEDIUMdemo/guide-python/custom_softmax.py70 # suitable for demo. Also the one in native XGBoost core is more robust to
MEDIUMpython-package/xgboost/config.py58 # Show all messages, including ones pertaining to debugging
LOWpython-package/xgboost/sklearn.py1851 # If output_margin is active, simply return the scores
MEDIUMpython-package/xgboost/dask/__init__.py690# dask paradigm. But as a side effect, the `evals_result` in single-node API
MEDIUMpython-package/xgboost/testing/__init__.py662 """Reassign stdout temporarily in order to test printed statements
LOWpython-package/xgboost/spark/core.py673 # For now, since we cannot call rdd.getNumPartitions(), we just return
MEDIUMpython-package/xgboost/spark/core.py935 # Spark-rapids is a project to leverage GPUs to accelerate spark SQL.
LOWpython-package/xgboost/spark/core.py1351 # User don't set gpu configurations, just use cpu
MEDIUM…main/scala/ml/dmlc/xgboost4j/scala/spark/XGBoost.scala144 // that utilize GPUs alongside training tasks in order to avoid GPU out-of-memory errors.
MEDIUMsrc/common/cuda_pinned_allocator.h73// This is actually a pinned memory allocator in disguise. We utilize HMM or ATS for
Self-Referential Comments7 hits · 22 pts
SeverityFileLineSnippet
MEDIUMdemo/guide-python/cat_pipeline.py66 # Create an encoder based on training data.
MEDIUMR-package/R/utils.R2# This file is for the low level reusable utility functions
MEDIUMR-package/inst/make-r-def.R2# Create a definition file (.def) from a .dll file, using objdump. This
MEDIUMtests/python/test_parse_tree.py66 # Create a feature map with indicator type 'i'
MEDIUMtests/python-gpu/test_gpu_prediction.py266 # Create a wide dataset
MEDIUMpython-package/xgboost/dask/data.py434 # Create the training DMatrix
MEDIUMpython-package/xgboost/testing/data.py180 # Create a dictionary-backed dataframe, enable this when the roundtrip is
Cross-File Repetition3 hits · 15 pts
SeverityFileLineSnippet
HIGHdemo/guide-python/quantile_data_iterator.py0utility function for obtaining current batch of data.
HIGHtests/python-gpu/test_from_cudf.py0utility function for obtaining current batch of data.
HIGHpython-package/xgboost/dask/data.py0utility function for obtaining current batch of data.
Cross-Language Confusion2 hits · 12 pts
SeverityFileLineSnippet
HIGHtests/python/test_with_pandas.py487 assert df.equals(copy)
HIGHpython-package/xgboost/testing/data.py200 # assert pd_catcodes.equals(pa_catcodes)
Excessive Try-Catch Wrapping11 hits · 12 pts
SeverityFileLineSnippet
LOWdemo/guide-python/distributed_extmem_basic.py189 except Exception as e:
LOWtests/python/test_with_shap.py9except Exception:
LOWtests/python/test_openmp.py44 except Exception as e:
LOWpython-package/xgboost/core.py378 except Exception as e: # pylint: disable=broad-except
LOWpython-package/xgboost/data.py1313 except Exception: # pylint: disable=broad-except
MEDIUMpython-package/xgboost/data.py989def _lazy_load_cudf_is_cat() -> Callable[[Any], bool]:
LOWpython-package/xgboost/dask/__init__.py673 except Exception: # pylint: disable=broad-except
LOWpython-package/xgboost/testing/__init__.py187 except Exception: # pylint: disable=broad-except
LOWpython-package/xgboost/testing/__init__.py757 except Exception as e: # pylint: disable=broad-except
LOWpython-package/xgboost/spark/core.py1654 except Exception as e: # pylint: disable=W0703
LOWops/script/change_version.py163 except Exception as e:
Redundant / Tautological Comments3 hits · 4 pts
SeverityFileLineSnippet
LOWR-package/tests/testthat/test_ranking.R25 # Check if the metric is monotone increasing
LOWR-package/tests/testthat/test_ranking.R53 # Check if the metric is monotone increasing
LOWR-package/tests/testthat/test_ranking.R63 all(diff(z) <= 0) # Check if z is monotone decreasing
Slop Phrases1 hit · 3 pts
SeverityFileLineSnippet
MEDIUMdemo/guide-python/sklearn_evals_result.py25# Or you can use: clf = xgb.XGBClassifier(**param_dist)
Verbosity Indicators2 hits · 3 pts
SeverityFileLineSnippet
LOWR-package/R/xgb.train.R420#' The purpose of this function is to enable IDE autocompletions and to provide in-package
LOWpython-package/xgboost/spark/core.py1255 # all the columns specified by features_cols, so we need to check if
Example Usage Blocks2 hits · 3 pts
SeverityFileLineSnippet
LOWops/pipeline/build-cuda.sh5## Usage:
LOWops/pipeline/test-python-wheel.sh4## Usage: