Skip to content

Commit 4b4dfa1

Browse files
fall back on unsupported bootstrapping beyond 100% (#2984)
1 parent 6933c0e commit 4b4dfa1

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

doc/sources/algorithms.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Classification
5555
- ``ccp_alpha`` != `0`
5656
- ``criterion`` != `'gini'`
5757
- ``n_estimators`` > ``6024``
58+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
5859
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
5960
- Number of classes must be at least 2.
6061
* - :obj:`sklearn.ensemble.ExtraTreesClassifier`
@@ -64,6 +65,7 @@ Classification
6465
- ``ccp_alpha`` != `0`
6566
- ``criterion`` != `'gini'`
6667
- ``n_estimators`` > ``6024``
68+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
6769
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
6870
- Number of classes must be at least 2.
6971
* - :obj:`sklearn.neighbors.KNeighborsClassifier`
@@ -125,6 +127,7 @@ Regression
125127
- ``ccp_alpha`` != `0`
126128
- ``criterion`` != ``'squared_error'``
127129
- ``n_estimators`` > ``6024``
130+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
128131
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
129132
* - :obj:`sklearn.ensemble.ExtraTreesRegressor`
130133
- All parameters are supported except:
@@ -133,6 +136,7 @@ Regression
133136
- ``ccp_alpha`` != `0`
134137
- ``criterion`` != ``'squared_error'``
135138
- ``n_estimators`` > ``6024``
139+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
136140
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
137141
* - :obj:`sklearn.neighbors.KNeighborsRegressor`
138142
-
@@ -375,6 +379,7 @@ Classification
375379
- ``oob_score`` = `True`
376380
- ``sample_weight`` != `None`
377381
- ``n_estimators`` > ``6024``
382+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
378383
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
379384
- Number of classes must be at least 2.
380385
* - :obj:`sklearn.ensemble.ExtraTreesClassifier`
@@ -386,6 +391,7 @@ Classification
386391
- ``oob_score`` = `True`
387392
- ``sample_weight`` != `None`
388393
- ``n_estimators`` > ``6024``
394+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
389395
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
390396
- Number of classes must be at least 2.
391397
* - :obj:`sklearn.neighbors.KNeighborsClassifier`
@@ -429,6 +435,7 @@ Regression
429435
- ``oob_score`` = `True`
430436
- ``sample_weight`` != `None`
431437
- ``n_estimators`` > ``6024``
438+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
432439
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
433440
* - :obj:`sklearn.ensemble.ExtraTreesRegressor`
434441
- All parameters are supported except:
@@ -439,6 +446,7 @@ Regression
439446
- ``oob_score`` = `True`
440447
- ``sample_weight`` != `None`
441448
- ``n_estimators`` > ``6024``
449+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
442450
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
443451
* - :obj:`sklearn.neighbors.KNeighborsRegressor`
444452
- All parameters are supported except:
@@ -610,6 +618,7 @@ Classification
610618
- ``oob_score`` = `True`
611619
- ``sample_weight`` != `None`
612620
- ``n_estimators`` > ``6024``
621+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
613622
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
614623
- Number of classes must be at least 2.
615624
* - :obj:`sklearn.ensemble.ExtraTreesClassifier`
@@ -621,6 +630,7 @@ Classification
621630
- ``oob_score`` = `True`
622631
- ``sample_weight`` != `None`
623632
- ``n_estimators`` > ``6024``
633+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
624634
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
625635
- Number of classes must be at least 2.
626636
* - :obj:`sklearn.neighbors.KNeighborsClassifier`
@@ -665,6 +675,7 @@ Regression
665675
- ``oob_score`` = `True`
666676
- ``sample_weight`` != `None`
667677
- ``n_estimators`` > ``6024``
678+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
668679
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
669680
* - :obj:`sklearn.ensemble.ExtraTreesRegressor`
670681
- All parameters are supported except:
@@ -675,6 +686,7 @@ Regression
675686
- ``oob_score`` = `True`
676687
- ``sample_weight`` != `None`
677688
- ``n_estimators`` > ``6024``
689+
- Non-integer ``max_samples`` larger than 1 with ``bootstrap=True``
678690
- Multi-output and sparse data are not supported. Missing values and infinite values are not supported.
679691
* - :obj:`sklearn.neighbors.KNeighborsRegressor`
680692
- All parameters are supported except:

sklearnex/ensemble/_forest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import warnings
2020
from abc import ABC
2121
from functools import partial
22+
from numbers import Integral, Real
2223

2324
import numpy as np
2425
from sklearn.base import clone, is_classifier
@@ -285,6 +286,14 @@ def _onedal_fit_ready(self, patching_status, X, y, sample_weight):
285286
not self.bootstrap or self.class_weight != "balanced_subsample",
286287
"'balanced_subsample' for class_weight is not supported",
287288
),
289+
(
290+
not (
291+
isinstance(self.max_samples, Real)
292+
and not isinstance(self.max_samples, Integral)
293+
and self.max_samples > 1.0
294+
),
295+
"Fractional 'max_samples' beyond 1.0 are not supported",
296+
),
288297
]
289298
)
290299

0 commit comments

Comments
 (0)