Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use int instead of float in random.randint #5864

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/cuml/datasets/arima.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -135,7 +135,7 @@ def make_arima(batch_size=1000, n_obs=100, order=(1, 1, 1),
cdef uintptr_t out_ptr = <uintptr_t> out.ptr

if random_state is None:
random_state = randint(0, 1e18)
random_state = randint(0, 10**18)

if dtype == np.float32:
cpp_make_arima(handle_[0], <float*> out_ptr, <int> batch_size,
Expand Down
4 changes: 2 additions & 2 deletions python/cuml/datasets/regression.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -206,7 +206,7 @@ def make_regression(
coef_ptr = coefs.ptr

if random_state is None:
random_state = randint(0, 1e18)
random_state = randint(0, 10**18)

if dtype == np.float32:
cpp_make_regression(handle_[0], <float*> out_ptr,
Expand Down
4 changes: 2 additions & 2 deletions python/cuml/explainer/kernel_shap.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -340,7 +340,7 @@ class KernelExplainer(SHAPBase):
x_ptr = get_cai_ptr(self._mask)

if self.random_state is None:
self.random_state = randint(0, 1e18)
self.random_state = randint(0, 10**18)

# we default to float32 unless self.dtype is specifically np.float64
if self.dtype == np.float64:
Expand Down
4 changes: 2 additions & 2 deletions python/cuml/tests/test_kmeans.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -61,7 +61,7 @@ def get_data_consistency_test():

@pytest.fixture
def random_state():
random_state = random.randint(0, 1e6)
random_state = random.randint(0, 10**6)
with logger.set_level(logger.level_debug):
logger.debug("Random seed: {}".format(random_state))
return random_state
Expand Down
4 changes: 2 additions & 2 deletions python/cuml/tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -108,7 +108,7 @@

@pytest.fixture(scope="module")
def random_state():
random_state = random.randint(0, 1e6)
random_state = random.randint(0, 10**6)
with logger.set_level(logger.level_debug):
logger.debug("Random seed: {}".format(random_state))
return random_state
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/tests/test_random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def test_rf_classification_seed(small_clf, datatype):
)

for i in range(8):
seed = random.randint(100, 1e5)
seed = random.randint(100, 10**5)
# Initialize, fit and predict using cuML's
# random forest classification model
cu_class = curfc(random_state=seed, n_streams=1)
Expand Down
Loading