Skip to content

Commit 7d29757

Browse files
author
Matthias Feurer
committed
bump xgboost version number, remove grid_scores_ attribute
1 parent 09c18ff commit 7d29757

File tree

7 files changed

+9
-106
lines changed

7 files changed

+9
-106
lines changed

autosklearn/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55

66
__MANDATORY_PACKAGES__ = '''
7-
numpy>=1.9,<1.12
7+
numpy>=1.9
88
scikit-learn==0.18.1
99
smac==0.4.0
1010
lockfile>=0.10
1111
ConfigSpace>=0.3.3,<0.4
1212
pyrfr==0.2.0
13-
xgboost==0.4a30
13+
xgboost==0.6a2
1414
'''
1515

1616
dependencies.verify_packages(__MANDATORY_PACKAGES__)

autosklearn/automl.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from sklearn.base import BaseEstimator
1515
from smac.tae.execute_ta_run import StatusType
1616
from smac.stats.stats import Stats
17-
from sklearn.grid_search import _CVScoreTuple
1817

1918
from autosklearn.constants import *
2019
from autosklearn.metrics import Scorer
@@ -638,35 +637,6 @@ def score(self, X, y):
638637
metric=self._metric,
639638
all_scoring_functions=False)
640639

641-
@property
642-
def grid_scores_(self):
643-
grid_scores = list()
644-
645-
scores_per_config = defaultdict(list)
646-
config_list = list()
647-
648-
for run_key in self.runhistory_.data:
649-
run_value = self.runhistory_.data[run_key]
650-
651-
config_id = run_key.config_id
652-
cost = run_value.cost
653-
654-
if config_id not in config_list:
655-
config_list.append(config_id)
656-
657-
scores_per_config[config_id].append(cost)
658-
659-
for config_id in config_list:
660-
scores = [1 - score for score in scores_per_config[config_id]]
661-
mean_score = np.mean(scores)
662-
config = self.runhistory_.ids_config[config_id]
663-
664-
grid_score = _CVScoreTuple(config.get_dictionary(), mean_score,
665-
scores)
666-
grid_scores.append(grid_score)
667-
668-
return grid_scores
669-
670640
@property
671641
def cv_results_(self):
672642
results = dict()

autosklearn/estimators.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ def show_models(self):
8080
"""
8181
return self._automl.show_models()
8282

83-
@property
84-
def grid_scores_(self):
85-
return self._automl.grid_scores_
86-
8783
@property
8884
def cv_results_(self):
8985
return self._automl.cv_results_
@@ -227,23 +223,12 @@ def __init__(self,
227223
228224
Attributes
229225
----------
230-
grid_scores\_ : list of named tuples
231-
Contains scores for all parameter combinations in param_grid.
232-
Each entry corresponds to one parameter setting.
233-
Each named tuple has the attributes:
234-
235-
* ``parameters``, a dict of parameter settings
236-
* ``mean_validation_score``, the mean score over the
237-
cross-validation folds
238-
* ``cv_validation_scores``, the list of scores for each fold
239226
240227
cv_results\_ : dict of numpy (masked) ndarrays
241228
A dict with keys as column headers and values as columns, that can be
242229
imported into a pandas ``DataFrame``.
243230
244-
This attribute is a backward port to already support the advanced
245-
output of scikit-learn 0.18. Not all keys returned by scikit-learn
246-
are supported yet.
231+
Not all keys returned by scikit-learn are supported yet.
247232
248233
"""
249234
self.time_left_for_this_task = time_left_for_this_task

example/example_holdout.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@
88
import autosklearn.classification
99

1010

11-
# Utility function to report best scores
12-
# from http://scikit-learn.org/stable/auto_examples/model_selection/randomized_search.html#example-model-selection-randomized-search-py
13-
def report(grid_scores, n_top=3):
14-
top_scores = sorted(grid_scores, key=itemgetter(1), reverse=True)[:n_top]
15-
for i, score in enumerate(top_scores):
16-
print("Model with rank: {0}".format(i + 1))
17-
print("Mean validation score: {0:.3f} (std: {1:.3f})".format(
18-
score.mean_validation_score,
19-
np.std(score.cv_validation_scores)))
20-
print("Parameters: {0}".format(score.parameters))
21-
print("")
22-
23-
2411
def main():
2512
digits = sklearn.datasets.load_digits()
2613
X = digits.data
@@ -35,10 +22,6 @@ def main():
3522
disable_evaluator_output=False)
3623
automl.fit(X_train, y_train, dataset_name='digits')
3724

