Require isort on all Python files. (#8420)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import random
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print ('Usage:<filename> <k> [nfold = 5]')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import random
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print('Usage:<filename> <k> [nfold = 5]')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
fo = open(sys.argv[2], 'w')
|
||||
|
||||
for l in open(sys.argv[1]):
|
||||
|
||||
@@ -6,9 +6,11 @@ Demo for survival analysis (regression). using Accelerated Failure Time (AFT) mo
|
||||
"""
|
||||
|
||||
import os
|
||||
from sklearn.model_selection import ShuffleSplit
|
||||
import pandas as pd
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from sklearn.model_selection import ShuffleSplit
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# The Veterans' Administration Lung Cancer Trial
|
||||
|
||||
@@ -6,11 +6,12 @@ Demo for survival analysis (regression) using Accelerated Failure Time (AFT) mod
|
||||
using Optuna to tune hyperparameters
|
||||
|
||||
"""
|
||||
from sklearn.model_selection import ShuffleSplit
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
import optuna
|
||||
import pandas as pd
|
||||
from sklearn.model_selection import ShuffleSplit
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# The Veterans' Administration Lung Cancer Trial
|
||||
# The Statistical Analysis of Failure Time Data by Kalbfleisch J. and Prentice R (1980)
|
||||
|
||||
@@ -6,9 +6,10 @@ This demo uses 1D toy data and visualizes how XGBoost fits a tree ensemble. The
|
||||
model starts out as a flat line and evolves into a step function in order to account for
|
||||
all ranged labels.
|
||||
"""
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
plt.rcParams.update({'font.size': 13})
|
||||
|
||||
|
||||
@@ -4,12 +4,14 @@ Example of training survival model with Dask on CPU
|
||||
|
||||
"""
|
||||
|
||||
import xgboost as xgb
|
||||
import os
|
||||
from xgboost.dask import DaskDMatrix
|
||||
|
||||
import dask.dataframe as dd
|
||||
from dask.distributed import Client
|
||||
from dask.distributed import LocalCluster
|
||||
from dask.distributed import Client, LocalCluster
|
||||
from xgboost.dask import DaskDMatrix
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
def main(client):
|
||||
# Load an example survival data from CSV into a Dask data frame.
|
||||
|
||||
@@ -3,11 +3,11 @@ Example of training with Dask on CPU
|
||||
====================================
|
||||
|
||||
"""
|
||||
import xgboost as xgb
|
||||
from xgboost.dask import DaskDMatrix
|
||||
from dask.distributed import Client
|
||||
from dask.distributed import LocalCluster
|
||||
from dask import array as da
|
||||
from dask.distributed import Client, LocalCluster
|
||||
from xgboost.dask import DaskDMatrix
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
def main(client):
|
||||
|
||||
@@ -3,12 +3,12 @@ Example of using callbacks with Dask
|
||||
====================================
|
||||
"""
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from xgboost.dask import DaskDMatrix
|
||||
from dask.distributed import Client
|
||||
from dask.distributed import LocalCluster
|
||||
from dask.distributed import Client, LocalCluster
|
||||
from dask_ml.datasets import make_regression
|
||||
from dask_ml.model_selection import train_test_split
|
||||
from xgboost.dask import DaskDMatrix
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
def probability_for_going_backward(epoch):
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
Example of training with Dask on GPU
|
||||
====================================
|
||||
"""
|
||||
from dask_cuda import LocalCUDACluster
|
||||
import dask_cudf
|
||||
from dask.distributed import Client
|
||||
from dask import array as da
|
||||
from dask import dataframe as dd
|
||||
from dask.distributed import Client
|
||||
from dask_cuda import LocalCUDACluster
|
||||
from xgboost.dask import DaskDMatrix
|
||||
|
||||
import xgboost as xgb
|
||||
from xgboost import dask as dxgb
|
||||
from xgboost.dask import DaskDMatrix
|
||||
|
||||
|
||||
def using_dask_matrix(client: Client, X, y):
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
Use scikit-learn regressor interface with CPU histogram tree method
|
||||
===================================================================
|
||||
"""
|
||||
from dask.distributed import Client
|
||||
from dask.distributed import LocalCluster
|
||||
from dask import array as da
|
||||
from dask.distributed import Client, LocalCluster
|
||||
|
||||
import xgboost
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ Use scikit-learn regressor interface with GPU histogram tree method
|
||||
===================================================================
|
||||
"""
|
||||
|
||||
from dask import array as da
|
||||
from dask.distributed import Client
|
||||
|
||||
# It's recommended to use dask_cuda for GPU assignment
|
||||
from dask_cuda import LocalCUDACluster
|
||||
from dask import array as da
|
||||
|
||||
import xgboost
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import xgboost as xgb
|
||||
import time
|
||||
|
||||
from sklearn.datasets import fetch_covtype
|
||||
from sklearn.model_selection import train_test_split
|
||||
import time
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# Fetch dataset using sklearn
|
||||
cov = fetch_covtype()
|
||||
|
||||
@@ -9,13 +9,14 @@ interfaces in the Python package like scikit-learn interface and Dask interface.
|
||||
See :doc:`/python/python_intro` and :doc:`/tutorials/index` for other references.
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import pickle
|
||||
import xgboost as xgb
|
||||
import os
|
||||
import pickle
|
||||
|
||||
import numpy as np
|
||||
from sklearn.datasets import load_svmlight_file
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# Make sure the demo knows where to load the data.
|
||||
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
XGBOOST_ROOT_DIR = os.path.dirname(os.path.dirname(CURRENT_DIR))
|
||||
|
||||
@@ -3,8 +3,8 @@ Demo for boosting from prediction
|
||||
=================================
|
||||
"""
|
||||
import os
|
||||
import xgboost as xgb
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
CURRENT_DIR = os.path.dirname(__file__)
|
||||
dtrain = xgb.DMatrix(os.path.join(CURRENT_DIR, '../data/agaricus.txt.train'))
|
||||
|
||||
@@ -4,14 +4,16 @@ Demo for using and defining callback functions
|
||||
|
||||
.. versionadded:: 1.3.0
|
||||
'''
|
||||
import xgboost as xgb
|
||||
import tempfile
|
||||
import argparse
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn.datasets import load_breast_cancer
|
||||
from sklearn.model_selection import train_test_split
|
||||
from matplotlib import pyplot as plt
|
||||
import argparse
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
class Plotting(xgb.callback.TrainingCallback):
|
||||
|
||||
@@ -3,11 +3,13 @@ Demo for training continuation
|
||||
==============================
|
||||
"""
|
||||
|
||||
from sklearn.datasets import load_breast_cancer
|
||||
import xgboost
|
||||
import os
|
||||
import pickle
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
from sklearn.datasets import load_breast_cancer
|
||||
|
||||
import xgboost
|
||||
|
||||
|
||||
def training_continuation(tmpdir: str, use_pickle: bool) -> None:
|
||||
|
||||
@@ -3,7 +3,9 @@ Demo for using cross validation
|
||||
===============================
|
||||
"""
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# load data in do training
|
||||
|
||||
@@ -14,14 +14,16 @@ The `SLE` objective reduces impact of outliers in training dataset, hence here w
|
||||
compare its performance with standard squared error.
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from typing import Tuple, Dict, List
|
||||
from time import time
|
||||
import argparse
|
||||
from time import time
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
import matplotlib
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# shape of generated data.
|
||||
kRows = 4096
|
||||
kCols = 16
|
||||
|
||||
@@ -10,11 +10,13 @@ See :doc:`/tutorials/custom_metric_obj` for detailed tutorial and notes.
|
||||
|
||||
'''
|
||||
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from matplotlib import pyplot as plt
|
||||
import argparse
|
||||
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
np.random.seed(1994)
|
||||
|
||||
kRows = 100
|
||||
|
||||
@@ -3,6 +3,7 @@ This script demonstrate how to access the eval metrics
|
||||
======================================================
|
||||
"""
|
||||
import os
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
CURRENT_DIR = os.path.dirname(__file__)
|
||||
|
||||
@@ -12,11 +12,13 @@ See :doc:`the tutorial </tutorials/external_memory>` for more details.
|
||||
|
||||
"""
|
||||
import os
|
||||
import xgboost
|
||||
from typing import Callable, List, Tuple
|
||||
from sklearn.datasets import make_regression
|
||||
import tempfile
|
||||
from typing import Callable, List, Tuple
|
||||
|
||||
import numpy as np
|
||||
from sklearn.datasets import make_regression
|
||||
|
||||
import xgboost
|
||||
|
||||
|
||||
def make_batches(
|
||||
|
||||
@@ -5,11 +5,13 @@ Demo for using feature weight to change column sampling
|
||||
.. versionadded:: 1.3.0
|
||||
'''
|
||||
|
||||
import numpy as np
|
||||
import xgboost
|
||||
from matplotlib import pyplot as plt
|
||||
import argparse
|
||||
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
import xgboost
|
||||
|
||||
|
||||
def main(args):
|
||||
rng = np.random.RandomState(1994)
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
Demo for gamma regression
|
||||
=========================
|
||||
"""
|
||||
import xgboost as xgb
|
||||
import numpy as np
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# this script demonstrates how to fit gamma regression model (with log link function)
|
||||
# in xgboost, before running the demo you need to generate the autoclaims dataset
|
||||
# by running gen_autoclaims.R located in xgboost/demo/data.
|
||||
|
||||
@@ -3,7 +3,9 @@ Demo for GLM
|
||||
============
|
||||
"""
|
||||
import os
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
##
|
||||
# this script demonstrate how to fit generalized linear model in xgboost
|
||||
# basically, we are using linear model, instead of tree for our boosters
|
||||
|
||||
@@ -10,10 +10,11 @@ See :doc:`/tutorials/multioutput` for more information.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
from typing import Dict, Tuple, List
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ Demo for prediction using number of trees
|
||||
=========================================
|
||||
"""
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from sklearn.datasets import load_svmlight_file
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
CURRENT_DIR = os.path.dirname(__file__)
|
||||
train = os.path.join(CURRENT_DIR, "../data/agaricus.txt.train")
|
||||
test = os.path.join(CURRENT_DIR, "../data/agaricus.txt.test")
|
||||
|
||||
@@ -3,6 +3,7 @@ Demo for obtaining leaf index
|
||||
=============================
|
||||
"""
|
||||
import os
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# load data in do training
|
||||
|
||||
@@ -17,10 +17,11 @@ using `itertools.tee` might incur significant memory usage according to:
|
||||
|
||||
'''
|
||||
|
||||
import xgboost
|
||||
import cupy
|
||||
import numpy
|
||||
|
||||
import xgboost
|
||||
|
||||
COLS = 64
|
||||
ROWS_PER_BATCH = 1000 # data is splited by rows
|
||||
BATCHES = 32
|
||||
|
||||
@@ -3,10 +3,11 @@ Demo for accessing the xgboost eval metrics by using sklearn interface
|
||||
======================================================================
|
||||
"""
|
||||
|
||||
import xgboost as xgb
|
||||
import numpy as np
|
||||
from sklearn.datasets import make_hastie_10_2
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
X, y = make_hastie_10_2(n_samples=2000, random_state=42)
|
||||
|
||||
# Map labels from {-1, 1} to {0, 1}
|
||||
|
||||
@@ -7,12 +7,13 @@ Created on 1 Apr 2015
|
||||
@author: Jamie Hall
|
||||
'''
|
||||
import pickle
|
||||
import xgboost as xgb
|
||||
|
||||
import numpy as np
|
||||
from sklearn.model_selection import KFold, train_test_split, GridSearchCV
|
||||
from sklearn.datasets import fetch_california_housing, load_digits, load_iris
|
||||
from sklearn.metrics import confusion_matrix, mean_squared_error
|
||||
from sklearn.datasets import load_iris, load_digits, fetch_california_housing
|
||||
from sklearn.model_selection import GridSearchCV, KFold, train_test_split
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
rng = np.random.RandomState(31337)
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
Demo for using xgboost with sklearn
|
||||
===================================
|
||||
"""
|
||||
from sklearn.model_selection import GridSearchCV
|
||||
from sklearn.datasets import fetch_california_housing
|
||||
import xgboost as xgb
|
||||
import multiprocessing
|
||||
|
||||
from sklearn.datasets import fetch_california_housing
|
||||
from sklearn.model_selection import GridSearchCV
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Parallel Parameter optimization")
|
||||
X, y = fetch_california_housing(return_X_y=True)
|
||||
|
||||
@@ -7,9 +7,10 @@ experiment.
|
||||
|
||||
"""
|
||||
|
||||
import xgboost as xgb
|
||||
from sklearn.datasets import fetch_california_housing
|
||||
import numpy as np
|
||||
from sklearn.datasets import fetch_california_housing
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import numpy as np
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
### load data in do training
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
# make prediction
|
||||
import numpy as np
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# path to where the data lies
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
# this is the example script to use xgboost to train
|
||||
import numpy as np
|
||||
import xgboost as xgb
|
||||
from sklearn.ensemble import GradientBoostingClassifier
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
from sklearn.ensemble import GradientBoostingClassifier
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
test_size = 550000
|
||||
|
||||
# path to where the data lies
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import division
|
||||
|
||||
import numpy as np
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# label need to be 0 to num_class -1
|
||||
|
||||
@@ -10,7 +10,6 @@ from nvflare.apis.fl_context import FLContext
|
||||
from nvflare.apis.impl.controller import Controller, Task
|
||||
from nvflare.apis.shareable import Shareable
|
||||
from nvflare.apis.signal import Signal
|
||||
|
||||
from trainer import SupportedTasks
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
from nvflare.apis.executor import Executor
|
||||
from nvflare.apis.fl_constant import ReturnCode, FLContextKey
|
||||
from nvflare.apis.fl_constant import FLContextKey, ReturnCode
|
||||
from nvflare.apis.fl_context import FLContext
|
||||
from nvflare.apis.shareable import Shareable, make_reply
|
||||
from nvflare.apis.signal import Signal
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
import xgboost as xgb
|
||||
from xgboost import DMatrix
|
||||
from sklearn.datasets import load_svmlight_file
|
||||
|
||||
import xgboost as xgb
|
||||
from xgboost import DMatrix
|
||||
|
||||
# This script demonstrate how to do ranking with xgboost.train
|
||||
x_train, y_train = load_svmlight_file("mq2008.train")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
import xgboost as xgb
|
||||
from sklearn.datasets import load_svmlight_file
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# This script demonstrate how to do ranking with XGBRanker
|
||||
x_train, y_train = load_svmlight_file("mq2008.train")
|
||||
x_valid, y_valid = load_svmlight_file("mq2008.vali")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
|
||||
|
||||
def save_data(group_data,output_feature,output_group):
|
||||
if len(group_data) == 0:
|
||||
return
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import xgboost as xgb
|
||||
from sklearn.datasets import make_classification
|
||||
import dask
|
||||
from dask.distributed import Client
|
||||
from dask_cuda import LocalCUDACluster
|
||||
from sklearn.datasets import make_classification
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
|
||||
def main(client):
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import xgboost as xgb
|
||||
import rmm
|
||||
from sklearn.datasets import make_classification
|
||||
|
||||
import xgboost as xgb
|
||||
|
||||
# Initialize RMM pool allocator
|
||||
rmm.reinitialize(pool_allocator=True)
|
||||
# Optionally force XGBoost to use RMM for all GPU memory allocation, see ./README.md
|
||||
|
||||
Reference in New Issue
Block a user