Skip to content

Commit 39974ba

Browse files
committed
Merge pull request #25 from automl/development
Merge in latest developments
2 parents c35c74f + 0d89f89 commit 39974ba

File tree

184 files changed

+14963
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+14963
-81
lines changed

.coveralls.yml

Whitespace-only changes.

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ install:
3939

4040
# Install requirements from other repos
4141
- pip install git+https://github.com/automl/HPOlibConfigSpace.git
42-
- pip install git+https://github.com/automl/paramsklearn.git
42+
4343
- python setup.py install
4444

45+
# command to run tests, e.g. python setup.py test
4546
script:
4647
# - coverage run --source autosklearn setup.py test
47-
- cd test && nosetests -v --with-coverage
48+
- cd test && nosetests -v --with-coverage --cover-package=autosklearn
4849

49-
after_success: coveralls
50+
after_success: coveralls

CHANGES.md

Whitespace-only changes.

LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2014, Matthias Feurer
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the <organization> nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

autosklearn/automl.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
convert_conf2smac_string
2727
from autosklearn.evaluation import calculate_score
2828
from autosklearn.util import StopWatch, get_logger, setup_logger, \
29-
get_auto_seed, set_auto_seed, del_auto_seed, submit_process, paramsklearn, \
29+
get_auto_seed, set_auto_seed, del_auto_seed, submit_process, pipeline, \
3030
Backend
3131
from autosklearn.util.smac import run_smac
3232

@@ -76,7 +76,7 @@ def _create_search_space(tmp_dir, data_info, backend, watcher, logger,
7676
task_name = 'CreateConfigSpace'
7777
watcher.start_task(task_name)
7878
configspace_path = os.path.join(tmp_dir, 'space.pcs')
79-
configuration_space = paramsklearn.get_configuration_space(
79+
configuration_space = pipeline.get_configuration_space(
8080
data_info,
8181
include_estimators=include_estimators,
8282
include_preprocessors=include_preprocessors)
@@ -614,7 +614,11 @@ def _load_models(self):
614614
seed)
615615

616616
def score(self, X, y):
617+
# fix: Consider only index 1 of second dimension
618+
# Don't know if the reshaping should be done there or in calculate_score
617619
prediction = self.predict(X)
620+
if self._task == BINARY_CLASSIFICATION:
621+
prediction = prediction[:, 1].reshape((-1, 1))
618622
return calculate_score(y, prediction, self._task,
619623
self._metric, self._label_num,
620624
logger=self._logger)
@@ -695,4 +699,4 @@ def _delete_output_directories(self):
695699
pass
696700
else:
697701
print("Could not delete tmp dir: %s" %
698-
self._tmp_dir)
702+
self._tmp_dir)

autosklearn/cli/base_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from autosklearn.data.competition_data_manager import CompetitionDataManager
1212
from autosklearn.evaluation import CVEvaluator, HoldoutEvaluator, \
1313
NestedCVEvaluator, TestEvaluator, get_new_run_num
14-
from autosklearn.util.paramsklearn import get_configuration_space
14+
from autosklearn.util.pipeline import get_configuration_space
1515
from autosklearn.util import Backend
1616

1717

autosklearn/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232

