Skip to content

Commit 138ed18

Browse files
authored
Change basic_statistics API for 2025.0 (#2026)
* Update basic_statistics.py * Update test_basic_statistics.py * Update basic_statistics.py
1 parent c214145 commit 138ed18

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

onedal/basic_statistics/basic_statistics.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,6 @@ def fit(self, data, sample_weight=None, queue=None):
9696

9797
return self
9898

99-
def compute(self, data, weights=None, queue=None):
100-
warnings.warn(
101-
"Method `compute` was deprecated in version 2024.7 and will be "
102-
"removed in 2025.0. Use `fit` instead."
103-
)
104-
105-
is_csr = _is_csr(data)
106-
107-
if data is not None:
108-
data = _check_array(data, ensure_2d=False)
109-
if weights is not None:
110-
weights = _check_array(weights, ensure_2d=False)
111-
112-
policy = self._get_policy(queue, data, weights)
113-
data, weights = _convert_to_supported(policy, data, weights)
114-
data_table, weights_table = to_table(data, weights)
115-
dtype = data.dtype
116-
res = self._compute_raw(data_table, weights_table, policy, dtype, is_csr)
117-
118-
return {k: from_table(v).ravel() for k, v in res.items()}
119-
12099
def _compute_raw(
121100
self, data_table, weights_table, policy, dtype=np.float32, is_csr=False
122101
):

onedal/basic_statistics/tests/test_basic_statistics.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -296,19 +296,3 @@ def test_options_csr(queue, option, dtype):
296296
tol = fp32tol if res.dtype == np.float32 else fp64tol
297297

298298
assert_allclose(gtr, res, rtol=tol)
299-
300-
301-
def test_warning():
302-
basicstat = BasicStatistics()
303-
data = np.array([0, 1])
304-
305-
with pytest.warns(
306-
UserWarning,
307-
match="Method `compute` was deprecated in version 2024.7 and will be removed in 2025.0. Use `fit` instead.",
308-
) as warn_record:
309-
basicstat.compute(data)
310-
311-
if daal_check_version((2025, "P", 0)):
312-
assert len(warn_record) == 0
313-
else:
314-
assert len(warn_record) == 1

sklearnex/basic_statistics/basic_statistics.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ def _onedal_fit(self, X, sample_weight=None, queue=None):
107107
self._onedal_estimator.fit(X, sample_weight, queue)
108108
self._save_attributes()
109109

110-
def compute(self, data, weights=None, queue=None):
111-
return self._onedal_estimator.compute(data, weights, queue)
112-
113110
def fit(self, X, y=None, *, sample_weight=None):
114111
"""Compute statistics with X, using minibatches of size batch_size.
115112

0 commit comments

Comments
 (0)