id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13,700 | dmlc/xgboost | demo/dask/dask_callbacks.py | dask_callbacks.CustomEarlyStopping | import numpy as np
import xgboost as xgb
from typing import Any
class CustomEarlyStopping(xgb.callback.TrainingCallback):
"""A custom early stopping class where early stopping is determined stochastically.
In the beginning, allow the metric to become worse with a probability of 0.999.
As boosting progresse... |
class CustomEarlyStopping(xgb.callback.TrainingCallback):
'''A custom early stopping class where early stopping is determined stochastically.
In the beginning, allow the metric to become worse with a probability of 0.999.
As boosting progresses, the probability should be adjusted downward'''
def __ini... | 3 | 1 | 16 | 0 | 16 | 2 | 3 | 0.18 | 1 | 4 | 0 | 0 | 2 | 6 | 2 | 2 | 38 | 2 | 33 | 16 | 26 | 6 | 20 | 12 | 17 | 3 | 1 | 1 | 5 |
13,701 | dmlc/xgboost | demo/guide-python/distributed_extmem_basic.py | distributed_extmem_basic.Iterator | import os
from typing import Callable, List, ParamSpec, Tuple, TypeVar
import numpy as np
import xgboost
class Iterator(xgboost.DataIter):
"""A custom iterator for loading files in batches."""
def __init__(self, device: str, file_paths: List[Tuple[str, str]]) -> None:
self.device = device
self... |
class Iterator(xgboost.DataIter):
'''A custom iterator for loading files in batches.'''
def __init__(self, device: str, file_paths: List[Tuple[str, str]]) -> None:
pass
def load_file(self) -> Tuple[np.ndarray, np.ndarray]:
'''Load a single batch of data.'''
pass
def next(self... | 5 | 4 | 10 | 1 | 6 | 3 | 2 | 0.52 | 1 | 3 | 0 | 0 | 4 | 3 | 4 | 34 | 46 | 8 | 25 | 12 | 20 | 13 | 24 | 12 | 19 | 2 | 5 | 1 | 6 |
13,702 | dmlc/xgboost | demo/guide-python/external_memory.py | external_memory.Iterator | import numpy as np
import xgboost
from typing import Callable, List, Literal, Tuple
import os
class Iterator(xgboost.DataIter):
"""A custom iterator for loading files in batches."""
def __init__(self, device: Literal['cpu', 'cuda'], file_paths: List[Tuple[str, str]]) -> None:
self.device = device
... |
class Iterator(xgboost.DataIter):
'''A custom iterator for loading files in batches.'''
def __init__(self, device: Literal['cpu', 'cuda'], file_paths: List[Tuple[str, str]]) -> None:
pass
def load_file(self) -> Tuple[np.ndarray, np.ndarray]:
'''Load a single batch of data.'''
pass... | 5 | 4 | 10 | 1 | 6 | 3 | 2 | 0.52 | 1 | 3 | 0 | 0 | 4 | 3 | 4 | 34 | 46 | 8 | 25 | 12 | 20 | 13 | 24 | 12 | 19 | 2 | 5 | 1 | 6 |
13,703 | dmlc/xgboost | demo/dask/forward_logging.py | forward_logging.ForwardLoggingMonitor | from distributed import Client
from xgboost.callback import EvaluationMonitor
class ForwardLoggingMonitor(EvaluationMonitor):
def __init__(self, client: Client, rank: int=0, period: int=1) -> None:
"""Print the evaluation result at each iteration. The default monitor in the
native interface logs t... |
class ForwardLoggingMonitor(EvaluationMonitor):
def __init__(self, client: Client, rank: int=0, period: int=1) -> None:
'''Print the evaluation result at each iteration. The default monitor in the
native interface logs the result to the Dask scheduler process. This class can
be used to for... | 2 | 1 | 28 | 3 | 12 | 13 | 1 | 1 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 30 | 29 | 3 | 13 | 7 | 6 | 13 | 4 | 2 | 2 | 1 | 6 | 0 | 1 |
13,704 | dmlc/xgboost | demo/dask/forward_logging.py | forward_logging.WorkerEventMonitor | import distributed
from xgboost.callback import EvaluationMonitor
class WorkerEventMonitor(EvaluationMonitor):
"""Use :py:meth:`distributed.print` to forward the log. A downside is that not only
all clients connected to the cluster can see the log, the logs are also printed on
the worker. If you use a loca... |
class WorkerEventMonitor(EvaluationMonitor):
'''Use :py:meth:`distributed.print` to forward the log. A downside is that not only
all clients connected to the cluster can see the log, the logs are also printed on
the worker. If you use a local cluster, the log is duplicated.
'''
def __init__(self, ... | 2 | 1 | 4 | 0 | 4 | 0 | 1 | 0.8 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 30 | 11 | 2 | 5 | 2 | 3 | 4 | 3 | 2 | 1 | 1 | 6 | 0 | 1 |
13,705 | dmlc/xgboost | python-package/hatch_build.py | hatch_build.CustomBuildHook | from hatchling.builders.hooks.plugin.interface import BuildHookInterface
from typing import Any, Dict
class CustomBuildHook(BuildHookInterface):
"""A custom build hook"""
def initialize(self, version: str, build_data: Dict[str, Any]) -> None:
"""This step ccurs immediately before each build."""
... |
class CustomBuildHook(BuildHookInterface):
'''A custom build hook'''
def initialize(self, version: str, build_data: Dict[str, Any]) -> None:
'''This step ccurs immediately before each build.'''
pass | 2 | 2 | 3 | 0 | 2 | 1 | 1 | 0.67 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 1 | 3 | 2 | 1 | 2 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
13,706 | dmlc/xgboost | ops/script/lint_cpp.py | lint_cpp.Lint | from cpplint import _cpplint_state
from typing import TextIO
import cpplint
class Lint:
def __init__(self) -> None:
self.project_name = 'xgboost'
self.cpp_header_map: dict[str, dict[str, int]] = {}
self.cpp_src_map: dict[str, dict[str, int]] = {}
self.pylint_cats = set(['error', 'w... |
class Lint:
def __init__(self) -> None:
pass
def process_cpp(self, path: str, suffix: str) -> None:
'''Process a cpp file.'''
pass
@staticmethod
def _print_summary_map(strm: TextIO, result_map: dict[str, dict[str, int]], ftype: str) -> int:
'''Print summary of certain ... | 6 | 3 | 15 | 1 | 13 | 1 | 2 | 0.07 | 0 | 5 | 0 | 0 | 3 | 4 | 4 | 4 | 63 | 5 | 54 | 18 | 46 | 4 | 37 | 15 | 32 | 4 | 0 | 2 | 9 |
13,707 | dmlc/xgboost | ops/script/lint_python.py | lint_python.LintersPaths | class LintersPaths:
"""The paths each linter run on."""
BLACK = ('python-package/', 'tests/python/generate_models.py', 'tests/python/test_model_compatibility.py', 'tests/python/test_config.py', 'tests/python/test_callback.py', 'tests/python/test_collective.py', 'tests/python/test_data_iterator.py', 'tests/pytho... | class LintersPaths:
'''The paths each linter run on.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 118 | 3 | 101 | 4 | 100 | 14 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
13,708 | dmlc/xgboost | ops/script/lint_python.py | lint_python.PyLint | import subprocess
import pathlib
import os
from typing import Dict, List, Tuple
from collections import Counter
from test_utils import PY_PACKAGE, ROOT, cd, print_time, record_time
from multiprocessing import Pool, cpu_count
class PyLint:
"""A helper for running pylint, mostly copied from dmlc-core/scripts."""
... |
class PyLint:
'''A helper for running pylint, mostly copied from dmlc-core/scripts.'''
@classmethod
@cd(PY_PACKAGE)
def get_summary(cls, path: str) -> Tuple[str, Dict[str, int], str, str, bool]:
'''Get the summary of pylint's errors, warnings, etc.'''
pass
@staticmethod
def prin... | 8 | 4 | 17 | 2 | 14 | 1 | 4 | 0.07 | 0 | 6 | 0 | 0 | 0 | 0 | 3 | 3 | 72 | 10 | 58 | 22 | 50 | 4 | 34 | 17 | 30 | 4 | 0 | 3 | 11 |
13,709 | dmlc/xgboost | tests/python-gpu/load_pickle.py | load_pickle.TestLoadPickle | import pytest
import json
from test_gpu_pickling import build_dataset, load_pickle, model_path
import os
import xgboost as xgb
import numpy as np
class TestLoadPickle:
def test_load_pkl(self) -> None:
"""Test whether prediction is correct."""
assert os.environ['CUDA_VISIBLE_DEVICES'] == '-1'
... |
class TestLoadPickle:
def test_load_pkl(self) -> None:
'''Test whether prediction is correct.'''
pass
def test_context_is_removed(self) -> None:
'''Under invalid CUDA_VISIBLE_DEVICES, context should reset'''
pass
def test_context_is_preserved(self) -> None:
'''Tes... | 6 | 3 | 10 | 0 | 9 | 1 | 1 | 0.11 | 0 | 3 | 2 | 0 | 5 | 0 | 5 | 5 | 54 | 6 | 44 | 22 | 38 | 5 | 43 | 22 | 37 | 2 | 0 | 2 | 6 |
13,710 | dmlc/xgboost | demo/guide-python/model_parser.py | model_parser.Model | from typing import Any, Dict, List, Sequence, Union
import json
class Model:
"""Gradient boosted tree model."""
def __init__(self, model: dict) -> None:
"""Construct the Model from a JSON object.
parameters
----------
model : A dictionary loaded by json representing a XGBoost... |
class Model:
'''Gradient boosted tree model.'''
def __init__(self, model: dict) -> None:
'''Construct the Model from a JSON object.
parameters
----------
model : A dictionary loaded by json representing a XGBoost boosted tree model.
'''
pass
def print_mode... | 3 | 2 | 56 | 6 | 39 | 13 | 4 | 0.33 | 0 | 11 | 3 | 0 | 2 | 7 | 2 | 2 | 115 | 13 | 78 | 41 | 75 | 26 | 58 | 41 | 55 | 6 | 0 | 4 | 8 |
13,711 | dmlc/xgboost | demo/guide-python/model_parser.py | model_parser.Node | from typing import Any, Dict, List, Sequence, Union
from dataclasses import dataclass
@dataclass
class Node:
left: int
right: int
parent: int
split_idx: int
split_cond: float
default_left: bool
split_type: SplitType
categories: List[int]
base_weight: float
loss_chg: float
su... | @dataclass
class Node:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 0 | 12 | 1 | 11 | 2 | 12 | 1 | 11 | 0 | 0 | 0 | 0 |
13,712 | dmlc/xgboost | demo/guide-python/model_parser.py | model_parser.SplitType | from enum import IntEnum, unique
@unique
class SplitType(IntEnum):
numerical = 0
categorical = 1 | @unique
class SplitType(IntEnum):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
13,713 | dmlc/xgboost | demo/guide-python/model_parser.py | model_parser.Tree | from typing import Any, Dict, List, Sequence, Union
import numpy as np
class Tree:
"""A tree built by XGBoost."""
def __init__(self, tree_id: int, nodes: Sequence[Node]) -> None:
self.tree_id = tree_id
self.nodes = nodes
def loss_change(self, node_id: int) -> float:
"""Loss gain o... |
class Tree:
'''A tree built by XGBoost.'''
def __init__(self, tree_id: int, nodes: Sequence[Node]) -> None:
pass
def loss_change(self, node_id: int) -> float:
'''Loss gain of a node.'''
pass
def sum_hessian(self, node_id: int) -> float:
'''Sum Hessian of a node.'''
... | 16 | 13 | 5 | 0 | 4 | 1 | 1 | 0.23 | 0 | 7 | 2 | 0 | 15 | 2 | 15 | 15 | 87 | 18 | 56 | 26 | 40 | 13 | 55 | 26 | 39 | 5 | 0 | 3 | 19 |
13,714 | dmlc/xgboost | python-package/packager/build_config.py | packager.build_config.BuildConfiguration | from typing import Any, Dict, List, Optional
import dataclasses
@dataclasses.dataclass
class BuildConfiguration:
"""Configurations use when building libxgboost"""
hide_cxx_symbols: bool = True
use_openmp: bool = True
use_cuda: bool = False
use_nccl: bool = False
use_dlopen_nccl: bool = False
... | @dataclasses.dataclass
class BuildConfiguration:
'''Configurations use when building libxgboost'''
def _set_config_setting(self, config_settings: Dict[str, Any]) -> None:
pass
def update(self, config_settings: Optional[Dict[str, Any]]) -> None:
'''Parse config_settings from Pip (or other P... | 5 | 3 | 7 | 0 | 6 | 1 | 3 | 0.43 | 0 | 2 | 0 | 0 | 3 | 0 | 3 | 3 | 43 | 4 | 28 | 17 | 24 | 12 | 24 | 17 | 20 | 4 | 0 | 2 | 8 |
13,715 | dmlc/xgboost | demo/guide-python/quantile_data_iterator.py | quantile_data_iterator.IterForDMatrixDemo | from typing import Callable
import xgboost
import cupy
import numpy
class IterForDMatrixDemo(xgboost.core.DataIter):
"""A data iterator for XGBoost DMatrix.
`reset` and `next` are required for any data iterator, other functions here
are utilites for demonstration's purpose.
"""
def __init__(self... |
class IterForDMatrixDemo(xgboost.core.DataIter):
'''A data iterator for XGBoost DMatrix.
`reset` and `next` are required for any data iterator, other functions here
are utilites for demonstration's purpose.
'''
def __init__(self) -> None:
'''Generate some random data for demostration.
... | 10 | 6 | 4 | 0 | 3 | 1 | 1 | 0.43 | 1 | 1 | 0 | 0 | 9 | 6 | 9 | 9 | 55 | 13 | 30 | 17 | 20 | 13 | 30 | 17 | 20 | 2 | 1 | 1 | 10 |
13,716 | dmlc/xgboost | ops/script/run_clang_tidy.py | run_clang_tidy.ClangTidy | import json
import shutil
import argparse
import subprocess
from time import time
import os
from multiprocessing import Pool, cpu_count
class ClangTidy:
"""clang tidy wrapper.
Args:
args: Command line arguments.
cpp_lint: Run linter on C++ source code.
cuda_lint: Run linter on CUDA s... |
class ClangTidy:
'''clang tidy wrapper.
Args:
args: Command line arguments.
cpp_lint: Run linter on C++ source code.
cuda_lint: Run linter on CUDA source code.
use_dmlc_gtest: Whether to use gtest bundled in dmlc-core.
'''
def __init__(self, args: argparse.Namespac... | 10 | 5 | 24 | 2 | 22 | 1 | 5 | 0.1 | 0 | 7 | 0 | 0 | 8 | 11 | 8 | 8 | 226 | 22 | 188 | 52 | 178 | 18 | 139 | 50 | 129 | 19 | 0 | 3 | 46 |
13,717 | dmlc/xgboost | demo/nvflare/vertical/custom/trainer.py | trainer.SupportedTasks | class SupportedTasks(object):
TRAIN = 'train' | class SupportedTasks(object):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
13,718 | dmlc/xgboost | demo/nvflare/horizontal/custom/trainer.py | trainer.XGBoostTrainer | from nvflare.apis.signal import Signal
from nvflare.apis.shareable import Shareable, make_reply
from nvflare.apis.fl_constant import FLContextKey, ReturnCode
import xgboost as xgb
from nvflare.apis.fl_context import FLContext
from xgboost import callback
import os
from nvflare.apis.executor import Executor
class XGBoo... |
class XGBoostTrainer(Executor):
def __init__(self, server_address: str, world_size: int, server_cert_path: str, client_key_path: str, client_cert_path: str, use_gpus: bool):
'''Trainer for federated XGBoost.
Args:
server_address: address for the gRPC server to connect to.
w... | 4 | 1 | 23 | 2 | 17 | 4 | 2 | 0.25 | 1 | 9 | 4 | 0 | 3 | 6 | 3 | 3 | 73 | 7 | 53 | 25 | 47 | 13 | 39 | 22 | 35 | 3 | 1 | 2 | 6 |
13,719 | dmlc/xgboost | demo/nvflare/vertical/custom/trainer.py | trainer.XGBoostTrainer | from nvflare.apis.executor import Executor
import os
from nvflare.apis.fl_constant import FLContextKey, ReturnCode
from nvflare.apis.signal import Signal
from nvflare.apis.fl_context import FLContext
import xgboost as xgb
from nvflare.apis.shareable import Shareable, make_reply
class XGBoostTrainer(Executor):
def... |
class XGBoostTrainer(Executor):
def __init__(self, server_address: str, world_size: int, server_cert_path: str, client_key_path: str, client_cert_path: str, use_gpus: bool):
'''Trainer for federated XGBoost.
Args:
server_address: address for the gRPC server to connect to.
w... | 4 | 1 | 27 | 2 | 21 | 4 | 2 | 0.2 | 1 | 8 | 3 | 0 | 3 | 6 | 3 | 3 | 85 | 7 | 65 | 26 | 59 | 13 | 42 | 23 | 38 | 3 | 1 | 2 | 7 |
13,720 | dmlc/xgboost | python-package/xgboost/_data_utils.py | xgboost._data_utils.TransformedDf | from abc import ABC, abstractmethod
import json
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Literal, Optional, Protocol, Tuple, Type, TypeAlias, TypedDict, TypeGuard, Union, cast, overload
class TransformedDf(ABC):
"""Internal class for storing transformed dataframe.
Parameters
----------... |
class TransformedDf(ABC):
'''Internal class for storing transformed dataframe.
Parameters
----------
ref_categories :
Optional reference categories used for re-coding.
aitfs :
Array interface for each column.
'''
def __init__(self, ref_categories: Optional[Categories], aitf... | 6 | 3 | 2 | 0 | 1 | 1 | 1 | 0.75 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 26 | 9 | 2 | 4 | 4 | 0 | 3 | 3 | 3 | 0 | 1 | 5 | 0 | 2 |
13,721 | dmlc/xgboost | python-package/xgboost/_data_utils.py | xgboost._data_utils._ArrayLikeArg | from typing import TYPE_CHECKING, Any, Callable, Dict, List, Literal, Optional, Protocol, Tuple, Type, TypeAlias, TypedDict, TypeGuard, Union, cast, overload
class _ArrayLikeArg(Protocol):
@property
def __array_interface__(self) -> 'ArrayInf':
... |
class _ArrayLikeArg(Protocol):
@property
def __array_interface__(self) -> 'ArrayInf':
pass | 3 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 25 | 3 | 0 | 3 | 3 | 1 | 0 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
13,722 | dmlc/xgboost | python-package/xgboost/callback.py | xgboost.callback.CallbackContainer | from ._typing import EvalsLog, _ScoreList
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeVar, Union, cast
from .core import Booster, DMatrix, XGBoostError, _deprecate_positional_args, _parse_eval_str
import collections
class CallbackContainer:
"""A special internal callback... |
class CallbackContainer:
'''A special internal callback for invoking a list of other callbacks.
.. versionadded:: 1.3.0
'''
def __init__(self, callbacks: Sequence[TrainingCallback], metric: Optional[Callable]=None, output_margin: bool=True, is_cv: bool=False) -> None:
pass
def before_trai... | 7 | 5 | 18 | 1 | 17 | 1 | 4 | 0.07 | 0 | 9 | 1 | 0 | 6 | 6 | 6 | 6 | 121 | 12 | 102 | 56 | 73 | 7 | 68 | 34 | 61 | 6 | 0 | 2 | 22 |
13,723 | dmlc/xgboost | python-package/xgboost/callback.py | xgboost.callback.EarlyStopping | from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeVar, Union, cast
from .core import Booster, DMatrix, XGBoostError, _deprecate_positional_args, _parse_eval_str
import numpy
from ._typing import EvalsLog, _ScoreList
class EarlyStopping(TrainingCallback):
"""Callback function f... |
class EarlyStopping(TrainingCallback):
'''Callback function for early stopping
.. versionadded:: 1.3.0
Parameters
----------
rounds :
Early stopping rounds.
metric_name :
Name of metric that is used for early stopping.
data_name :
Name of dataset that is used for ear... | 10 | 4 | 19 | 2 | 16 | 3 | 3 | 0.42 | 1 | 10 | 0 | 0 | 5 | 10 | 5 | 30 | 191 | 26 | 120 | 44 | 97 | 51 | 83 | 29 | 74 | 7 | 5 | 2 | 24 |
13,724 | dmlc/xgboost | python-package/xgboost/callback.py | xgboost.callback.EvaluationMonitor | from . import collective
from ._typing import EvalsLog, _ScoreList
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeVar, Union, cast
class EvaluationMonitor(TrainingCallback):
"""Print the evaluation result at each iteration.
.. versionadded:: 1.3.0
Parameters
-... |
class EvaluationMonitor(TrainingCallback):
'''Print the evaluation result at each iteration.
.. versionadded:: 1.3.0
Parameters
----------
rank :
Which worker should be used for printing the result.
period :
How many epoches between printing.
show_stdv :
Used in cv t... | 5 | 1 | 13 | 1 | 12 | 1 | 3 | 0.3 | 1 | 6 | 0 | 2 | 4 | 5 | 4 | 29 | 75 | 10 | 50 | 26 | 35 | 15 | 37 | 16 | 32 | 7 | 5 | 4 | 12 |
13,725 | dmlc/xgboost | python-package/xgboost/callback.py | xgboost.callback.LearningRateScheduler | from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeVar, Union, cast
from ._typing import EvalsLog, _ScoreList
import collections
class LearningRateScheduler(TrainingCallback):
"""Callback function for scheduling learning rate.
.. versionadded:: 1.3.0
Parameters
--... |
class LearningRateScheduler(TrainingCallback):
'''Callback function for scheduling learning rate.
.. versionadded:: 1.3.0
Parameters
----------
learning_rates :
If it's a callable object, then it should accept an integer parameter
`epoch` and returns the corresponding learning rate.... | 3 | 1 | 11 | 1 | 10 | 0 | 2 | 0.48 | 1 | 5 | 0 | 0 | 2 | 1 | 2 | 27 | 38 | 7 | 21 | 8 | 14 | 10 | 11 | 4 | 8 | 3 | 5 | 1 | 4 |
13,726 | dmlc/xgboost | python-package/xgboost/callback.py | xgboost.callback.TrainingCallback | from abc import ABC
from ._typing import EvalsLog, _ScoreList
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeVar, Union, cast
class TrainingCallback(ABC):
"""Interface for training callback.
.. versionadded:: 1.3.0
"""
EvalsLog: TypeAlias = EvalsLog
def _... |
class TrainingCallback(ABC):
'''Interface for training callback.
.. versionadded:: 1.3.0
'''
def __init__(self) -> None:
pass
def before_training(self, model: _Model) -> _Model:
'''Run before training starts.'''
pass
def after_training(self, model: _Model) -> _Model:
... | 6 | 5 | 7 | 1 | 2 | 4 | 1 | 1.83 | 1 | 2 | 0 | 4 | 5 | 0 | 5 | 25 | 47 | 14 | 12 | 7 | 6 | 22 | 12 | 7 | 6 | 1 | 4 | 0 | 5 |
13,727 | dmlc/xgboost | python-package/xgboost/callback.py | xgboost.callback.TrainingCheckPoint | from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeVar, Union, cast
from ._typing import EvalsLog, _ScoreList
import pickle
from . import collective
import os
class TrainingCheckPoint(TrainingCallback):
"""Checkpointing operation. Users are encouraged to create their own callba... |
class TrainingCheckPoint(TrainingCallback):
'''Checkpointing operation. Users are encouraged to create their own callbacks for
checkpoint as XGBoost doesn't handle distributed file systems. When checkpointing on
distributed systems, be sure to know the rank of the worker to avoid multiple
workers check... | 4 | 1 | 13 | 0 | 12 | 1 | 2 | 0.62 | 1 | 5 | 0 | 0 | 3 | 6 | 3 | 28 | 69 | 9 | 39 | 21 | 27 | 24 | 24 | 12 | 20 | 5 | 5 | 4 | 7 |
13,728 | dmlc/xgboost | python-package/xgboost/collective.py | xgboost.collective.CommunicatorContext | from .core import _LIB, _check_call, build_info, c_str, make_jcargs, py_str
import os
from typing import Any, Dict, Optional, TypeAlias, Union
class CommunicatorContext:
"""A context controlling collective communicator initialization and finalization."""
def __init__(self, **args: _ArgVals) -> None:
s... |
class CommunicatorContext:
'''A context controlling collective communicator initialization and finalization.'''
def __init__(self, **args: _ArgVals) -> None:
pass
def __enter__(self) -> _Args:
pass
def __exit__(self, *args: Any) -> None:
pass | 4 | 1 | 12 | 1 | 9 | 1 | 3 | 0.18 | 0 | 3 | 0 | 2 | 3 | 1 | 3 | 3 | 40 | 7 | 28 | 10 | 23 | 5 | 27 | 10 | 22 | 6 | 0 | 2 | 8 |
13,729 | dmlc/xgboost | python-package/xgboost/collective.py | xgboost.collective.Config | from dataclasses import dataclass
from typing import Any, Dict, Optional, TypeAlias, Union
@dataclass
class Config:
"""User configuration for the communicator context. This is used for easier
integration with distributed frameworks. Users of the collective module can pass the
parameters directly into track... | @dataclass
class Config:
'''User configuration for the communicator context. This is used for easier
integration with distributed frameworks. Users of the collective module can pass the
parameters directly into tracker and the communicator.
.. versionadded:: 3.0
Attributes
----------
retry :... | 3 | 2 | 7 | 0 | 6 | 1 | 3 | 1.42 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 39 | 10 | 12 | 7 | 10 | 17 | 12 | 7 | 10 | 3 | 0 | 1 | 3 |
13,730 | dmlc/xgboost | python-package/xgboost/collective.py | xgboost.collective.Op | from enum import IntEnum, unique
@unique
class Op(IntEnum):
"""Supported operations for allreduce."""
MAX = 0
MIN = 1
SUM = 2
BITWISE_AND = 3
BITWISE_OR = 4
BITWISE_XOR = 5 | @unique
class Op(IntEnum):
'''Supported operations for allreduce.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 9 | 1 | 7 | 7 | 6 | 1 | 7 | 7 | 6 | 0 | 3 | 0 | 0 |
13,731 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.Booster | from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, TypeGuard, TypeVar, Union, cast, overload
from ._data_utils import Categories, TransformedDf, array_interface, cuda_array_interface, from_array_interface, make_array_interface
from collections.abc import M... |
class Booster:
'''A Booster of XGBoost.
Booster is the model of xgboost, that contains low level routines for
training, prediction and evaluation.
'''
def __init__(self, params: Optional[BoosterParam]=None, cache: Optional[Sequence[DMatrix]]=None, model_file: Optional[Union['Booster', bytearray, o... | 64 | 35 | 28 | 3 | 18 | 8 | 3 | 0.45 | 0 | 34 | 4 | 0 | 48 | 1 | 48 | 48 | 1,494 | 202 | 895 | 304 | 742 | 403 | 544 | 211 | 483 | 20 | 0 | 4 | 175 |
13,732 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.DMatrix | from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, TypeGuard, TypeVar, Union, cast, overload
from ._data_utils import Categories, TransformedDf, array_interface, cuda_array_interface, from_array_interface, make_array_interface
import scipy.sparse
from ._ty... |
class DMatrix:
'''Data Matrix used in XGBoost.
DMatrix is an internal data structure that is used by XGBoost, which is optimized
for both memory efficiency and training speed. You can construct DMatrix from
multiple different sources of data.
'''
@_deprecate_positional_args
def __init__(se... | 37 | 27 | 22 | 3 | 12 | 8 | 2 | 0.65 | 0 | 13 | 2 | 3 | 29 | 4 | 29 | 29 | 689 | 115 | 349 | 127 | 269 | 226 | 189 | 87 | 149 | 11 | 0 | 1 | 55 |
13,733 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.DataIter | import sys
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, TypeGuard, TypeVar, Union, cast, overload
from ._typing import _T, ArrayLike, ArrowCatList, BoosterParam, CFloatPtr, CNumeric, CNumericPtr, CStrPptr, CStrPtr, CTypeT, DataType, FeatureInfo, Feat... |
class DataIter(ABC):
'''The interface for user defined data iterator. The iterator facilitates
distributed training, :py:class:`QuantileDMatrix`, and external memory support using
:py:class:`DMatrix` or :py:class:`ExtMemQuantileDMatrix`. Most of time, users don't
need to interact with this class direct... | 16 | 8 | 16 | 1 | 11 | 4 | 2 | 0.84 | 1 | 9 | 1 | 7 | 10 | 9 | 10 | 30 | 207 | 35 | 96 | 46 | 66 | 81 | 62 | 28 | 49 | 3 | 4 | 1 | 18 |
13,734 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.DataSplitMode | from enum import IntEnum, unique
@unique
class DataSplitMode(IntEnum):
"""Supported data split mode for DMatrix."""
ROW = 0
COL = 1 | @unique
class DataSplitMode(IntEnum):
'''Supported data split mode for DMatrix.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
13,735 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.ExtMemQuantileDMatrix | import ctypes
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, TypeGuard, TypeVar, Union, cast, overload
import weakref
import numpy as np
class ExtMemQuantileDMatrix(DMatrix, _RefMixIn):
"""The external memory version of the :py:class:`QuantileDMat... |
class ExtMemQuantileDMatrix(DMatrix, _RefMixIn):
'''The external memory version of the :py:class:`QuantileDMatrix`.
See :doc:`/tutorials/external_memory` for explanation and usage examples, and
:py:class:`QuantileDMatrix` for parameter document.
.. warning::
This is an experimental feature and ... | 4 | 2 | 42 | 3 | 29 | 15 | 4 | 0.6 | 2 | 5 | 1 | 0 | 2 | 5 | 2 | 33 | 100 | 12 | 60 | 32 | 37 | 36 | 17 | 12 | 14 | 4 | 1 | 1 | 7 |
13,736 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.QuantileDMatrix | from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, TypeGuard, TypeVar, Union, cast, overload
from ._typing import _T, ArrayLike, ArrowCatList, BoosterParam, CFloatPtr, CNumeric, CNumericPtr, CStrPptr, CStrPtr, CTypeT, DataType, FeatureInfo, FeatureNames, F... |
class QuantileDMatrix(DMatrix, _RefMixIn):
'''A DMatrix variant that generates quantilized data directly from input for the
``hist`` tree method. This DMatrix is primarily designed to save memory in training
by avoiding intermediate storage. Set ``max_bin`` to control the number of bins
during quantisa... | 4 | 1 | 64 | 4 | 59 | 3 | 7 | 0.42 | 2 | 9 | 3 | 0 | 2 | 6 | 2 | 33 | 191 | 23 | 120 | 50 | 81 | 50 | 33 | 15 | 29 | 7 | 1 | 2 | 13 |
13,737 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core.XGBoostError | class XGBoostError(ValueError):
"""Error thrown by xgboost trainer.""" | class XGBoostError(ValueError):
'''Error thrown by xgboost trainer.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 4 | 0 | 0 |
13,738 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core._ProxyDMatrix | from ._data_utils import Categories, TransformedDf, array_interface, cuda_array_interface, from_array_interface, make_array_interface
import scipy.sparse
from ._typing import _T, ArrayLike, ArrowCatList, BoosterParam, CFloatPtr, CNumeric, CNumericPtr, CStrPptr, CStrPtr, CTypeT, DataType, FeatureInfo, FeatureNames, Feat... |
class _ProxyDMatrix(DMatrix):
'''A placeholder class when DMatrix cannot be constructed (QuantileDMatrix,
inplace_predict).
'''
def __init__(self) -> None:
pass
def _ref_data_from_cuda_interface(self, data: DataType) -> None:
'''Reference data from CUDA array interface.'''
... | 7 | 6 | 5 | 0 | 4 | 1 | 1 | 0.36 | 1 | 3 | 1 | 0 | 6 | 1 | 6 | 35 | 41 | 8 | 25 | 11 | 17 | 9 | 17 | 11 | 9 | 1 | 1 | 0 | 6 |
13,739 | dmlc/xgboost | python-package/xgboost/core.py | xgboost.core._RefMixIn | from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Tuple, Type, TypeGuard, TypeVar, Union, cast, overload
import weakref
class _RefMixIn:
@property
def ref(self) -> Optional[weakref.ReferenceType]:
"""Internal method for retrieving a reference to the ... |
class _RefMixIn:
@property
def ref(self) -> Optional[weakref.ReferenceType]:
'''Internal method for retrieving a reference to the training DMatrix.'''
pass
@ref.setter
def ref(self) -> Optional[weakref.ReferenceType]:
pass | 5 | 1 | 4 | 0 | 3 | 1 | 2 | 0.11 | 0 | 0 | 0 | 2 | 2 | 1 | 2 | 2 | 11 | 1 | 9 | 6 | 4 | 1 | 7 | 4 | 4 | 2 | 0 | 1 | 3 |
13,740 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.CommunicatorContext | from .. import collective, config
import distributed
from ..collective import _ArgVals as CollArgsVals
class CommunicatorContext(collective.CommunicatorContext):
"""A context controlling collective communicator initialization and finalization."""
def __init__(self, **args: CollArgsVals) -> None:
super... |
class CommunicatorContext(collective.CommunicatorContext):
'''A context controlling collective communicator initialization and finalization.'''
def __init__(self, **args: CollArgsVals) -> None:
pass | 2 | 1 | 13 | 1 | 8 | 4 | 1 | 0.56 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 4 | 16 | 2 | 9 | 7 | 7 | 5 | 9 | 6 | 7 | 1 | 1 | 1 | 1 |
13,741 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskDMatrix | from .._typing import FeatureNames, FeatureTypes, IterationRange
import dask
from dask.delayed import Delayed
import distributed
from ..core import Booster, DMatrix, Metric, Objective, XGBoostError, _check_distributed_params, _deprecate_positional_args, _expect
from typing import Any, Awaitable, Callable, Dict, Generat... |
class DaskDMatrix:
'''DMatrix holding on references to Dask DataFrame or Dask Array. Constructing a
`DaskDMatrix` forces all lazy computation to be carried out. Wait for the input
data explicitly if you want to see actual computation of constructing `DaskDMatrix`.
See doc for :py:obj:`xgboost.DMatrix... | 11 | 5 | 26 | 3 | 19 | 4 | 3 | 0.3 | 0 | 13 | 0 | 1 | 5 | 10 | 5 | 5 | 247 | 42 | 159 | 78 | 114 | 48 | 90 | 45 | 78 | 7 | 0 | 2 | 25 |
13,742 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskQuantileDMatrix | from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, List, Optional, ParamSpec, Sequence, Set, Tuple, TypeAlias, TypedDict, TypeGuard, TypeVar, Union
from .._typing import FeatureNames, FeatureTypes, IterationRange
from ..core import Booster, DMatrix, Metric, Objective, XGBoostError, _check_distribut... |
class DaskQuantileDMatrix(DaskDMatrix):
'''A dask version of :py:class:`QuantileDMatrix`. See :py:class:`DaskDMatrix` for
parameter documents.
'''
@_deprecate_positional_args
def __init__(self, client: Optional['distributed.Client'], data: _DataT, label: Optional[_DaskCollection]=None, *, weight: O... | 4 | 1 | 25 | 0 | 25 | 1 | 2 | 0.08 | 1 | 6 | 0 | 0 | 2 | 4 | 2 | 7 | 58 | 3 | 52 | 30 | 27 | 4 | 14 | 8 | 11 | 2 | 1 | 1 | 4 |
13,743 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskScikitLearnBase | from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, List, Optional, ParamSpec, Sequence, Set, Tuple, TypeAlias, TypedDict, TypeGuard, TypeVar, Union
from .._typing import FeatureNames, FeatureTypes, IterationRange
from dask import dataframe as dd
from ..core import Booster, DMatrix, Metric, Objectiv... |
class DaskScikitLearnBase(XGBModel):
'''Base class for implementing scikit-learn interface with Dask'''
def __init__(self, *, coll_cfg: Optional[CollConfig]=None, **kwargs: Any) -> None:
pass
async def _predict_async(self, data: _DataT, *, output_margin: bool, validate_features: bool, base_margin... | 15 | 3 | 12 | 1 | 11 | 1 | 2 | 0.11 | 1 | 5 | 1 | 3 | 10 | 3 | 10 | 43 | 152 | 18 | 123 | 54 | 84 | 13 | 53 | 24 | 41 | 4 | 2 | 4 | 19 |
13,744 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskXGBClassifier | from ..core import Booster, DMatrix, Metric, Objective, XGBoostError, _check_distributed_params, _deprecate_positional_args, _expect
from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, List, Optional, ParamSpec, Sequence, Set, Tuple, TypeAlias, TypedDict, TypeGuard, TypeVar, Union
import numpy
from ... | @xgboost_model_doc('Implementation of the scikit-learn API for XGBoost classification.', ['estimators', 'model'])
class DaskXGBClassifier(XGBClassifierBase, DaskScikitLearnBase):
async def _fit_async(self, X: _DataT, y: _DaskCollection, *, sample_weight: Optional[_DaskCollection], base_margin: Optional[_DaskCollec... | 8 | 0 | 28 | 1 | 27 | 1 | 3 | 0.04 | 2 | 8 | 1 | 1 | 5 | 13 | 5 | 48 | 178 | 11 | 161 | 76 | 108 | 6 | 51 | 21 | 44 | 7 | 3 | 1 | 15 |
13,745 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskXGBRFClassifier | from ..core import Booster, DMatrix, Metric, Objective, XGBoostError, _check_distributed_params, _deprecate_positional_args, _expect
from ..collective import Config as CollConfig
from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, List, Optional, ParamSpec, Sequence, Set, Tuple, TypeAlias, TypedDict... | @xgboost_model_doc('Implementation of the Scikit-Learn API for XGBoost Random Forest Classifier.\n\n .. versionadded:: 1.4.0\n\n', ['model', 'objective'], extra_parameters='\n n_estimators : int\n Number of trees in random forest to fit.\n')
class DaskXGBRFClassifier(DaskXGBClassifier):
@_deprecate_po... | 7 | 0 | 11 | 0 | 11 | 0 | 1 | 0.02 | 1 | 7 | 1 | 0 | 4 | 0 | 4 | 52 | 48 | 3 | 44 | 30 | 16 | 1 | 14 | 7 | 9 | 1 | 4 | 0 | 4 |
13,746 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskXGBRFRegressor | from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, List, Optional, ParamSpec, Sequence, Set, Tuple, TypeAlias, TypedDict, TypeGuard, TypeVar, Union
from ..sklearn import XGBClassifier, XGBClassifierBase, XGBModel, XGBRanker, XGBRankerMixIn, XGBRegressorBase, _can_use_qdm, _check_rf_callback, _cls_p... | @xgboost_model_doc('Implementation of the Scikit-Learn API for XGBoost Random Forest Regressor.\n\n .. versionadded:: 1.4.0\n\n', ['model', 'objective'], extra_parameters='\n n_estimators : int\n Number of trees in random forest to fit.\n')
class DaskXGBRFRegressor(DaskXGBRegressor):
@_deprecate_posit... | 7 | 0 | 11 | 0 | 11 | 0 | 1 | 0.02 | 1 | 7 | 1 | 0 | 4 | 0 | 4 | 49 | 48 | 3 | 44 | 30 | 16 | 1 | 14 | 7 | 9 | 1 | 4 | 0 | 4 |
13,747 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskXGBRanker | from dask import dataframe as dd
from ..core import Booster, DMatrix, Metric, Objective, XGBoostError, _check_distributed_params, _deprecate_positional_args, _expect
from .. import collective, config
from ..sklearn import XGBClassifier, XGBClassifierBase, XGBModel, XGBRanker, XGBRankerMixIn, XGBRegressorBase, _can_use_... | @xgboost_model_doc('Implementation of the Scikit-Learn API for XGBoost Ranking.\n\n .. versionadded:: 1.4.0\n\n', ['estimators', 'model'], extra_parameters='\n allow_group_split :\n\n .. versionadded:: 3.0.0\n\n Whether a query group can be split among multiple workers. When set to `False`,\n ... | 10 | 0 | 35 | 1 | 34 | 0 | 4 | 0.02 | 2 | 9 | 1 | 0 | 4 | 11 | 4 | 47 | 207 | 12 | 192 | 76 | 142 | 3 | 66 | 25 | 59 | 13 | 3 | 4 | 21 |
13,748 | dmlc/xgboost | python-package/xgboost/dask/__init__.py | xgboost.dask.DaskXGBRegressor | from .. import collective, config
from typing import Any, Awaitable, Callable, Dict, Generator, Iterable, List, Optional, ParamSpec, Sequence, Set, Tuple, TypeAlias, TypedDict, TypeGuard, TypeVar, Union
from ..sklearn import XGBClassifier, XGBClassifierBase, XGBModel, XGBRanker, XGBRankerMixIn, XGBRegressorBase, _can_u... | @xgboost_model_doc('Implementation of the Scikit-Learn API for XGBoost.', ['estimators', 'model'])
class DaskXGBRegressor(XGBRegressorBase, DaskScikitLearnBase):
'''dummy doc string to workaround pylint, replaced by the decorator.'''
async def _fit_async(self, X: _DataT, y: _DaskCollection, *, sample_weight: O... | 5 | 1 | 40 | 1 | 39 | 0 | 2 | 0.03 | 2 | 4 | 1 | 1 | 2 | 10 | 2 | 45 | 85 | 3 | 80 | 46 | 50 | 2 | 15 | 10 | 12 | 2 | 3 | 1 | 3 |
13,749 | dmlc/xgboost | python-package/xgboost/dask/data.py | xgboost.dask.data.DaskPartitionIter | from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union, cast, overload
from ..core import Booster, DataIter, DMatrix, QuantileDMatrix
from .._typing import FeatureNames, FeatureTypes
from collections.abc import Sequence
from .._data_utils import Categories
class DaskPartitionIter(DataIter):
... |
class DaskPartitionIter(DataIter):
'''A data iterator for the `DaskQuantileDMatrix`.'''
def __init__(self, data: List[Any], feature_names: Optional[FeatureNames]=None, feature_types: Optional[Union[FeatureTypes, Categories]]=None, feature_weights: Optional[Any]=None, **kwargs: Optional[List[Any]]) -> None:
... | 6 | 4 | 10 | 1 | 8 | 1 | 2 | 0.21 | 1 | 5 | 0 | 0 | 5 | 5 | 5 | 35 | 58 | 9 | 42 | 21 | 29 | 9 | 28 | 14 | 22 | 2 | 5 | 1 | 8 |
13,750 | dmlc/xgboost | python-package/xgboost/data.py | xgboost.data.ArrowTransformed | from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeGuard, Union
from ._data_utils import AifType, Categories, DfCatAccessor, TransformedDf, _arrow_array_inf, _ensure_np_dtype, _is_df_cat, array_hasobject, array_interface, array_interface_dict, arrow_cat_inf, check_cud... |
class ArrowTransformed(TransformedDf):
'''A storage class for transformed arrow table.'''
def __init__(self, columns: List[Union['pa.NumericArray', 'pa.DictionaryArray']], ref_categories: Optional[Categories]=None) -> None:
pass
def push_series(col: Union['pa.NumericArray', 'pa.DictionaryArra... | 5 | 2 | 19 | 2 | 17 | 1 | 2 | 0.09 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 3 | 53 | 7 | 43 | 16 | 34 | 4 | 26 | 13 | 20 | 4 | 1 | 2 | 8 |
13,751 | dmlc/xgboost | python-package/xgboost/data.py | xgboost.data.PandasTransformed | import numpy as np
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeGuard, Union
from ._data_utils import AifType, Categories, DfCatAccessor, TransformedDf, _arrow_array_inf, _ensure_np_dtype, _is_df_cat, array_hasobject, array_interface, array_interface_dict, arrow... |
class PandasTransformed(TransformedDf):
'''A storage class for transformed pandas DataFrame.'''
def __init__(self, columns: List[Union[np.ndarray, DfCatAccessor]], ref_categories: Optional[Categories]) -> None:
pass
@property
def shape(self) -> Tuple[int, int]:
'''Return shape of the t... | 4 | 2 | 3 | 0 | 3 | 1 | 1 | 0.3 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 3 | 16 | 3 | 10 | 8 | 5 | 3 | 9 | 7 | 5 | 1 | 1 | 0 | 3 |
13,752 | dmlc/xgboost | python-package/xgboost/data.py | xgboost.data.SingleBatchInternalIter | from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeAlias, TypeGuard, Union
from .core import _LIB, DataIter, DataSplitMode, DMatrix, _check_call, _ProxyDMatrix, c_str, make_jcargs
class SingleBatchInternalIter(DataIter):
"""An iterator for single batch data to help creating... |
class SingleBatchInternalIter(DataIter):
'''An iterator for single batch data to help creating device DMatrix.
Transforming input directly to histogram with normal single batch data API
can not access weight for sketching. So this iterator acts as a staging
area for meta info.
'''
def __init_... | 4 | 1 | 5 | 0 | 4 | 1 | 1 | 0.69 | 1 | 3 | 0 | 0 | 3 | 2 | 3 | 3 | 25 | 5 | 13 | 6 | 9 | 9 | 13 | 6 | 9 | 2 | 1 | 1 | 4 |
13,753 | dmlc/xgboost | python-package/xgboost/federated.py | xgboost.federated.FederatedTracker | from .tracker import RabitTracker
import ctypes
from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs
from typing import Any, Dict, Optional
class FederatedTracker(RabitTracker):
"""Tracker for federated training.
Parameters
----------
n_workers :
The number of federated... |
class FederatedTracker(RabitTracker):
'''Tracker for federated training.
Parameters
----------
n_workers :
The number of federated workers.
port :
The port to listen on.
secure :
Whether this is a secure instance. If True, then the following arguments for SSL
mus... | 3 | 1 | 24 | 0 | 24 | 1 | 1 | 0.69 | 1 | 4 | 0 | 0 | 1 | 1 | 1 | 7 | 51 | 8 | 26 | 16 | 13 | 18 | 6 | 5 | 4 | 1 | 1 | 0 | 1 |
13,754 | dmlc/xgboost | python-package/xgboost/libpath.py | xgboost.libpath.XGBoostLibraryNotFound | class XGBoostLibraryNotFound(Exception):
"""Error thrown by when xgboost is not found""" | class XGBoostLibraryNotFound(Exception):
'''Error thrown by when xgboost is not found'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
13,755 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBClassifier | from scipy.special import softmax
from .training import train
from .core import Booster, DMatrix, Metric, Objective, QuantileDMatrix, XGBoostError, _deprecate_positional_args, _parse_eval_str, _parse_version, _py_version
from .data import _is_cudf_df, _is_cudf_ser, _is_cupy_alike, _is_pandas_df, _is_polars_lazyframe
fr... | @xgboost_model_doc('Implementation of the scikit-learn API for XGBoost classification.', ['model', 'objective'], extra_parameters='\n n_estimators : Optional[int]\n Number of boosting rounds.\n')
class XGBClassifier(XGBClassifierBase, XGBModel):
@_deprecate_positional_args
def __init__(self, *, objec... | 13 | 1 | 31 | 2 | 23 | 6 | 3 | 0.25 | 2 | 7 | 1 | 1 | 7 | 7 | 7 | 40 | 231 | 22 | 167 | 67 | 123 | 42 | 71 | 27 | 63 | 9 | 2 | 3 | 20 |
13,756 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBModel | import numpy as np
from ._typing import ArrayLike, EvalsLog, FeatureNames, FeatureTypes, IterationRange, ModelIn
from .compat import SKLEARN_INSTALLED, XGBClassifierBase, XGBModelBase, XGBRegressorBase, _sklearn_Tags, _sklearn_version, import_cupy, is_dataframe
import json
from .data import _is_cudf_df, _is_cudf_ser, _... | null | 53 | 20 | 21 | 2 | 14 | 6 | 2 | 0.42 | 1 | 16 | 1 | 4 | 32 | 43 | 33 | 33 | 803 | 102 | 498 | 231 | 362 | 209 | 285 | 134 | 246 | 6 | 1 | 4 | 88 |
13,757 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBRFClassifier | from .core import Booster, DMatrix, Metric, Objective, QuantileDMatrix, XGBoostError, _deprecate_positional_args, _parse_eval_str, _parse_version, _py_version
from typing import Any, Callable, Dict, List, Optional, Protocol, Sequence, Set, Tuple, Type, TypeVar, Union, cast
from ._typing import ArrayLike, EvalsLog, Feat... | @xgboost_model_doc('scikit-learn API for XGBoost random forest classification.', ['model', 'objective'], extra_parameters='\n n_estimators : Optional[int]\n Number of trees in random forest to fit.\n')
class XGBRFClassifier(XGBClassifier):
@_deprecate_positional_args
def __init__(self, *, learning_ra... | 8 | 0 | 10 | 0 | 10 | 0 | 1 | 0.05 | 1 | 6 | 0 | 0 | 4 | 0 | 4 | 44 | 49 | 3 | 44 | 30 | 16 | 2 | 15 | 7 | 10 | 1 | 3 | 0 | 4 |
13,758 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBRFRegressor | from ._typing import ArrayLike, EvalsLog, FeatureNames, FeatureTypes, IterationRange, ModelIn
from typing import Any, Callable, Dict, List, Optional, Protocol, Sequence, Set, Tuple, Type, TypeVar, Union, cast
from .core import Booster, DMatrix, Metric, Objective, QuantileDMatrix, XGBoostError, _deprecate_positional_arg... | @xgboost_model_doc('scikit-learn API for XGBoost random forest regression.', ['model', 'objective'], extra_parameters='\n n_estimators : Optional[int]\n Number of trees in random forest to fit.\n')
class XGBRFRegressor(XGBRegressor):
@_deprecate_positional_args
def __init__(self, *, learning_rate: fl... | 8 | 0 | 10 | 0 | 10 | 0 | 1 | 0.05 | 1 | 6 | 0 | 0 | 4 | 0 | 4 | 40 | 49 | 3 | 44 | 30 | 16 | 2 | 15 | 7 | 10 | 1 | 3 | 0 | 4 |
13,759 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBRanker | from .core import Booster, DMatrix, Metric, Objective, QuantileDMatrix, XGBoostError, _deprecate_positional_args, _parse_eval_str, _parse_version, _py_version
from .training import train
from .config import config_context
from typing import Any, Callable, Dict, List, Optional, Protocol, Sequence, Set, Tuple, Type, Type... | @xgboost_model_doc('Implementation of the Scikit-Learn API for XGBoost Ranking.\n\nSee :doc:`Learning to Rank </tutorials/learning_to_rank>` for an introducion.\n\n ', ['estimators', 'model'], end_note='\n .. note::\n\n A custom objective function is currently not supported by XGBRanker.\n\n ... | 11 | 2 | 39 | 4 | 18 | 17 | 2 | 0.89 | 2 | 8 | 1 | 0 | 6 | 6 | 6 | 39 | 244 | 29 | 114 | 58 | 73 | 101 | 37 | 20 | 30 | 3 | 2 | 1 | 10 |
13,760 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBRankerMixIn | class XGBRankerMixIn:
"""MixIn for ranking, defines the _estimator_type usually defined in scikit-learn
base classes.
"""
_estimator_type = 'ranker' | class XGBRankerMixIn:
'''MixIn for ranking, defines the _estimator_type usually defined in scikit-learn
base classes.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 7 | 2 | 2 | 2 | 1 | 3 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
13,761 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn.XGBRegressor | from .compat import SKLEARN_INSTALLED, XGBClassifierBase, XGBModelBase, XGBRegressorBase, _sklearn_Tags, _sklearn_version, import_cupy, is_dataframe
from .core import Booster, DMatrix, Metric, Objective, QuantileDMatrix, XGBoostError, _deprecate_positional_args, _parse_eval_str, _parse_version, _py_version
from typing ... | @xgboost_model_doc('Implementation of the scikit-learn API for XGBoost regression.', ['estimators', 'model', 'objective'])
class XGBRegressor(XGBRegressorBase, XGBModel):
@_deprecate_positional_args
def __init__(self, *, objective: SklObjective='reg:squarederror', **kwargs: Any) -> None:
pass
def ... | 6 | 0 | 5 | 0 | 5 | 0 | 1 | 0.06 | 2 | 4 | 0 | 1 | 3 | 0 | 3 | 36 | 20 | 2 | 17 | 10 | 10 | 1 | 14 | 7 | 10 | 1 | 2 | 0 | 3 |
13,762 | dmlc/xgboost | python-package/xgboost/sklearn.py | xgboost.sklearn._SklObjWProto | from typing import Any, Callable, Dict, List, Optional, Protocol, Sequence, Set, Tuple, Type, TypeVar, Union, cast
from ._typing import ArrayLike, EvalsLog, FeatureNames, FeatureTypes, IterationRange, ModelIn
class _SklObjWProto(Protocol):
def __call__(self, y_true: ArrayLike, y_pred: ArrayLike, sample_weight: Op... |
class _SklObjWProto(Protocol):
def __call__(self, y_true: ArrayLike, y_pred: ArrayLike, sample_weight: Optional[ArrayLike]) -> Tuple[ArrayLike, ArrayLike]:
pass | 2 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 25 | 7 | 0 | 7 | 7 | 1 | 0 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
13,763 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core.SparkXGBModelReader | from .utils import CommunicatorContext, _get_default_params_from_func, _get_gpu_id, _get_host_ip, _get_max_num_concurrent_tasks, _get_rabit_args, _get_spark_session, _is_local, _is_standalone_or_localcluster, deserialize_booster, deserialize_xgb_model, get_class_name, get_logger, get_logger_level, serialize_booster, us... |
class SparkXGBModelReader(MLReader):
'''
Spark Xgboost model reader.
'''
def __init__(self, cls: Type['_SparkXGBModel']) -> None:
pass
def load(self, path: str) -> '_SparkXGBModel':
'''
Load metadata and model for a :py:class:`_SparkXGBModel`
:return: SparkXGBRegre... | 4 | 2 | 11 | 2 | 8 | 1 | 1 | 0.32 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 2 | 36 | 7 | 22 | 11 | 18 | 7 | 16 | 11 | 12 | 1 | 1 | 0 | 3 |
13,764 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core.SparkXGBModelWriter | import os
from pyspark.ml.util import DefaultParamsReader, DefaultParamsWriter, MLReadable, MLReader, MLWritable, MLWriter
from .utils import CommunicatorContext, _get_default_params_from_func, _get_gpu_id, _get_host_ip, _get_max_num_concurrent_tasks, _get_rabit_args, _get_spark_session, _is_local, _is_standalone_or_lo... |
class SparkXGBModelWriter(MLWriter):
'''
Spark Xgboost model writer.
'''
def __init__(self, instance: _SparkXGBModel) -> None:
pass
def saveImpl(self, path: str) -> None:
'''
Save metadata and model for a :py:class:`_SparkXGBModel`
- save metadata to path/metadata
... | 3 | 2 | 12 | 1 | 8 | 3 | 2 | 0.47 | 1 | 5 | 2 | 0 | 2 | 2 | 2 | 2 | 29 | 4 | 17 | 10 | 14 | 8 | 15 | 10 | 12 | 2 | 1 | 1 | 3 |
13,765 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core.SparkXGBReader | from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, cast
from .utils import CommunicatorContext, _get_default_params_from_func, _get_gpu_id, _get_host_ip, _get_max_num_concurrent_tasks, _get_rabit_args, _get_spark_session, _is_local, _is_standalone_or_localcluster, deserialize_booster,... |
class SparkXGBReader(MLReader):
'''
Spark Xgboost estimator reader.
'''
def __init__(self, cls: Type['_SparkXGBEstimator']) -> None:
pass
def load(self, path: str) -> '_SparkXGBEstimator':
'''
load model.
'''
pass | 3 | 2 | 6 | 0 | 5 | 2 | 1 | 0.6 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 2 | 18 | 2 | 10 | 6 | 7 | 6 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
13,766 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core.SparkXGBWriter | from .utils import CommunicatorContext, _get_default_params_from_func, _get_gpu_id, _get_host_ip, _get_max_num_concurrent_tasks, _get_rabit_args, _get_spark_session, _is_local, _is_standalone_or_localcluster, deserialize_booster, deserialize_xgb_model, get_class_name, get_logger, get_logger_level, serialize_booster, us... |
class SparkXGBWriter(MLWriter):
'''
Spark Xgboost estimator writer.
'''
def __init__(self, instance: '_SparkXGBEstimator') -> None:
pass
def saveImpl(self, path: str) -> None:
'''
save model.
'''
pass | 3 | 2 | 5 | 0 | 3 | 2 | 1 | 0.86 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 2 | 15 | 2 | 7 | 5 | 4 | 6 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
13,767 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core._ClassificationModel | from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, cast
from .._typing import ArrayLike
from scipy.special import expit, softmax
from .data import _read_csr_matrix_from_unwrapped_spark_vec, alias, create_dmatrix_from_partitions, pred_contribs, stack_series
from pyspark.sql import Colu... |
class _ClassificationModel(_SparkXGBModel, HasProbabilityCol, HasRawPredictionCol, HasContribPredictionCol):
'''
The model returned by :func:`xgboost.spark.SparkXGBClassifier.fit`
.. Note:: This API is experimental.
'''
def _out_schema(self) -> Tuple[bool, str]:
pass
def _get_predict_... | 6 | 1 | 25 | 3 | 20 | 2 | 2 | 0.15 | 4 | 5 | 1 | 1 | 3 | 0 | 3 | 34 | 99 | 16 | 73 | 27 | 63 | 11 | 44 | 23 | 38 | 5 | 4 | 1 | 12 |
13,768 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core._SparkXGBEstimator | from .summary import XGBoostTrainingSummary
from pyspark.sql.types import ArrayType, BooleanType, DoubleType, FloatType, IntegerType, IntegralType, LongType, ShortType
from ..sklearn import DEFAULT_N_ESTIMATORS, XGBClassifier, XGBModel, _can_use_qdm
from .utils import CommunicatorContext, _get_default_params_from_func,... |
class _SparkXGBEstimator(Estimator, _SparkXGBParams, MLReadable, MLWritable):
def __init__(self) -> None:
pass
def setParams(self, **kwargs: Any) -> None:
'''
Set params for the estimator.
'''
pass
@classmethod
def _pyspark_model_cls(cls) -> Type['_SparkXGBMode... | 23 | 11 | 36 | 4 | 28 | 4 | 4 | 0.17 | 4 | 21 | 7 | 3 | 14 | 1 | 17 | 35 | 599 | 81 | 445 | 122 | 411 | 75 | 270 | 107 | 249 | 14 | 3 | 3 | 75 |
13,769 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core._SparkXGBModel | from pyspark.ml import Estimator, Model
from pyspark.ml.functions import array_to_vector, vector_to_array
from pyspark.sql import Column, DataFrame
import pandas as pd
from pyspark.sql.functions import col, countDistinct, pandas_udf, rand, struct
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, ... |
class _SparkXGBModel(Model, _SparkXGBParams, MLReadable, MLWritable):
def __init__(self, xgb_sklearn_model: Optional[XGBModel]=None, training_summary: Optional[XGBoostTrainingSummary]=None) -> None:
pass
@classmethod
def _xgb_cls(cls) -> Type[XGBModel]:
pass
def get_booster(self) -> B... | 20 | 11 | 23 | 4 | 16 | 4 | 3 | 0.28 | 4 | 13 | 5 | 3 | 11 | 2 | 13 | 31 | 291 | 53 | 187 | 73 | 154 | 53 | 138 | 60 | 118 | 11 | 3 | 4 | 41 |
13,770 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core._SparkXGBParams | from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, cast
from ..collective import Config
from ..sklearn import DEFAULT_N_ESTIMATORS, XGBClassifier, XGBModel, _can_use_qdm
from .utils import CommunicatorContext, _get_default_params_from_func, _get_gpu_id, _get_host_ip, _get_max_num_conc... | null | 21 | 14 | 15 | 1 | 11 | 2 | 3 | 0.16 | 11 | 10 | 3 | 2 | 12 | 0 | 16 | 18 | 328 | 27 | 260 | 70 | 223 | 41 | 115 | 50 | 98 | 15 | 2 | 5 | 44 |
13,771 | dmlc/xgboost | python-package/xgboost/spark/core.py | xgboost.spark.core._SparkXGBSharedReadWrite | from pyspark import RDD, SparkConf, SparkContext, cloudpickle
from ..collective import Config
import logging
from dataclasses import asdict
import base64
import os
from pyspark.ml.util import DefaultParamsReader, DefaultParamsWriter, MLReadable, MLReader, MLWritable, MLWriter
from typing import Any, Callable, Dict, Ite... |
class _SparkXGBSharedReadWrite:
@staticmethod
def saveMetadata(instance: Union[_SparkXGBEstimator, _SparkXGBModel], path: str, sc: SparkContext, logger: logging.Logger, extraMetadata: Optional[Dict[str, Any]]=None) -> None:
'''
Save the metadata of an xgboost.spark._SparkXGBEstimator or
... | 5 | 2 | 46 | 4 | 38 | 7 | 7 | 0.18 | 0 | 7 | 3 | 0 | 0 | 0 | 2 | 2 | 95 | 8 | 78 | 33 | 62 | 14 | 46 | 19 | 43 | 8 | 0 | 2 | 13 |
13,772 | dmlc/xgboost | python-package/xgboost/spark/data.py | xgboost.spark.data.PartIter | import pandas as pd
from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Tuple, Union
from ..core import DataIter, DMatrix, QuantileDMatrix
class PartIter(DataIter):
"""Iterator for creating Quantile DMatrix from partitions."""
def __init__(self, data: Dict[str, List], device_id: Option... |
class PartIter(DataIter):
'''Iterator for creating Quantile DMatrix from partitions.'''
def __init__(self, data: Dict[str, List], device_id: Optional[int], **kwargs: Any) -> None:
pass
def _fetch(self, data: Optional[Sequence[pd.DataFrame]]) -> Optional[pd.DataFrame]:
pass
def next(s... | 5 | 1 | 10 | 1 | 8 | 1 | 2 | 0.12 | 1 | 5 | 0 | 0 | 4 | 4 | 4 | 34 | 44 | 8 | 33 | 13 | 24 | 4 | 24 | 11 | 17 | 3 | 5 | 1 | 7 |
13,773 | dmlc/xgboost | python-package/xgboost/spark/estimator.py | xgboost.spark.estimator.SparkXGBClassifier | from ..collective import Config
from typing import Any, List, Optional, Type, Union
from pyspark.ml.param.shared import HasProbabilityCol, HasRawPredictionCol
from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor
from pyspark import keyword_only
from .core import _ClassificationModel, _SparkXGBEstimator, _SparkX... |
class SparkXGBClassifier(_SparkXGBEstimator, HasProbabilityCol, HasRawPredictionCol):
'''SparkXGBClassifier is a PySpark ML estimator. It implements the XGBoost
classification algorithm based on XGBoost python library, and it can be used in
PySpark Pipeline and PySpark ML meta algorithms like
- :py:cla... | 8 | 1 | 12 | 0 | 11 | 2 | 2 | 2.37 | 3 | 9 | 3 | 0 | 2 | 0 | 4 | 39 | 179 | 26 | 46 | 30 | 17 | 109 | 18 | 6 | 13 | 3 | 4 | 1 | 7 |
13,774 | dmlc/xgboost | python-package/xgboost/spark/estimator.py | xgboost.spark.estimator.SparkXGBClassifierModel | from .core import _ClassificationModel, _SparkXGBEstimator, _SparkXGBModel
from typing import Any, List, Optional, Type, Union
from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor
class SparkXGBClassifierModel(_ClassificationModel):
"""
The model returned by :func:`xgboost.spark.SparkXGBClassifier.fit`... |
class SparkXGBClassifierModel(_ClassificationModel):
'''
The model returned by :func:`xgboost.spark.SparkXGBClassifier.fit`
.. Note:: This API is experimental.
'''
@classmethod
def _xgb_cls(cls) -> Type[XGBClassifier]:
pass | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 35 | 10 | 2 | 4 | 3 | 1 | 4 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
13,775 | dmlc/xgboost | python-package/xgboost/spark/estimator.py | xgboost.spark.estimator.SparkXGBRanker | from .core import _ClassificationModel, _SparkXGBEstimator, _SparkXGBModel
from pyspark import keyword_only
from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor
from typing import Any, List, Optional, Type, Union
from ..collective import Config
class SparkXGBRanker(_SparkXGBEstimator):
"""SparkXGBRanker is... |
class SparkXGBRanker(_SparkXGBEstimator):
'''SparkXGBRanker is a PySpark ML estimator. It implements the XGBoost
ranking algorithm based on XGBoost python library, and it can be used in
PySpark Pipeline and PySpark ML meta algorithms like
:py:class:`~pyspark.ml.tuning.CrossValidator`/
:py:class:`~p... | 8 | 1 | 9 | 0 | 9 | 0 | 2 | 2.7 | 1 | 9 | 3 | 0 | 2 | 0 | 4 | 39 | 170 | 23 | 40 | 29 | 12 | 108 | 15 | 6 | 10 | 2 | 4 | 1 | 6 |
13,776 | dmlc/xgboost | python-package/xgboost/spark/estimator.py | xgboost.spark.estimator.SparkXGBRankerModel | from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor
from typing import Any, List, Optional, Type, Union
from .core import _ClassificationModel, _SparkXGBEstimator, _SparkXGBModel
class SparkXGBRankerModel(_SparkXGBModel):
"""
The model returned by :func:`xgboost.spark.SparkXGBRanker.fit`
.. Note:... |
class SparkXGBRankerModel(_SparkXGBModel):
'''
The model returned by :func:`xgboost.spark.SparkXGBRanker.fit`
.. Note:: This API is experimental.
'''
@classmethod
def _xgb_cls(cls) -> Type[XGBRanker]:
pass | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 32 | 10 | 2 | 4 | 3 | 1 | 4 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
13,777 | dmlc/xgboost | python-package/xgboost/spark/estimator.py | xgboost.spark.estimator.SparkXGBRegressor | from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor
from typing import Any, List, Optional, Type, Union
from .core import _ClassificationModel, _SparkXGBEstimator, _SparkXGBModel
from pyspark import keyword_only
from ..collective import Config
class SparkXGBRegressor(_SparkXGBEstimator):
"""SparkXGBRegres... |
class SparkXGBRegressor(_SparkXGBEstimator):
'''SparkXGBRegressor is a PySpark ML estimator. It implements the XGBoost regression
algorithm based on XGBoost python library, and it can be used in PySpark Pipeline
and PySpark ML meta algorithms like
- :py:class:`~pyspark.ml.tuning.CrossValidator`/
- ... | 8 | 1 | 9 | 0 | 9 | 0 | 2 | 2.46 | 1 | 9 | 3 | 0 | 2 | 0 | 4 | 39 | 160 | 26 | 39 | 28 | 12 | 96 | 15 | 6 | 10 | 2 | 4 | 1 | 6 |
13,778 | dmlc/xgboost | python-package/xgboost/spark/estimator.py | xgboost.spark.estimator.SparkXGBRegressorModel | from .core import _ClassificationModel, _SparkXGBEstimator, _SparkXGBModel
from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor
from typing import Any, List, Optional, Type, Union
class SparkXGBRegressorModel(_SparkXGBModel):
"""
The model returned by :func:`xgboost.spark.SparkXGBRegressor.fit`
..... |
class SparkXGBRegressorModel(_SparkXGBModel):
'''
The model returned by :func:`xgboost.spark.SparkXGBRegressor.fit`
.. Note:: This API is experimental.
'''
@classmethod
def _xgb_cls(cls) -> Type[XGBRegressor]:
pass | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 32 | 10 | 2 | 4 | 3 | 1 | 4 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
13,779 | dmlc/xgboost | python-package/xgboost/spark/params.py | xgboost.spark.params.HasArbitraryParamsDict | from pyspark.ml.param.shared import Param, Params
class HasArbitraryParamsDict(Params):
"""
This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the **kwargs parts of the XGBoost
input.
"""
arbitrary_params_dict: 'Param[Dict]' = Param(Params._dummy(),... |
class HasArbitraryParamsDict(Params):
'''
This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the **kwargs parts of the XGBoost
input.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.63 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 14 | 1 | 8 | 2 | 7 | 5 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
13,780 | dmlc/xgboost | python-package/xgboost/spark/params.py | xgboost.spark.params.HasBaseMarginCol | from pyspark.ml.param import TypeConverters
from pyspark.ml.param.shared import Param, Params
class HasBaseMarginCol(Params):
"""
This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the base margin column part of XGboost.
"""
base_margin_col = Param(Para... |
class HasBaseMarginCol(Params):
'''
This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the base margin column part of XGboost.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.57 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 12 | 1 | 7 | 2 | 6 | 4 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
13,781 | dmlc/xgboost | python-package/xgboost/spark/params.py | xgboost.spark.params.HasContribPredictionCol | from pyspark.ml.param import TypeConverters
from pyspark.ml.param.shared import Param, Params
class HasContribPredictionCol(Params):
"""
Mixin for param pred_contrib_col: contribution prediction column name.
Output is a 3-dim array, with (rows, groups, columns + 1) for classification case.
Else, it ca... |
class HasContribPredictionCol(Params):
'''
Mixin for param pred_contrib_col: contribution prediction column name.
Output is a 3-dim array, with (rows, groups, columns + 1) for classification case.
Else, it can be a 2 dimension for regression case.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.71 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 14 | 2 | 7 | 2 | 6 | 5 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
13,782 | dmlc/xgboost | python-package/xgboost/spark/params.py | xgboost.spark.params.HasEnableSparseDataOptim | from pyspark.ml.param import TypeConverters
from pyspark.ml.param.shared import Param, Params
class HasEnableSparseDataOptim(Params):
"""
This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the boolean config of enabling sparse data optimization.
"""
ena... |
class HasEnableSparseDataOptim(Params):
'''
This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the boolean config of enabling sparse data optimization.
'''
def __init__(self) -> None:
pass | 2 | 1 | 3 | 0 | 3 | 0 | 1 | 0.31 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 19 | 2 | 13 | 3 | 11 | 4 | 5 | 3 | 3 | 1 | 1 | 0 | 1 |
13,783 | dmlc/xgboost | python-package/xgboost/spark/params.py | xgboost.spark.params.HasFeaturesCols | from pyspark.ml.param.shared import Param, Params
from pyspark.ml.param import TypeConverters
class HasFeaturesCols(Params):
"""
Mixin for param features_cols: a list of feature column names.
This parameter is taken effect only when GPU is enabled.
"""
features_cols = Param(Params._dummy(), 'featur... |
class HasFeaturesCols(Params):
'''
Mixin for param features_cols: a list of feature column names.
This parameter is taken effect only when GPU is enabled.
'''
def __init__(self) -> None:
pass | 2 | 1 | 3 | 0 | 3 | 0 | 1 | 0.4 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 16 | 2 | 10 | 3 | 8 | 4 | 5 | 3 | 3 | 1 | 1 | 0 | 1 |
13,784 | dmlc/xgboost | python-package/xgboost/spark/params.py | xgboost.spark.params.HasQueryIdCol | from pyspark.ml.param.shared import Param, Params
from pyspark.ml.param import TypeConverters
class HasQueryIdCol(Params):
"""
Mixin for param qid_col: query id column name.
"""
qid_col = Param(Params._dummy(), 'qid_col', 'query id column name', typeConverter=TypeConverters.toString) |
class HasQueryIdCol(Params):
'''
Mixin for param qid_col: query id column name.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.43 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 11 | 1 | 7 | 2 | 6 | 3 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
13,785 | dmlc/xgboost | python-package/xgboost/spark/summary.py | xgboost.spark.summary.XGBoostTrainingSummary | from dataclasses import dataclass, field
from typing import Dict, List
@dataclass
class XGBoostTrainingSummary:
"""
A class that holds the training and validation objective history
of an XGBoost model during its training process.
"""
train_objective_history: Dict[str, List[float]] = field(default_f... | @dataclass
class XGBoostTrainingSummary:
'''
A class that holds the training and validation objective history
of an XGBoost model during its training process.
'''
@staticmethod
def from_metrics(metrics: Dict[str, Dict[str, List[float]]]) -> 'XGBoostTrainingSummary':
'''
Create an... | 4 | 2 | 26 | 3 | 8 | 15 | 1 | 1.58 | 0 | 2 | 0 | 0 | 0 | 0 | 1 | 1 | 36 | 5 | 12 | 9 | 7 | 19 | 7 | 6 | 5 | 1 | 0 | 0 | 1 |
13,786 | dmlc/xgboost | python-package/xgboost/spark/utils.py | xgboost.spark.utils.CommunicatorContext | from ..collective import _ArgVals as CollArgsVals
from ..collective import CommunicatorContext as CCtx
from pyspark import BarrierTaskContext, SparkConf, SparkContext, SparkFiles, TaskContext
class CommunicatorContext(CCtx):
"""Context with PySpark specific task ID."""
def __init__(self, context: BarrierTaskC... |
class CommunicatorContext(CCtx):
'''Context with PySpark specific task ID.'''
def __init__(self, context: BarrierTaskContext, **args: CollArgsVals) -> None:
pass | 2 | 1 | 3 | 0 | 3 | 0 | 1 | 0.25 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 4 | 6 | 1 | 4 | 2 | 2 | 1 | 4 | 2 | 2 | 1 | 1 | 0 | 1 |
13,787 | dmlc/xgboost | python-package/xgboost/tracker.py | xgboost.tracker.RabitTracker | from typing import Dict, Optional, Union
from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs
import ctypes
from enum import IntEnum, unique
import json
class RabitTracker:
"""Tracker for the collective used in XGBoost, acting as a coordinator between
workers.
Parameters
------... |
class RabitTracker:
'''Tracker for the collective used in XGBoost, acting as a coordinator between
workers.
Parameters
----------
n_workers:
The total number of workers in the communication group.
host_ip:
The IP address of the tracker node. XGBoost can try to guess one by probi... | 10 | 5 | 9 | 1 | 7 | 2 | 2 | 1.09 | 0 | 6 | 1 | 1 | 6 | 1 | 6 | 6 | 126 | 30 | 47 | 26 | 29 | 51 | 30 | 16 | 22 | 4 | 0 | 1 | 10 |
13,788 | dmlc/xgboost | python-package/xgboost/training.py | xgboost.training.CVPack | from ._typing import BoosterParam, Callable, FPreProcCallable
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union, cast
from .core import Booster, DMatrix, Metric, Objective, XGBoostError, _deprecate_positional_args, _RefMixIn
class CVPack:
""" "Auxiliary datastruct to hol... |
class CVPack:
''' "Auxiliary datastruct to hold one fold of CV.'''
def __init__(self, dtrain: DMatrix, dtest: DMatrix, param: Optional[Union[Dict, List]]) -> None:
'''Initialize the CVPack.'''
pass
def __getattr__(self, name: str) -> Callable:
pass
def _inner(*args: Any, ... | 6 | 4 | 4 | 0 | 3 | 1 | 1 | 0.25 | 0 | 4 | 0 | 0 | 4 | 4 | 4 | 4 | 25 | 5 | 16 | 12 | 8 | 4 | 14 | 10 | 8 | 1 | 0 | 0 | 5 |
13,789 | dmlc/xgboost | python-package/xgboost/training.py | xgboost.training._PackedBooster | from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union, cast
from .core import Booster, DMatrix, Metric, Objective, XGBoostError, _deprecate_positional_args, _RefMixIn
class _PackedBooster:
def __init__(self, cvfolds: _CVFolds) -> None:
self.cvfolds = cvfolds
de... |
class _PackedBooster:
def __init__(self, cvfolds: _CVFolds) -> None:
pass
def update(self, iteration: int, obj: Optional[Objective]) -> None:
'''Iterate through folds for update'''
pass
def eval(self, iteration: int, feval: Optional[Metric], output_margin: bool) -> List[str]:
... | 16 | 9 | 4 | 0 | 3 | 1 | 1 | 0.24 | 0 | 5 | 0 | 0 | 11 | 1 | 11 | 11 | 56 | 10 | 37 | 27 | 15 | 9 | 27 | 17 | 15 | 2 | 0 | 1 | 14 |
13,790 | samuelcolvin/pydantic | tests/typechecking/base_model.py | base_model.Knight | from pydantic import BaseModel, Field
class Knight(BaseModel):
title: str = Field(default='Sir Lancelot')
age: int = Field(23) |
class Knight(BaseModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 83 | 3 | 0 | 3 | 3 | 2 | 2 | 3 | 3 | 2 | 0 | 5 | 0 | 0 |
13,791 | samuelcolvin/pydantic | tests/typechecking/base_model.py | base_model.MyModel | from pydantic import BaseModel, Field
class MyModel(BaseModel):
x: str
y: list[int]
z: int = 1 |
class MyModel(BaseModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 83 | 4 | 0 | 4 | 2 | 3 | 0 | 4 | 2 | 3 | 0 | 5 | 0 | 0 |
13,792 | samuelcolvin/pydantic | tests/typechecking/computed_field.py | computed_field.Square | from functools import cached_property
from pydantic import BaseModel, computed_field
class Square(BaseModel):
side: float
@computed_field
@property
def area(self) -> float:
return self.side ** 2
@computed_field
@cached_property
def area_cached(self) -> float:
return self.s... |
class Square(BaseModel):
@computed_field
@property
def area(self) -> float:
pass
@computed_field
@cached_property
def area_cached(self) -> float:
pass | 7 | 0 | 2 | 0 | 2 | 0 | 1 | 0.4 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 85 | 14 | 2 | 10 | 5 | 3 | 4 | 6 | 3 | 3 | 1 | 5 | 0 | 2 |
13,793 | samuelcolvin/pydantic | tests/mypy/modules/config_conditional_extra.py | config_conditional_extra.MyModel | from pydantic import BaseModel, ConfigDict
class MyModel(BaseModel):
model_config = ConfigDict(extra='ignore' if condition() else 'forbid') |
class MyModel(BaseModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 83 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 5 | 0 | 0 |
13,794 | samuelcolvin/pydantic | docs/plugins/conversion_table.py | conversion_table.ConversionTable | from collections.abc import Callable, Iterable, Mapping, Sequence
from dataclasses import dataclass
from typing import Any
@dataclass
class ConversionTable:
rows: list[Row]
col_names = ['Field Type', 'Input', 'Strict', 'Input Source', 'Conditions']
open_nowrap_span = '<span style="white-space: nowrap;">'
... | @dataclass
class ConversionTable:
def col_values(self, row: Row) -> list[str]:
pass
@staticmethod
def row_as_markdown(cols: list[str]) -> str:
pass
def as_markdown(self) -> str:
pass
@staticmethod
def row_sort_key(row: Row) -> Any:
pass
def sorted(self) -> ... | 10 | 0 | 5 | 0 | 4 | 0 | 2 | 0.03 | 0 | 5 | 1 | 0 | 4 | 0 | 6 | 6 | 49 | 9 | 39 | 19 | 30 | 1 | 25 | 17 | 18 | 3 | 0 | 1 | 9 |
13,795 | samuelcolvin/pydantic | docs/plugins/conversion_table.py | conversion_table.Row | from pydantic_core import CoreSchema, core_schema
from dataclasses import dataclass
from typing import Any
@dataclass
class Row:
field_type: type[Any] | str
input_type: type[Any] | str
python_input: bool = False
json_input: bool = False
strict: bool = False
condition: str | None = None
vali... | @dataclass
class Row:
@property
def field_type_str(self) -> str:
pass
@property
def input_type_str(self) -> str:
pass
@property
def input_source_str(self) -> str:
pass | 8 | 0 | 5 | 0 | 5 | 0 | 3 | 0 | 0 | 1 | 0 | 0 | 3 | 0 | 3 | 3 | 30 | 3 | 27 | 14 | 20 | 0 | 21 | 11 | 17 | 4 | 0 | 2 | 8 |
13,796 | samuelcolvin/pydantic | tests/mypy/modules/covariant_typevar.py | covariant_typevar.Bar | class Bar(Foo[T]):
... | class Bar(Foo[T]):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 85 | 1 | 0 | 1 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 6 | 0 | 0 |
13,797 | samuelcolvin/pydantic | tests/mypy/modules/covariant_typevar.py | covariant_typevar.Foo | from pydantic import BaseModel
from typing import Generic, TypeVar
class Foo(BaseModel, Generic[T]):
value: T |
class Foo(BaseModel, Generic[T]):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 85 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
13,798 | samuelcolvin/pydantic | tests/mypy/modules/custom_constructor.py | custom_constructor.Person | from pydantic import BaseModel
class Person(BaseModel):
id: int
name: str
birth_year: int
def __init__(self, id: int) -> None:
super().__init__(id=id, name='Patrick', birth_year=1991) |
class Person(BaseModel):
def __init__(self, id: int) -> None:
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 84 | 7 | 1 | 6 | 2 | 4 | 0 | 6 | 2 | 4 | 1 | 5 | 0 | 1 |
13,799 | samuelcolvin/pydantic | tests/mypy/modules/dataclass_no_any.py | dataclass_no_any.Bar | from pydantic.dataclasses import dataclass
@dataclass(config={'title': 'Bar Title'})
class Bar:
bar: str | @dataclass(config={'title': 'Bar Title'})
class Bar:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.