From c29ebcb42d2e1cd8bdb23660c142fe9b816fba86 Mon Sep 17 00:00:00 2001 From: Rohit Agarwal Date: Wed, 31 Mar 2021 23:00:46 +0530 Subject: [PATCH] Handle scenario when None is passed as memory limit --- autosklearn/automl.py | 2 +- test/test_automl/test_automl.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/autosklearn/automl.py b/autosklearn/automl.py index 414a0ee8d8..7bdbea6434 100644 --- a/autosklearn/automl.py +++ b/autosklearn/automl.py @@ -814,7 +814,7 @@ def fit( @staticmethod def subsample_if_too_large(X, y, logger, seed, memory_limit, task): - if isinstance(X, np.ndarray): + if memory_limit and isinstance(X, np.ndarray): if X.dtype == np.float32: multiplier = 4 elif X.dtype in (np.float64, np.float): diff --git a/test/test_automl/test_automl.py b/test/test_automl/test_automl.py index c358ac9553..d8861480d0 100644 --- a/test/test_automl/test_automl.py +++ b/test/test_automl/test_automl.py @@ -664,16 +664,16 @@ def test_fail_if_feat_type_on_pandas_input(backend, dask_client): [ (memory_limit, task) for task in itertools.chain(CLASSIFICATION_TASKS, REGRESSION_TASKS) - for memory_limit in (1, 10) + for memory_limit in (1, 10, None) ] ) def test_subsample_if_too_large(memory_limit, task): fixture = { - BINARY_CLASSIFICATION: {1: 436, 10: 569}, - MULTICLASS_CLASSIFICATION: {1: 204, 10: 1797}, - MULTILABEL_CLASSIFICATION: {1: 204, 10: 1797}, - REGRESSION: {1: 1310, 10: 1326}, - MULTIOUTPUT_REGRESSION: {1: 1310, 10: 1326} + BINARY_CLASSIFICATION: {1: 436, 10: 569, None: 569}, + MULTICLASS_CLASSIFICATION: {1: 204, 10: 1797, None: 1797}, + MULTILABEL_CLASSIFICATION: {1: 204, 10: 1797, None: 1797}, + REGRESSION: {1: 1310, 10: 1326, None: 1326}, + MULTIOUTPUT_REGRESSION: {1: 1310, 10: 1326, None: 1326} } mock = unittest.mock.Mock() if task == BINARY_CLASSIFICATION: