Skip to content
Merged
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 daal4py/sklearn/ensemble/_forest.py
Original file line number Diff line number Diff line change
@@ -679,8 +679,8 @@
dfc_predictionResult = dfc_algorithm.compute(X, self.daal_model_)

pred = dfc_predictionResult.probabilities

return pred
# TODO: fix probabilities out of [0, 1] interval on oneDAL side

Check notice on line 682 in daal4py/sklearn/ensemble/_forest.py

codefactor.io / CodeFactor

daal4py/sklearn/ensemble/_forest.py#L682

Unresolved comment '# TODO: fix probabilities out of [0, 1] interval on oneDAL side'. (C100)
return pred.clip(0.0, 1.0)

def _daal_fit_classifier(self, X, y, sample_weight=None):
y = check_array(y, ensure_2d=False, dtype=None)
8 changes: 7 additions & 1 deletion daal4py/sklearn/manifold/_t_sne.py
Original file line number Diff line number Diff line change
@@ -66,7 +66,13 @@ def _daal_tsne(self, P, n_samples, X_embedded):
[n_samples],
[P.nnz],
[self.n_iter_without_progress],
[self._max_iter if sklearn_check_version("1.5") else self.n_iter],
[
(
self.max_iter
if sklearn_check_version("1.7")
else (self._max_iter if sklearn_check_version("1.5") else self.n_iter)
)
],
]

# Pass params to daal4py backend
2 changes: 1 addition & 1 deletion daal4py/sklearn/metrics/_pairwise.py
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
from functools import partial

import numpy as np
from joblib import effective_n_jobs
from sklearn.exceptions import DataConversionWarning
from sklearn.metrics import pairwise_distances as pairwise_distances_original
from sklearn.metrics.pairwise import (
@@ -28,7 +29,6 @@
_parallel_pairwise,
check_pairwise_arrays,
)
from sklearn.utils._joblib import effective_n_jobs
from sklearn.utils.validation import check_non_negative

try:
4 changes: 3 additions & 1 deletion onedal/ensemble/forest.py
Original file line number Diff line number Diff line change
@@ -424,7 +424,9 @@
else:
result = self.infer(params, model, X)

return from_table(result.probabilities)
# TODO: fix probabilities out of [0, 1] interval on oneDAL side

Check notice on line 427 in onedal/ensemble/forest.py

codefactor.io / CodeFactor

onedal/ensemble/forest.py#L427

Unresolved comment '# TODO: fix probabilities out of [0, 1] interval on oneDAL side'. (C100)
pred = from_table(result.probabilities)
return pred.clip(0.0, 1.0)


class RandomForestClassifier(ClassifierMixin, BaseForest, metaclass=ABCMeta):
7 changes: 6 additions & 1 deletion onedal/utils/_array_api.py
Original file line number Diff line number Diff line change
@@ -68,7 +68,12 @@ def _asarray(data, xp, *args, **kwargs):

def _is_numpy_namespace(xp):
"""Return True if xp is backed by NumPy."""
return xp.__name__ in {"numpy", "array_api_compat.numpy", "numpy.array_api"}
return xp.__name__ in {
"numpy",
"array_api_compat.numpy",
"numpy.array_api",
"sklearn.externals.array_api_compat.numpy",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does one end up with this namespace for an array object? Could it somehow happen that it'd end up with a different name like <package that imports sklearn>.sklearn.externals.array_api_compat.numpy ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are getting at the core issue here, which is that this function is fragile. We should think about how to make it more robust.

}


def _get_sycl_namespace(*arrays):
Loading
Oops, something went wrong.