3333
R2_METRIC = 10
3434
A_METRIC = 11
35-
REGRESSION_METRIC = [R2_METRIC, A_METRIC]
36-
METRIC = CLASSIFICATION_METRICS + REGRESSION_METRIC
35+
REGRESSION_METRICS = [R2_METRIC, A_METRIC]
36+
METRIC = CLASSIFICATION_METRICS + REGRESSION_METRICS
3737
STRING_TO_METRIC = {
3838
'acc': ACC_METRIC,
3939
'acc_metric': ACC_METRIC,

autosklearn/data/abstract_data_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
import scipy.sparse
77

8-
from ParamSklearn.implementations.OneHotEncoder import OneHotEncoder
8+
from autosklearn.pipeline.implementations.OneHotEncoder import OneHotEncoder
99

1010
from autosklearn.util import predict_RAM_usage
1111

autosklearn/ensemble_selection_script.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,20 @@ def get_predictions(dir_path, dir_path_list, include_num_runs,
5858
match = model_and_automl_re.search(model_name)
5959
automl_seed = int(match.group(1))
6060
num_run = int(match.group(2))
61+
62+
if model_name.endswith("/"):
63+
model_name = model_name[:-1]
64+
basename = os.path.basename(model_name)
65+
6166
if (automl_seed, num_run) in include_num_runs:
6267
if precision == "16":
63-
predictions = np.load(os.path.join(dir_path, model_name)).astype(dtype=np.float16)
68+
predictions = np.load(os.path.join(dir_path, basename)).astype(dtype=np.float16)
6469
elif precision == "32":
65-
predictions = np.load(os.path.join(dir_path, model_name)).astype(dtype=np.float32)
70+
predictions = np.load(os.path.join(dir_path, basename)).astype(dtype=np.float32)
6671
elif precision == "64":
67-
predictions = np.load(os.path.join(dir_path, model_name)).astype(dtype=np.float64)
72+
predictions = np.load(os.path.join(dir_path, basename)).astype(dtype=np.float64)
6873
else:
69-
predictions = np.load(os.path.join(dir_path, model_name))
74+
predictions = np.load(os.path.join(dir_path, basename))
7075
result.append(predictions)
7176
return result
7277

@@ -249,7 +254,10 @@ def main(autosklearn_tmp_dir,
249254
dir_ensemble_list_mtimes = []
250255

251256
for dir_ensemble_file in dir_ensemble_list:
252-
dir_ensemble_file = os.path.join(dir_ensemble, dir_ensemble_file)
257+
if dir_ensemble_file.endswith("/"):
258+
dir_ensemble_file = dir_ensemble_file[:-1]
259+
basename = os.path.basename(dir_ensemble_file)
260+
dir_ensemble_file = os.path.join(dir_ensemble, basename)
253261
mtime = os.path.getmtime(dir_ensemble_file)
254262
dir_ensemble_list_mtimes.append(mtime)
255263

@@ -285,14 +293,18 @@ def main(autosklearn_tmp_dir,
285293

286294
model_idx = 0
287295
for model_name in dir_ensemble_list:
296+
if model_name.endswith("/"):
297+
model_name = model_name[:-1]
298+
basename = os.path.basename(model_name)
299+
288300
if precision is "16":
289-
predictions = np.load(os.path.join(dir_ensemble, model_name)).astype(dtype=np.float16)
301+
predictions = np.load(os.path.join(dir_ensemble, basename)).astype(dtype=np.float16)
290302
elif precision is "32":
291-
predictions = np.load(os.path.join(dir_ensemble, model_name)).astype(dtype=np.float32)
303+
predictions = np.load(os.path.join(dir_ensemble, basename)).astype(dtype=np.float32)
292304
elif precision is "64":
293-
predictions = np.load(os.path.join(dir_ensemble, model_name)).astype(dtype=np.float64)
305+
predictions = np.load(os.path.join(dir_ensemble, basename)).astype(dtype=np.float64)
294306
else:
295-
predictions = np.load(os.path.join(dir_ensemble, model_name))
307+
predictions = np.load(os.path.join(dir_ensemble, basename))
296308
score = calculate_score(targets_ensemble, predictions,
297309
task_type, metric,
298310
predictions.shape[1])

autosklearn/evaluation/abstract_evaluator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import numpy as np
99
import lockfile
10-
from ParamSklearn.classification import ParamSklearnClassifier
11-
from ParamSklearn.regression import ParamSklearnRegressor
10+
from autosklearn.pipeline.classification import SimpleClassificationPipeline
11+
from autosklearn.pipeline.regression import SimpleRegressionPipeline
1212
from sklearn.dummy import DummyClassifier, DummyRegressor
1313

1414
from autosklearn.constants import *
@@ -106,13 +106,13 @@ def __init__(self, Datamanager, configuration=None,
106106
if self.configuration is None:
107107
self.model_class = MyDummyRegressor
108108
else:
109-
self.model_class = ParamSklearnRegressor
109+
self.model_class = SimpleRegressionPipeline
110110
self.predict_function = self.predict_regression
111111
else:
112112
if self.configuration is None:
113113
self.model_class = MyDummyClassifier
114114
else:
115-
self.model_class = ParamSklearnClassifier
115+
self.model_class = SimpleClassificationPipeline
116116
self.predict_function = self.predict_proba
117117

118118
if num_run is None:

0 commit comments

Comments
 (0)