38-
# Print the best models together with their scores - if all scores are
39-
# unreasonably bad (around 0.0) you should have a look into the logging
40-
# file to figure out the error
41-
report(automl.grid_scores_)
4225
# Print the final ensemble constructed by auto-sklearn.
4326
print(automl.show_models())
4427
predictions = automl.predict(X_test)

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ nose
44
six
55
Cython
66

7-
numpy>=1.9.0,<1.12
7+
numpy>=1.9.0
88
scipy>=0.14.1
99

1010
scikit-learn==0.18.1
@@ -15,7 +15,7 @@ psutil
1515
pyyaml
1616
liac-arff
1717
pandas
18-
xgboost==0.4a30
18+
xgboost==0.6a20
1919

2020
ConfigSpace>=0.3.3,<0.4
2121
pynisher>=0.4

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"nose",
1717
"six",
1818
"Cython",
19-
"numpy>=1.9.0,<1.12",
19+
"numpy>=1.9.0",
2020
"scipy>=0.14.1",
2121
"scikit-learn==0.18.1",
2222
"lockfile",
@@ -25,7 +25,7 @@
2525
"pyyaml",
2626
"liac-arff",
2727
"pandas",
28-
"xgboost==0.4a30",
28+
"xgboost==0.6a2",
2929
"ConfigSpace>=0.3.3,<0.4",
3030
"pynisher>=0.4",
3131
"pyrfr",

test/test_automl/test_estimators.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import numpy as np
1111
import numpy.ma as npma
12-
from sklearn.grid_search import _CVScoreTuple
1312

1413
import autosklearn.pipeline.util as putil
1514
from autosklearn.classification import AutoSklearnClassifier
@@ -114,7 +113,9 @@ def test_fit_pSMAC(self):
114113
with open(true_targets_ensemble_path, 'rb') as fh:
115114
true_targets_ensemble = np.load(fh)
116115
true_targets_ensemble[-1] = 1 if true_targets_ensemble[-1] != 1 else 0
116+
true_targets_ensemble = true_targets_ensemble.astype(int)
117117
probas = np.zeros((len(true_targets_ensemble), 3), dtype=float)
118+
118119
for i, value in enumerate(true_targets_ensemble):
119120
probas[i, value] = 1.0
120121
dummy_predictions_path = os.path.join(output, '.auto-sklearn',
@@ -164,42 +165,6 @@ def test_fit_pSMAC(self):
164165
del automl
165166
self._tearDown(output)
166167

167-
def test_grid_scores(self):
168-
output = os.path.join(self.test_dir, '..', '.tmp_grid_scores')
169-
self._setUp(output)
170-
171-
cls = AutoSklearnClassifier(time_left_for_this_task=30,
172-
per_run_time_limit=5,
173-
output_folder=output,
174-
tmp_folder=output,
175-
shared_mode=False,
176-
seed=1,
177-
initial_configurations_via_metalearning=0,
178-
ensemble_size=0)
179-
cls_ = cls.build_automl()
180-
automl = cls_._automl
181-
automl.runhistory_ = unittest.mock.MagicMock()
182-
183-
RunKey = collections.namedtuple(
184-
'RunKey', ['config_id', 'instance_id', 'seed'])
185-
186-
RunValue = collections.namedtuple(
187-
'RunValue', ['cost', 'time', 'status', 'additional_info'])
188-
189-
runhistory = dict()
190-
runhistory[RunKey(1, 1, 1)] = RunValue(1, 1, 1, '')
191-
automl.runhistory_.data = runhistory
192-
grid_scores_ = automl.grid_scores_
193-
194-
self.assertIsInstance(grid_scores_[0], _CVScoreTuple)
195-
# In the runhistory we store losses, thus the score is zero
196-
self.assertEqual(grid_scores_[0].mean_validation_score, 0)
197-
self.assertEqual(grid_scores_[0].cv_validation_scores, [0])
198-
self.assertIsInstance(grid_scores_[0].parameters, unittest.mock.MagicMock)
199-
200-
del automl
201-
self._tearDown(output)
202-
203168
def test_cv_results(self):
204169
# TODO restructure and actually use real SMAC output from a long run
205170
# to do this unittest!

0 commit comments

Comments
 (0)