Skip to content

Commit 5c12496

Browse files
authored
Merge pull request #214 from automl/development
Release of auto-sklearn 0.1.2
2 parents 5d1931a + b510dfe commit 5c12496

File tree

22 files changed

+168
-124
lines changed

22 files changed

+168
-124
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ before_install:
5353
- conda install --yes gcc
5454
- echo "Using GCC at "`which gcc`
5555
- export CC=`which gcc`
56+
# Fixes version `GLIBCXX_3.4.21' not found (on Ubuntu 16.04)
57+
- conda install --yes libgcc
5658

5759
install:
5860
- pip install coverage pep8 python-coveralls

autosklearn/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# -*- encoding: utf-8 -*-
22
from autosklearn.util import dependencies
3+
from autosklearn.__version__ import __version__
34

4-
__version__ = '0.1.1'
55

66
__MANDATORY_PACKAGES__ = '''
77
scikit-learn==0.17.1
8-
smac==0.2.1
8+
smac==0.2.2
99
lockfile>=0.10
1010
ConfigSpace>=0.2.1
1111
pyrfr==0.2.0
12+
xgboost==0.4a30
1213
'''
1314

1415
dependencies.verify_packages(__MANDATORY_PACKAGES__)

autosklearn/__version__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""Version information."""
2+
3+
# The following line *must* be the last in the module, exactly as formatted:
4+
__version__ = "0.1.2"

autosklearn/evaluation/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from .test_evaluator import *
1717
from .util import *
1818

19-
WORST_POSSIBLE_RESULT = 2.0
19+
WORST_POSSIBLE_RESULT = 1.0
2020

2121

2222
class ExecuteTaFuncWithQueue(AbstractTAFunc):

autosklearn/evaluation/test_evaluator.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
class TestEvaluator(AbstractEvaluator):
1515

16-
def __init__(self, Datamanager, output_dir,
16+
def __init__(self, Datamanager, backend,
1717
configuration=None,
1818
with_predictions=False,
1919
all_scoring_functions=False,
2020
seed=1):
2121
super(TestEvaluator, self).__init__(
22-
Datamanager, output_dir, configuration,
22+
Datamanager, backend, configuration,
2323
with_predictions=with_predictions,
2424
all_scoring_functions=all_scoring_functions,
2525
seed=seed,
@@ -71,16 +71,19 @@ def predict_and_loss(self, train=False):
7171

7272
# create closure for evaluating an algorithm
7373
# Has a stupid name so nosetests doesn't regard it as a test
74-
def eval_t(queue, config, data, tmp_dir, seed, num_run, subsample,
74+
def eval_t(queue, config, data, backend, seed, num_run, subsample,
7575
with_predictions, all_scoring_functions,
7676
output_y_test):
77-
evaluator = TestEvaluator(data, tmp_dir, config,
78-
seed=seed, with_predictions=with_predictions,
77+
evaluator = TestEvaluator(Datamanager=data, configuration=config,
78+
backend=backend, seed=seed,
79+
with_predictions=with_predictions,
7980
all_scoring_functions=all_scoring_functions)
8081

8182
loss, opt_pred, valid_pred, test_pred = evaluator.fit_predict_and_loss()
8283
duration, result, seed, run_info = evaluator.finish_up(
8384
loss, opt_pred, valid_pred, test_pred, file_output=False)
8485

8586
status = StatusType.SUCCESS
86-
queue.put((duration, result, seed, run_info, status))
87+
queue.put((duration, result, seed, run_info, status))
88+
89+

autosklearn/pipeline/components/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def add_component(self, obj):
5959
raise ValueError('Property %s not specified for algorithm %s')
6060

6161
self.components[name] = classifier
62-
print(name, classifier)
6362

6463

6564
class AutoSklearnClassificationAlgorithm(object):

autosklearn/smbo.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import functools
21
import os
32
import time
43
import traceback
@@ -508,15 +507,25 @@ def run_smbo(self, max_iters=1000):
508507
model = RandomForestWithInstances(types,
509508
#instance_features=meta_features_list,
510509
seed=1, num_trees=10)
510+
rh2EPM = RunHistory2EPM4Cost(num_params=num_params,
511+
scenario=self.scenario,
512+
success_states=[StatusType.SUCCESS,
513+
StatusType.MEMOUT,
514+
StatusType.TIMEOUT],
515+
impute_censored_data=False,
516+
impute_state=None)
511517
smac = SMAC(scenario=self.scenario,
512518
model=model,
513519
rng=seed,
520+
runhistory2epm=rh2EPM,
514521
tae_runner=ta,
515522
runhistory=runhistory)
516523
elif self.acquisition_function == 'EIPS':
517524
rh2EPM = RunHistory2EPM4EIPS(num_params=num_params,
518525
scenario=self.scenario,
519-
success_states=None,
526+
success_states=[StatusType.SUCCESS,
527+
StatusType.MEMOUT,
528+
StatusType.TIMEOUT],
520529
impute_censored_data=False,
521530
impute_state=None)
522531
model = UncorrelatedMultiObjectiveRandomForestWithInstances(
@@ -650,7 +659,7 @@ def choose_next(self, smac):
650659
self.logger.info('Using %d training points for SMAC.' %
651660
X_cfg.shape[0])
652661
next_configs_tmp = smac.solver.choose_next(
653-
X_cfg, Y_cfg, num_interleaved_random=110,
662+
X_cfg, Y_cfg,
654663
num_configurations_by_local_search=10,
655664
num_configurations_by_random_search_sorted=100)
656665

autosklearn/util/dependencies.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
from warnings import warn
2-
31
import pkg_resources
42
import re
5-
63
from distutils.version import LooseVersion
74

5+
RE_PATTERN = re.compile(
6+
r'^(?P<name>[\w\-]+)((?P<operation>==|>=|>)(?P<version>(\d+)?(\.[a-zA-Z0-9]+)?(\.\d+)?))?$')
87

9-
RE_PATTERN = re.compile('^(?P<name>[\w\-]+)((?P<operation>==|>=|>)(?P<version>(\d+\.)?(\d+\.)?(\d+)))?$')
108

119

1210
def verify_packages(packages):
@@ -49,25 +47,27 @@ def _verify_package(name, operation, version):
4947
check = installed_version > required_version or \
5048
installed_version == required_version
5149
else:
52-
raise NotImplementedError('operation \'%s\' is not supported' % operation)
50+
raise NotImplementedError(
51+
'operation \'%s\' is not supported' % operation)
5352
if not check:
54-
raise IncorrectPackageVersionError(name, installed_version, operation, required_version)
53+
raise IncorrectPackageVersionError(name, installed_version, operation,
54+
required_version)
5555

5656

5757
class MissingPackageError(Exception):
58-
5958
error_message = 'mandatory package \'{name}\' not found'
6059

6160
def __init__(self, package_name):
6261
self.package_name = package_name
63-
super(MissingPackageError, self).__init__(self.error_message.format(name=package_name))
62+
super(MissingPackageError, self).__init__(
63+
self.error_message.format(name=package_name))
6464

6565

6666
class IncorrectPackageVersionError(Exception):
67-
6867
error_message = '\'{name} {installed_version}\' version mismatch ({operation}{required_version})'
6968

70-
def __init__(self, package_name, installed_version, operation, required_version):
69+
def __init__(self, package_name, installed_version, operation,
70+
required_version):
7171
self.package_name = package_name
7272
self.installed_version = installed_version
7373
self.operation = operation

example/example_sequential.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import sklearn.cross_validation
2+
import sklearn.datasets
3+
import sklearn.metrics
4+
5+
import autosklearn.classification
6+
7+
8+
def main():
9+
digits = sklearn.datasets.load_digits()
10+
X = digits.data
11+
y = digits.target
12+
X_train, X_test, y_train, y_test = \
13+
sklearn.cross_validation.train_test_split(X, y, random_state=1)
14+
15+
automl = autosklearn.classification.AutoSklearnClassifier(
16+
time_left_for_this_task=1200, per_run_time_limit=30,
17+
tmp_folder='/tmp/autoslearn_sequential_example_tmp',
18+
output_folder='/tmp/autosklearn_sequential_example_out',
19+
# Do not construct ensembles in parallel to avoid using more than one
20+
# core at a time. The ensemble will be constructed after auto-sklearn
21+
# finished fitting all machine learning models.
22+
ensemble_size=0, delete_tmp_folder_after_terminate=False)
23+
automl.fit(X_train, y_train, dataset_name='digits')
24+
# This call to fit_ensemble uses all models trained in the previous call
25+
# to fit to build an ensemble which can be used with automl.predict()
26+
automl.fit_ensemble(y_train, ensemble_size=50)
27+
28+
print(automl.show_models())
29+
predictions = automl.predict(X_test)
30+
print(automl.sprint_statistics())
31+
print("Accuracy score", sklearn.metrics.accuracy_score(y_test, predictions))
32+
33+
34+
if __name__ == '__main__':
35+
main()

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ xgboost==0.4a30
2222
ConfigSpace
2323
pynisher>=0.4
2424
pyrfr
25-
smac==0.2.1
25+
smac==0.2.2

0 commit comments

Comments
 (0)