Repository: automl/auto-sklearn

Issue:
Execution fails when tries to set no memory limit for model building
## Describe the bug ##
Execution errors out when `None` is used for `memory_limit`

```
automl = autosklearn.classification.AutoSklearnClassifier(
    time_left_for_this_task=120,
    per_run_time_limit=30,
    tmp_folder='/tmp/autosklearn_classification_example_tmp',
    output_folder='/tmp/autosklearn_classification_example_out',
    memory_limit=None,
)
automl.fit(X_train, y_train, dataset_name='breast_cancer')
```

## Actual behavior, stacktrace or logfile ##
```
Traceback (most recent call last):
  File "example_classification.py", line 35, in <module>
    automl.fit(X_train, y_train, dataset_name='breast_cancer')
  File "opensource/auto-sklearn/autosklearn/estimators.py", line 598, in fit
    dataset_name=dataset_name,
  File "opensource/auto-sklearn/autosklearn/estimators.py", line 357, in fit
    self.automl_.fit(load_models=self.load_models, **kwargs)
  File "opensource/auto-sklearn/autosklearn/automl.py", line 1422, in fit
    is_classification=True,
  File "opensource/auto-sklearn/autosklearn/automl.py", line 487, in fit
    task=self._task,
  File "opensource/auto-sklearn/autosklearn/automl.py", line 830, in subsample_if_too_large
    if memory_limit <= megabytes * 10:
TypeError: '<=' not supported between instances of 'NoneType' and 'float'
```

## Environment and installation: ##

Please give details about your installation:

* Is your installation in a virtual environment or conda environment? virtaul environment
* Python version: 3.7.3
* Auto-sklearn version: development branch



Discussion:

Resolving patch:
diff --git a/autosklearn/automl.py b/autosklearn/automl.py
--- 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):


Test patch:
diff --git a/test/test_automl/test_automl.py b/test/test_automl/test_automl.py
--- 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: