Skip to content

Commit

Permalink
modify behavior of _num_feature to use in multi-output
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes-intel committed Oct 23, 2024
1 parent 201206e commit 29ab941
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 4 additions & 1 deletion onedal/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ def _num_features(X, fallback_1d=False):
if not hasattr(X.shape, "__len__") or len(X.shape) < ndim_thr:
message += f" with shape {X.shape}"
raise TypeError(message)
return X.shape[-1]
if len(X.shape) <= 1:
return len(X)
else:
return X.shape[-1]

first_sample = X[0]

Expand Down
5 changes: 1 addition & 4 deletions sklearnex/linear_model/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,7 @@ def _onedal_fit_supported(self, patching_status, method_name, *data):
# or had bugs in some uncommon cases in older versions.
is_underdetermined = n_samples < (n_features + int(self.fit_intercept))
supports_all_variants = daal_check_version((2025, "P", 1))
if hasattr(y, "shape"):
is_multi_output = len(y.shape) > 1 and y.shape[1] > 1
else:
is_multi_output = _num_features(y, fallback_1d=True) > 1
is_multi_output = _num_features(y, fallback_1d=True) > 1

patching_status.and_conditions(
[
Expand Down

0 comments on commit 29ab941

Please sign in to comment.