python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
import numpy as np import xgboost as xgb import pytest try: import shap except ImportError: shap = None pass pytestmark = pytest.mark.skipif(shap is None, reason="Requires shap package") # Check integration is not broken from xgboost side # Changes in binary format may cause problems def test_with_shap(...
spark-xgboost-nv-release_1.4.0
tests/python/test_with_shap.py
import xgboost import numpy as np import os kRounds = 2 kRows = 1000 kCols = 4 kForests = 2 kMaxDepth = 2 kClasses = 3 X = np.random.randn(kRows, kCols) w = np.random.uniform(size=kRows) version = xgboost.__version__ np.random.seed(1994) target_dir = 'models' def booster_bin(model): return os.path.join(target...
spark-xgboost-nv-release_1.4.0
tests/python/generate_models.py
import xgboost as xgb import pytest import os import testing as tm import tempfile # We use the dataset for tests. pytestmark = pytest.mark.skipif(**tm.no_sklearn()) class TestCallbacks: @classmethod def setup_class(cls): from sklearn.datasets import load_breast_cancer X, y = load_breast_canc...
spark-xgboost-nv-release_1.4.0
tests/python/test_callback.py
import numpy as np import xgboost as xgb import os import json import testing as tm import pytest import locale import tempfile dpath = os.path.join(tm.PROJECT_ROOT, 'demo/data/') dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train') dtest = xgb.DMatrix(dpath + 'agaricus.txt.test') rng = np.random.RandomState(1994) de...
spark-xgboost-nv-release_1.4.0
tests/python/test_basic_models.py
import testing as tm import pytest import numpy as np import xgboost as xgb import json import os dpath = os.path.join(tm.PROJECT_ROOT, 'demo', 'data') def test_aft_survival_toy_data(): # See demo/aft_survival/aft_survival_viz_demo.py X = np.array([1, 2, 3, 4, 5]).reshape((-1, 1)) INF = np.inf y_lowe...
spark-xgboost-nv-release_1.4.0
tests/python/test_survival.py
# -*- coding: utf-8 -*- import pytest import numpy as np import testing as tm import xgboost as xgb try: import datatable as dt import pandas as pd except ImportError: pass pytestmark = pytest.mark.skipif( tm.no_dt()['condition'] or tm.no_pandas()['condition'], reason=tm.no_dt()['reason'] + ' or ...
spark-xgboost-nv-release_1.4.0
tests/python/test_dt.py
# -*- coding: utf-8 -*- import os import tempfile import numpy as np import xgboost as xgb import scipy.sparse import pytest from scipy.sparse import rand, csr_matrix import testing as tm rng = np.random.RandomState(1) dpath = 'demo/data/' rng = np.random.RandomState(1994) class TestDMatrix: def test_warn_miss...
spark-xgboost-nv-release_1.4.0
tests/python/test_dmatrix.py
'''Tests for running inplace prediction.''' from concurrent.futures import ThreadPoolExecutor import numpy as np from scipy import sparse import pytest import pandas as pd import testing as tm import xgboost as xgb def run_threaded_predict(X, rows, predict_func): results = [] per_thread = 20 with ThreadP...
spark-xgboost-nv-release_1.4.0
tests/python/test_predict.py
import numpy as np from scipy.sparse import csr_matrix import testing as tm import xgboost import os import itertools import shutil import urllib.request import zipfile def test_ranking_with_unweighted_data(): Xrow = np.array([1, 2, 6, 8, 11, 14, 16, 17]) Xcol = np.array([0, 0, 1, 1, 2, 2, 3, 3]) X = ...
spark-xgboost-nv-release_1.4.0
tests/python/test_ranking.py
from xgboost import RabitTracker import xgboost as xgb import pytest import testing as tm import numpy as np import sys if sys.platform.startswith("win"): pytest.skip("Skipping dask tests on Windows", allow_module_level=True) def test_rabit_tracker(): tracker = RabitTracker(hostIP='127.0.0.1', nslave=1) ...
spark-xgboost-nv-release_1.4.0
tests/python/test_tracker.py
import pickle import numpy as np import xgboost as xgb import os kRows = 100 kCols = 10 def generate_data(): X = np.random.randn(kRows, kCols) y = np.random.randn(kRows) return X, y class TestPickling: def run_model_pickling(self, xgb_params): X, y = generate_data() dtrain = xgb.DM...
spark-xgboost-nv-release_1.4.0
tests/python/test_pickling.py
# -*- coding: utf-8 -*- import xgboost as xgb import pytest import testing as tm @pytest.mark.parametrize('verbosity_level', [0, 1, 2, 3]) def test_global_config_verbosity(verbosity_level): def get_current_verbosity(): return xgb.get_config()['verbosity'] old_verbosity = get_current_verbosity() w...
spark-xgboost-nv-release_1.4.0
tests/python/test_config.py
import os import subprocess import pytest import testing as tm import sys ROOT_DIR = tm.PROJECT_ROOT DEMO_DIR = os.path.join(ROOT_DIR, 'demo') PYTHON_DEMO_DIR = os.path.join(DEMO_DIR, 'guide-python') CLI_DEMO_DIR = os.path.join(DEMO_DIR, 'CLI') def test_basic_walkthrough(): script = os.path.join(PYTHON_DEMO_DIR...
spark-xgboost-nv-release_1.4.0
tests/python/test_demos.py
import testing as tm from hypothesis import strategies, given, settings, note import xgboost as xgb parameter_strategy = strategies.fixed_dictionaries({ 'booster': strategies.just('gblinear'), 'eta': strategies.floats(0.01, 0.25), 'tolerance': strategies.floats(1e-5, 1e-2), 'nthread': strategies.intege...
spark-xgboost-nv-release_1.4.0
tests/python/test_linear.py
from pathlib import Path import pickle import testing as tm import pytest import xgboost as xgb import sys import numpy as np import scipy import json from typing import List, Tuple, Dict, Optional, Type, Any import asyncio from functools import partial from concurrent.futures import ThreadPoolExecutor import tempfile ...
spark-xgboost-nv-release_1.4.0
tests/python/test_with_dask.py
import testing as tm import pytest import xgboost as xgb import numpy as np from hypothesis import given, strategies, settings, note exact_parameter_strategy = strategies.fixed_dictionaries({ 'nthread': strategies.integers(1, 4), 'max_depth': strategies.integers(1, 11), 'min_child_weight': strategies.float...
spark-xgboost-nv-release_1.4.0
tests/python/test_updaters.py
# -*- coding: utf-8 -*- import numpy as np import xgboost as xgb import testing as tm import pytest try: import pandas as pd except ImportError: pass pytestmark = pytest.mark.skipif(**tm.no_pandas()) dpath = 'demo/data/' rng = np.random.RandomState(1994) class TestPandas: def test_pandas(self): ...
spark-xgboost-nv-release_1.4.0
tests/python/test_with_pandas.py
# coding: utf-8 import os import urllib import zipfile import sys from contextlib import contextmanager from io import StringIO from xgboost.compat import SKLEARN_INSTALLED, PANDAS_INSTALLED from xgboost.compat import DASK_INSTALLED import pytest import tempfile import xgboost as xgb import numpy as np hypothesis = py...
spark-xgboost-nv-release_1.4.0
tests/python/testing.py
# -*- coding: utf-8 -*- import numpy as np import xgboost as xgb import testing as tm import pytest try: import modin.pandas as md except ImportError: pass pytestmark = pytest.mark.skipif(**tm.no_modin()) dpath = 'demo/data/' rng = np.random.RandomState(1994) class TestModin: def test_modin(self): ...
spark-xgboost-nv-release_1.4.0
tests/python/test_with_modin.py
# -*- coding: utf-8 -*- import xgboost as xgb import numpy as np class TestOMP: def test_omp(self): dpath = 'demo/data/' dtrain = xgb.DMatrix(dpath + 'agaricus.txt.train') dtest = xgb.DMatrix(dpath + 'agaricus.txt.test') param = {'booster': 'gbtree', 'objective': ...
spark-xgboost-nv-release_1.4.0
tests/python/test_openmp.py
import xgboost as xgb import numpy as np import pytest import testing as tm pytestmark = pytest.mark.skipif(**tm.no_pandas()) dpath = 'demo/data/' rng = np.random.RandomState(1994) class TestTreesToDataFrame: def build_model(self, max_depth, num_round): dtrain = xgb.DMatrix(dpath + 'agaricus.txt.trai...
spark-xgboost-nv-release_1.4.0
tests/python/test_parse_tree.py
import os import tempfile import platform import xgboost import subprocess import numpy import json import testing as tm class TestCLI: template = ''' booster = gbtree objective = reg:squarederror eta = 1.0 gamma = 1.0 seed = {seed} min_child_weight = 0 max_depth = 3 task = {task} model_in = {model_in} model_out ...
spark-xgboost-nv-release_1.4.0
tests/python/test_cli.py
import collections import importlib.util import numpy as np import xgboost as xgb import testing as tm import tempfile import os import shutil import pytest import json rng = np.random.RandomState(1994) pytestmark = pytest.mark.skipif(**tm.no_sklearn()) class TemporaryDirectory(object): """Context manager for t...
spark-xgboost-nv-release_1.4.0
tests/python/test_with_sklearn.py
import xgboost as xgb import testing as tm import numpy as np import pytest rng = np.random.RandomState(1337) class TestEvalMetrics: xgb_params_01 = { 'verbosity': 0, 'nthread': 1, 'eval_metric': 'error' } xgb_params_02 = { 'verbosity': 0, 'nthread': 1, 'e...
spark-xgboost-nv-release_1.4.0
tests/python/test_eval_metrics.py
import numpy as np import xgboost as xgb import testing as tm import pytest dpath = 'demo/data/' def is_increasing(y): return np.count_nonzero(np.diff(y) < 0.0) == 0 def is_decreasing(y): return np.count_nonzero(np.diff(y) > 0.0) == 0 def is_correctly_constrained(learner): n = 100 variable_x = np...
spark-xgboost-nv-release_1.4.0
tests/python/test_monotone_constraints.py
#!/usr/bin/python import xgboost as xgb import numpy as np xgb.rabit.init() X = [ [15.00,28.90,29.00,3143.70,0.00,0.10,69.90,90.00,13726.07,0.00,2299.70,0.00,0.05, 4327.03,0.00,24.00,0.18,3.00,0.41,3.77,0.00,0.00,4.00,0.00,150.92,0.00,2.00,0.00, 0.01,138.00,1.00,0.02,69.90,0.00,0.83,5.00,0.01,0.12,47.30,0.00,...
spark-xgboost-nv-release_1.4.0
tests/distributed/test_issue3402.py
#!/usr/bin/python import xgboost as xgb # Always call this before using distributed module xgb.rabit.init() # Load file, file will be automatically sharded in distributed mode. dtrain = xgb.DMatrix('../../demo/data/agaricus.txt.train') dtest = xgb.DMatrix('../../demo/data/agaricus.txt.test') # Specify parameters via...
spark-xgboost-nv-release_1.4.0
tests/distributed/test_basic.py
"""Distributed GPU tests.""" import sys import xgboost as xgb import os import numpy as np def run_test(name, params_fun): """Runs a distributed GPU test.""" # Always call this before using distributed module xgb.rabit.init() rank = xgb.rabit.get_rank() world = xgb.rabit.get_world_size() # Lo...
spark-xgboost-nv-release_1.4.0
tests/distributed/distributed_gpu.py
import numpy as np import sys import gc import pytest import xgboost as xgb from hypothesis import given, strategies, assume, settings, note sys.path.append("tests/python") import testing as tm parameter_strategy = strategies.fixed_dictionaries({ 'max_depth': strategies.integers(0, 11), 'max_leaves': strategi...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_updaters.py
import sys import pytest import numpy as np import xgboost as xgb from xgboost.compat import PANDAS_INSTALLED from hypothesis import given, strategies, assume, settings, note if PANDAS_INSTALLED: from hypothesis.extra.pandas import column, data_frames, range_indexes else: def noop(*args, **kwargs): p...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_prediction.py
'''Loading a pickled model generated by test_pickling.py, only used by `test_gpu_with_dask.py`''' import os import numpy as np import xgboost as xgb import json import pytest import sys from test_gpu_pickling import build_dataset, model_path, load_pickle sys.path.append("tests/python") import testing as tm class Te...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/load_pickle.py
import sys import pytest import logging sys.path.append("tests/python") import testing as tm # noqa def has_rmm(): try: import rmm return True except ImportError: return False @pytest.fixture(scope='session', autouse=True) def setup_rmm_pool(request, pytestcon...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/conftest.py
import numpy as np import xgboost as xgb import sys import pytest sys.path.append("tests/python") import testing as tm def dmatrix_from_cupy(input_type, DMatrixT, missing=np.NAN): '''Test constructing DMatrix from cupy''' import cupy as cp kRows = 80 kCols = 3 np_X = np.random.randn(kRows, kCol...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_from_cupy.py
import numpy as np import sys sys.path.append("tests/python") # Don't import the test class, otherwise they will run twice. import test_interaction_constraints as test_ic # noqa rng = np.random.RandomState(1994) class TestGPUInteractionConstraints: cputest = test_ic.TestInteractionConstraints() def test_int...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_interaction_constraints.py
'''Test model IO with pickle.''' import pickle import numpy as np import subprocess import os import sys import json import pytest import xgboost as xgb from xgboost import XGBClassifier sys.path.append("tests/python") import testing as tm model_path = './model.pkl' def build_dataset(): N = 10 x = np.linspa...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_pickling.py
import xgboost as xgb import pytest import sys import numpy as np sys.path.append("tests/python") import testing as tm # noqa import test_with_sklearn as twskl # noqa pytestmark = pytest.mark.skipif(**tm.no_sklearn()) rng = np.random.RandomState(1994) def test_gpu_binary_classification(): from s...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_with_sklearn.py
import sys import xgboost import pytest sys.path.append("tests/python") import test_eval_metrics as test_em # noqa class TestGPUEvalMetrics: cpu_test = test_em.TestEvalMetrics() @pytest.mark.parametrize("n_samples", [4, 100, 1000]) def test_roc_auc_binary(self, n_samples): self.cpu_test.run_roc...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_eval_metrics.py
import sys import os from typing import Type, TypeVar, Any, Dict, List import pytest import numpy as np import asyncio import xgboost import subprocess from collections import OrderedDict from inspect import signature from hypothesis import given, strategies, settings, note from hypothesis._settings import duration fro...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_with_dask.py
import numpy as np import xgboost import os import itertools import shutil import urllib.request import zipfile import sys sys.path.append("tests/python") import testing as tm # noqa class TestRanking: @classmethod def setup_class(cls): """ Download and setup the test fixtures ...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_ranking.py
# -*- coding: utf-8 -*- import numpy as np import xgboost as xgb import pytest import sys sys.path.append("tests/python") import testing as tm class TestDeviceQuantileDMatrix: def test_dmatrix_numpy_init(self): data = np.random.randn(5, 5) with pytest.raises(TypeError, match='is not supported'): ...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_device_quantile_dmatrix.py
import os import subprocess import sys import pytest sys.path.append("tests/python") import testing as tm import test_demos as td # noqa @pytest.mark.skipif(**tm.no_cupy()) def test_data_iterator(): script = os.path.join(td.PYTHON_DEMO_DIR, 'data_iterator.py') cmd = ['python', script] subprocess.c...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_demos.py
import numpy as np import xgboost as xgb import sys import pytest sys.path.append("tests/python") import testing as tm def dmatrix_from_cudf(input_type, DMatrixT, missing=np.NAN): '''Test constructing DMatrix from cudf''' import cudf import pandas as pd kRows = 80 kCols = 3 na = np.random.r...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_from_cudf.py
import numpy as np import xgboost as xgb import cupy as cp import time import pytest # Test for integer overflow or out of memory exceptions def test_large_input(): available_bytes, _ = cp.cuda.runtime.memGetInfo() # 15 GB required_bytes = 1.5e+10 if available_bytes < required_bytes: pytest.sk...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_large_input.py
import sys import os import numpy as np import xgboost as xgb import pytest sys.path.append("tests/python") # Don't import the test class, otherwise they will run twice. import test_callback as test_cb # noqa rng = np.random.RandomState(1994) class TestGPUBasicModels: cputest = test_cb.TestCallbacks() def r...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_basic_models.py
import sys import numpy as np import pytest import xgboost as xgb sys.path.append("tests/python") import testing as tm import test_monotone_constraints as tmc rng = np.random.RandomState(1994) def non_decreasing(L): return all((x - y) < 0.001 for x, y in zip(L, L[1:])) def non_increasing(L): return all((...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_monotonic_constraints.py
import sys from hypothesis import strategies, given, settings, assume import pytest import numpy import xgboost as xgb sys.path.append("tests/python") import testing as tm parameter_strategy = strategies.fixed_dictionaries({ 'booster': strategies.just('gblinear'), 'eta': strategies.floats(0.01, 0.25), 'to...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_linear.py
import numpy as np import xgboost as xgb import json rng = np.random.RandomState(1994) class TestGPUTrainingContinuation: def test_training_continuation(self): kRows = 64 kCols = 32 X = np.random.randn(kRows, kCols) y = np.random.randn(kRows) dtrain = xgb.DMatrix(X, y) ...
spark-xgboost-nv-release_1.4.0
tests/python-gpu/test_gpu_training_continuation.py
"""Setup xgboost package.""" import os import shutil import subprocess import logging import distutils import sys from platform import system from setuptools import setup, find_packages, Extension from setuptools.command import build_ext, sdist, install_lib, install # You can't use `pip install .` as pip copies setup....
spark-xgboost-nv-release_1.4.0
python-package/setup.py
# coding: utf-8 # pylint: disable= invalid-name """Distributed XGBoost Rabit related API.""" import ctypes import pickle import numpy as np from .core import _LIB, c_str, STRING_TYPES, _check_call def _init_rabit(): """internal library initializer.""" if _LIB is not None: _LIB.RabitGetRank.restype = ...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/rabit.py
# coding: utf-8 # pylint: disable=invalid-name, too-many-statements, no-self-use # pylint: disable=too-many-arguments """Training Library containing training routines.""" from abc import ABC import collections import os import pickle from typing import Callable, List, Optional, Union, Dict, Tuple import numpy from . i...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/callback.py
# pylint: disable=missing-function-docstring """Global configuration for XGBoost""" import ctypes import json from contextlib import contextmanager from functools import wraps from .core import _LIB, _check_call, c_str, py_str def config_doc(*, header=None, extra_note=None, parameters=None, returns=None, ...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/config.py
# coding: utf-8 # pylint: disable= invalid-name, unused-import """For compatibility and optional dependencies.""" import sys import types import importlib.util import logging import numpy as np assert (sys.version_info[0] == 3), 'Python 2 is no longer supported.' # pylint: disable=invalid-name, redefined-builtin STR...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/compat.py
# pylint: disable=too-many-locals, too-many-arguments, invalid-name, # pylint: disable=too-many-branches # coding: utf-8 """Plotting Library.""" from io import BytesIO import numpy as np from .core import Booster from .sklearn import XGBModel def plot_importance(booster, ax=None, height=0.2, xlim=...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/plotting.py
# coding: utf-8 """XGBoost: eXtreme Gradient Boosting library. Contributors: https://github.com/dmlc/xgboost/blob/master/CONTRIBUTORS.md """ import os from .core import DMatrix, DeviceQuantileDMatrix, Booster from .training import train, cv from . import rabit # noqa from . import tracker # noqa from .tracker impo...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/__init__.py
# coding: utf-8 # pylint: disable=too-many-arguments, too-many-branches, invalid-name # pylint: disable=too-many-lines, too-many-locals, no-self-use """Core XGBoost Library.""" import collections # pylint: disable=no-name-in-module,import-error from collections.abc import Mapping from typing import List, Optional, Any,...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/core.py
# pylint: disable=too-many-arguments, too-many-locals, no-name-in-module # pylint: disable=missing-class-docstring, invalid-name # pylint: disable=too-many-lines, fixme # pylint: disable=too-few-public-methods # pylint: disable=import-error """Dask extensions for distributed training. See https://xgboost.readthedocs.io...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/dask.py
""" This script is a variant of dmlc-core/dmlc_tracker/tracker.py, which is a specialized version for xgboost tasks. """ # pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals # pylint: disable=too-many-branches, too-many-statements, too-many-instance-attributes import socket import str...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/tracker.py
# coding: utf-8 """Find the path to xgboost dynamic library files.""" import os import platform from typing import List import sys class XGBoostLibraryNotFound(Exception): """Error thrown by when xgboost is not found""" def find_lib_path() -> List[str]: """Find the path to xgboost dynamic library files. ...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/libpath.py
# coding: utf-8 # pylint: disable=too-many-arguments, too-many-locals, invalid-name, fixme, E0012, R0912, C0302 """Scikit-Learn Wrapper interface for XGBoost.""" import copy import warnings import json from typing import Union, Optional, List, Dict, Callable, Tuple, Any, TypeVar import numpy as np from .core import Boo...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/sklearn.py
# coding: utf-8 # pylint: disable=too-many-locals, too-many-arguments, invalid-name # pylint: disable=too-many-branches, too-many-statements """Training Library containing training routines.""" import warnings import copy import numpy as np from .core import Booster, XGBoostError, _get_booster_layer_trees from .compat ...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/training.py
# pylint: disable=too-many-arguments, too-many-branches # pylint: disable=too-many-return-statements, import-error '''Data dispatching for DMatrix.''' import ctypes import json import warnings import os from typing import Any import numpy as np from .core import c_array, _LIB, _check_call, c_str, _array_interface fro...
spark-xgboost-nv-release_1.4.0
python-package/xgboost/data.py
#!/usr/bin/env python import errno import argparse import glob import os import platform import shutil import subprocess import sys from contextlib import contextmanager from cudautils import cudaver # Monkey-patch the API inconsistency between Python2.X and 3.X. if sys.platform.startswith("linux"): sys.platform =...
spark-xgboost-nv-release_1.4.0
jvm-packages/create_jni.py
#!/usr/bin/env python import os import re import subprocess import sys # version -> classifier # '' means default classifier cuda_vers = { '11.2': ['cuda11', ''] } def check_classifier(classifier): ''' Check the mapping from cuda version to jar classifier. Used by maven build. ''' cu_ver = detec...
spark-xgboost-nv-release_1.4.0
jvm-packages/cudautils.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/setup.py
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/ml/__init__.py
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/ml/dmlc/__init__.py
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/ml/dmlc/xgboost4j/__init__.py
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/ml/dmlc/xgboost4j/scala/__init__.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/ml/dmlc/xgboost4j/scala/spark/__init__.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/sparkxgb/rapids.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/sparkxgb/util.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/sparkxgb/__init__.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/sparkxgb/common.py
# # Copyright (c) 2019 by Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-spark/src/main/resources/sparkxgb/xgboost.py
from sklearn.datasets import load_iris import numpy as np import pandas X, y = load_iris(return_X_y=True) y = y.astype(np.int) df = pandas.DataFrame(data=X, columns=['sepal length', 'sepal width', 'petal length', 'petal width']) class_id_to_name = {0:'Iris-setosa', 1:'Iris-versicolor', 2:'Iris-virginica'} df['class'] ...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-tester/get_iris.py
import sys pom_template = """ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <g...
spark-xgboost-nv-release_1.4.0
jvm-packages/xgboost4j-tester/generate_pom.py
#!/usr/bin/python """ demo python script of rabit: Lazy preparation function """ import os import sys import numpy as np # import rabit, the tracker script will setup the lib path correctly # for normal run without tracker script, add following line # sys.path.append(os.path.dirname(__file__) + '/../wrapper') import ra...
spark-xgboost-nv-release_1.4.0
rabit/guide/lazy_allreduce.py
#!/usr/bin/python """ demo python script of rabit """ from __future__ import print_function from builtins import range import os import sys import numpy as np # import rabit, the tracker script will setup the lib path correctly # for normal run without tracker script, add following line # sys.path.append(os.path.dirnam...
spark-xgboost-nv-release_1.4.0
rabit/guide/basic.py
#!/usr/bin/python """ demo python script of rabit """ from __future__ import print_function import os import sys # add path to wrapper # for normal run without tracker script, add following line # sys.path.append(os.path.dirname(__file__) + '/../wrapper') import rabit rabit.init() n = 3 rank = rabit.get_rank() s = Non...
spark-xgboost-nv-release_1.4.0
rabit/guide/broadcast.py
# -*- coding: utf-8 -*- """Helper utilty function for customization.""" import sys import os import docutils import subprocess if os.environ.get('READTHEDOCS', None) == 'True': subprocess.call('cd ..; rm -rf recommonmark;' + 'git clone https://github.com/tqchen/recommonmark', shell=True) sys.p...
spark-xgboost-nv-release_1.4.0
rabit/doc/sphinx_util.py
# -*- coding: utf-8 -*- # # documentation build configuration file, created by # sphinx-quickstart on Thu Jul 23 19:40:08 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All confi...
spark-xgboost-nv-release_1.4.0
rabit/doc/conf.py
"""Query list of all contributors and reviewers in a release""" from sh.contrib import git import sys import re import requests import json if len(sys.argv) != 5: print(f'Usage: {sys.argv[0]} [starting commit/tag] [ending commit/tag] [GitHub username] ' + '[GitHub password]') sys.exit(1) from_comm...
spark-xgboost-nv-release_1.4.0
dev/query_contributors.py
"""Simple script for downloading and checking pypi release wheels. tqdm, sh are required to run this script. """ from urllib.request import urlretrieve import argparse from typing import List from sh.contrib import git from distutils import version import subprocess import tqdm import os # The package building is man...
spark-xgboost-nv-release_1.4.0
dev/release-pypi.py
# -*- coding: utf-8 -*- """Helper utility function for customization.""" import sys import os import subprocess READTHEDOCS_BUILD = (os.environ.get('READTHEDOCS', None) is not None) if not os.path.exists('web-data'): subprocess.call('rm -rf web-data;' + 'git clone https://github.com/dmlc/web-data'...
spark-xgboost-nv-release_1.4.0
doc/sphinx_util.py
# -*- coding: utf-8 -*- # # documentation build configuration file, created by # sphinx-quickstart on Thu Jul 23 19:40:08 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All confi...
spark-xgboost-nv-release_1.4.0
doc/conf.py
'''This is a simple script that converts a pickled XGBoost Scikit-Learn interface object from 0.90 to a native model. Pickle format is not stable as it's a direct serialization of Python object. We advice not to use it when stability is needed. ''' import pickle import json import os import argparse import numpy as n...
spark-xgboost-nv-release_1.4.0
doc/python/convert_090to100.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
setup.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: megamolbart.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from ...
MegaMolBART-dev
generated/megamolbart_pb2.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc import megamolbart_pb2 as megamolbart__pb2 class GenerativeSamplerStub(object): """import "google/protobuf/empty.proto"; python -m pip install grpcio ...
MegaMolBART-dev
generated/megamolbart_pb2_grpc.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/package_info.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/__init__.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/tokenizer/__init__.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/tokenizer/tokenizer.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/utils/__init__.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/models/__init__.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/models/megamolbart/megamolbart_model.py
# Copyright (c) 2022, NVIDIA CORPORATION. # SPDX-License-Identifier: Apache-2.0 # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
MegaMolBART-dev
nemo_chem/models/megamolbart/__init__.py
import logging import torch from typing import List from omegaconf import OmegaConf from pytorch_lightning.trainer.trainer import Trainer from nemo.collections.nlp.parts.nlp_overrides import (NLPDDPPlugin, NLPSaveRestoreConnector) from nemo.utils.app_state import...
MegaMolBART-dev
nemo_chem/models/megamolbart/infer.py
import grpc import torch import logging from concurrent import futures from hydra import compose, initialize from nemo_chem.models.megamolbart import NeMoMegaMolBARTWrapper import megamolbart_pb2_grpc from megamolbart_pb2 import OutputSpec logger = logging.getLogger(__name__) class InferenceService(megamolbart_pb2_g...
MegaMolBART-dev
nemo_chem/models/megamolbart/grpc/service.py
MegaMolBART-dev
nemo_chem/models/megamolbart/grpc/__init__.py