Skip to content

Commit

Permalink
Merge pull request #599 from automl/development
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
KEggensperger authored Mar 2, 2020
2 parents 2b27e0d + e489ddc commit 8e9b336
Show file tree
Hide file tree
Showing 148 changed files with 7,352 additions and 5,222 deletions.
26 changes: 4 additions & 22 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Issue Template
about: Describe this issue template's purpose here.
about: General template issues
labels:

---
Expand All @@ -12,34 +12,16 @@ Please file an issue for bug reports (label as `bug`), usage questions (label as
<!-- Instructions For Filing a Bug: https://github.com/automl/SMAC3/blob/master/CONTRIBUTING.md -->

#### Description
<!-- Example: error: argument --initial-incumbent/--initial_incumbent: invalid choice: 'sobol' -->
<!-- Describe what you wanted to do -->

#### Steps/Code to Reproduce
<!--
Example:
```
from smac.facade.func_facade import fmin_smac
def rosenbrock_2d(x):
x1 = x[0]
x2 = x[1]
val = 100. * (x2 - x1 ** 2.) ** 2. + (1 - x1) ** 2.
return val
x, cost, _ = fmin_smac(func=rosenbrock_2d,
x0=[-3, -4],
bounds=[(-5, 5), (-5, 5)],
maxfun=325,
scenario_args={"initial_incumbent": "sobol"},
rng=3)
```
If the code is too long, feel free to put it in a public gist and link
Please provide us with code to reproduce your issue. If the code is too long, feel free to put it in a public gist and link
it in the issue: https://gist.github.com
-->

#### Expected Results
<!-- Example: No error is thrown. Please paste or describe the expected results.-->
<!-- Please paste or describe the expected results.-->

#### Actual Results
<!-- Please paste or specifically describe the actual output or traceback. -->
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ before_install:
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- if [[ `which conda` ]]; then echo 'Conda installation successful'; else exit 1; fi
- conda create -n testenv --yes python=$PYTHON_VERSION pip wheel nose gxx_linux-64 gcc_linux-64 swig
- conda create -n testenv --yes python=$PYTHON_VERSION pip wheel pytest gxx_linux-64 gcc_linux-64 swig
- source activate testenv

install:
- pip install pep8 codecov mypy flake8
- pip install pep8 codecov mypy flake8 pytest-cov
- cat requirements.txt | xargs -n 1 -L 1 pip install
- pip install .[all]

Expand Down
14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@

.PHONY: test
test:
python -m nose -sv --with-coverage --cover-package=smac

.PHONY: test-fast
test-fast:
# requires nose-timer
python -m nose -a '!slow' -sv --with-coverage --cover-package=smac --with-timer --timer-top-n 15

.PHONY: test-runtimes
test-runtimes:
# requires nose-timer
python -m nose -sv --with-timer --timer-top-n 15
pytest -v --cov=smac test --durations=20

.PHONY: doc
doc:
Expand Down Expand Up @@ -39,4 +29,4 @@ clean-data:
rm -Rf test/test_files/validation/test/
rm -f test/test_files/validation/validated_runhistory.json*
rm -f test/test_files/validation/validated_runhistory_EPM.json*
rm -Rf test/test_files/out_*/
rm -Rf test/test_files/out_*/
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ is written in C++.
## Requirements

Besides the listed requirements (see `requirements.txt`), the random forest
used in SMAC3 requires SWIG (>= 3.0).
used in SMAC3 requires SWIG (>= 3.0, <4.0) as a build dependency:

```apt-get install swig```

On Arch Linux (or any distribution with swig4 as default implementation):

```
pacman -Syu swig3
ln -s /usr/bin/swig-3 /usr/bin/swig
```

## Installation via pip

Expand Down
37 changes: 36 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# 0.12.0

## Major Changes

* Support for Successive Halving and Hyperband as new instensification/racing strategies.
* Improve the SMAC architecture by moving from an architecture where new candidates are passed to the racing algorithm
to an architecture where the racing algorithm requests new candidates, which is necessary to implement the
[BOHB](http://proceedings.mlr.press/v80/falkner18a.html) algorithm (#551).
* Source code is now PEP8 compliant. PEP8 compliance is checked by travis-ci (#565).
* Source code is now annotated with type annotation and checked with mypy.

## Minor Changes

* New argument to directly control the size of the initial design (#553).
* Acquisition function is fed additional arguments at update time (#557).
* Adds new acquisition function maximizer which goes through a list of pre-specified configurations (#558).
* Document that the dependency pyrfr does not work with SWIG 4.X (#599).
* Improved error message for objects which cannot be serialized to json (#453).
* Dropped the random forest with HPO surrogate which was added in 0.9.
* Dropped the EPILS facade which was added in 0.6.
* Simplified the interface for constructing a runhistory object.
* removed the default rng from the Gaussian process priors (#554).
* Adds the possibility to specify the acquisition function optimizer for the random search (ROAR) facade (#563).
* Bump minimal version of `ConfigSpace` requirement to 0.4.9 (#578).
* Examples are now rendered on the website using sphinx gallery (#567).

## Bug fixes

* Fixes a bug which caused SMAC to fail for Python function if `use_pynisher=False` and an exception was raised
(#437).
* Fixes a bug in which samples from a Gaussian process were shaped differently based on the number of dimesions of
the `y`-array used for fitting the GP (#556).
* Fixes a bug with respect saving data as json (#555).
* Better error message for a sobol initial design of size `>40` ( #564).
* Add a missing return statement to `GaussianProcess._train`.

# 0.11.1

## Changes
Expand All @@ -24,7 +60,6 @@
* Extend the Sobol and LHD initial design to work for non-continuous hyperparameters as well applying an idea similar
to inverse transform sampling (#494)


## Bug fixes

* Fixes a regression in the validation scripts (#519)
Expand Down
16 changes: 0 additions & 16 deletions ci_scripts/circle_install.sh

This file was deleted.

3 changes: 0 additions & 3 deletions ci_scripts/create_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ if ! [[ -z ${DOCPUSH+x} ]]; then

if [[ "$DOCPUSH" == "true" ]]; then

# install documentation building dependencies
pip install --upgrade sphinx_rtd_theme

# $1 is the branch name
# $2 is the global variable where we set the script status

Expand Down
42 changes: 0 additions & 42 deletions ci_scripts/push_doc.sh

This file was deleted.

2 changes: 1 addition & 1 deletion ci_scripts/run_examples.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cd examples

for script in fmin_rosenbrock.py SMAC4BO_rosenbrock.py SMAC4HPO_acq_rosenbrock.py SMAC4HPO_rf.py SMAC4HPO_rosenbrock.py SMAC4HPO_svm.py
for script in *.py
do
python $script
rval=$?
Expand Down
141 changes: 1 addition & 140 deletions ci_scripts/run_flake8.sh
Original file line number Diff line number Diff line change
@@ -1,141 +1,2 @@
#!/bin/bash

# This script is mostly taken from https://github.com/scikit-learn/scikit-learn/blob/master/build_tools/travis/flake8_diff.sh

# This script is used in Travis to check that PRs do not add obvious
# flake8 violations. It relies on two things:
# - find common ancestor between branch and
# automl/auto-sklearn remote
# - run flake8 --diff on the diff between the branch and the common
# ancestor
#
# Additional features:
# - the line numbers in Travis match the local branch on the PR
# author machine.
# - ./build_tools/travis/flake8_diff.sh can be run locally for quick
# turn-around

set -e
# pipefail is necessary to propagate exit codes
set -o pipefail

PROJECT=automl/SMAC3
PROJECT_URL=https://github.com/$PROJECT.git

# Find the remote with the project name (upstream in most cases)
REMOTE=$(git remote -v | grep $PROJECT | cut -f1 | head -1 || echo '')

# Add a temporary remote if needed. For example this is necessary when
# Travis is configured to run in a fork. In this case 'origin' is the
# fork and not the reference repo we want to diff against.
if [[ -z "$REMOTE" ]]; then
TMP_REMOTE=tmp_reference_upstream
REMOTE=$TMP_REMOTE
git remote add $REMOTE $PROJECT_URL
fi

echo "Remotes:"
echo '--------------------------------------------------------------------------------'
git remote --verbose

# Travis does the git clone with a limited depth.
# This may not be enough to find the common ancestor with
# $REMOTE/development so we unshallow the git checkout
if [[ -a .git/shallow ]]; then
echo -e '\nTrying to unshallow the repo:'
echo '--------------------------------------------------------------------------------'
git fetch --unshallow
fi

if [[ "$TRAVIS" == "true" ]]; then
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]
then
# In main repo, using TRAVIS_COMMIT_RANGE to test the commits
# that were pushed into a branch
if [[ "$PROJECT" == "$TRAVIS_REPO_SLUG" ]]; then
if [[ -z "$TRAVIS_COMMIT_RANGE" ]]; then
echo "New branch, no commit range from Travis so passing this test by convention"
exit 0
fi
COMMIT_RANGE=$TRAVIS_COMMIT_RANGE
fi
else
# We want to fetch the code as it is in the PR branch and not
# the result of the merge into development. This way line numbers
# reported by Travis will match with the local code.
LOCAL_BRANCH_REF=travis_pr_$TRAVIS_PULL_REQUEST
# In Travis the PR target is always origin
git fetch origin pull/$TRAVIS_PULL_REQUEST/head:refs/$LOCAL_BRANCH_REF
fi
fi

# If not using the commit range from Travis we need to find the common
# ancestor between $LOCAL_BRANCH_REF and $REMOTE/development
if [[ -z "$COMMIT_RANGE" ]]; then
if [[ -z "$LOCAL_BRANCH_REF" ]]; then
LOCAL_BRANCH_REF=$(git rev-parse --abbrev-ref HEAD)
fi
echo -e "\nLast 2 commits in $LOCAL_BRANCH_REF:"
echo '--------------------------------------------------------------------------------'
git --no-pager log -2 $LOCAL_BRANCH_REF

REMOTE_DEVELOPMENT_REF="$REMOTE/development"
# Make sure that $REMOTE_DEVELOPMENT_REF is a valid reference
echo -e "\nFetching $REMOTE_DEVELOPMENT_REF"
echo '--------------------------------------------------------------------------------'
git fetch $REMOTE development:refs/remotes/$REMOTE_DEVELOPMENT_REF
LOCAL_BRANCH_SHORT_HASH=$(git rev-parse --short $LOCAL_BRANCH_REF)
REMOTE_DEVELOPMENT_SHORT_HASH=$(git rev-parse --short $REMOTE_DEVELOPMENT_REF)

COMMIT=$(git merge-base $LOCAL_BRANCH_REF $REMOTE_DEVELOPMENT_REF) || \
echo "No common ancestor found for $(git show $LOCAL_BRANCH_REF -q) and $(git show $REMOTE_DEVELOPMENT_REF -q)"

if [ -z "$COMMIT" ]; then
exit 1
fi

COMMIT_SHORT_HASH=$(git rev-parse --short $COMMIT)

echo -e "\nCommon ancestor between $LOCAL_BRANCH_REF ($LOCAL_BRANCH_SHORT_HASH)"\
"and $REMOTE_DEVELOPMENT_REF ($REMOTE_DEVELOPMENT_SHORT_HASH) is $COMMIT_SHORT_HASH:"
echo '--------------------------------------------------------------------------------'
git --no-pager show --no-patch $COMMIT_SHORT_HASH

COMMIT_RANGE="$COMMIT_SHORT_HASH..$LOCAL_BRANCH_SHORT_HASH"

if [[ -n "$TMP_REMOTE" ]]; then
git remote remove $TMP_REMOTE
fi

else
echo "Got the commit range from Travis: $COMMIT_RANGE"
fi

echo -e '\nRunning flake8 on the diff in the range' "$COMMIT_RANGE" \
"($(git rev-list $COMMIT_RANGE | wc -l) commit(s)):"
echo '--------------------------------------------------------------------------------'

# We need the following command to exit with 0 hence the echo in case
# there is no match
MODIFIED_FILES="$(git diff --name-only $COMMIT_RANGE || echo "no_match")"

check_files() {
files="$1"
shift
options="$*"
if [ -n "$files" ]; then
# Conservative approach: diff without context (--unified=0) so that code
# that was not changed does not create failures
git diff --unified=0 $COMMIT_RANGE -- $files | flake8 --diff --max-line-length=120 --show-source $options
fi
}

if [[ "$MODIFIED_FILES" == "no_match" ]]; then
echo "No file has been modified"
else

check_files "$(echo "$MODIFIED_FILES" | grep -v ^examples)"
check_files "$(echo "$MODIFIED_FILES" | grep ^examples)" \
--config ./examples/.flake8
fi
echo -e "No problem detected by flake8\n"
flake8 --max-line-length=120 --show-source $options --ignore W605,E402,W503 --exclude .git,__pycache__,doc,build,dist,examples/spear_qcp/target_algorithm
24 changes: 19 additions & 5 deletions ci_scripts/run_mypy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
MYPYPATH=smac/
MYPYOPTS="--ignore-missing-imports --strict"
MYPYOPTS="$MYPYOPS --disallow-any-unimported --disallow-any-expr --disallow-any-decorated --disallow-any-explicit --disallow-any-generics --disallow-untyped-defs"
mypy $MYPYOPTS $MYPYPATH
exit 0
#MYPYPATH=smac
MYPYOPTS=""

MYPYOPS="$MYPYOPS --ignore-missing-imports --follow-imports skip"
# We would like to have the following options set, but for now we have to use the ones above to get started
#MYPYOPTS="--ignore-missing-imports --strict"
#MYPYOPTS="$MYPYOPS --disallow-any-unimported"
#MYPYOPTS="$MYPYOPS --disallow-any-expr"
#MYPYOPTS="$MYPYOPS --disallow-any-decorated"
#MYPYOPTS="$MYPYOPS --disallow-any-explicit"
#MYPYOPTS="$MYPYOPS --disallow-any-generics"
MYPYOPTS="$MYPYOPS --disallow-untyped-decorators"
MYPYOPTS="$MYPYOPS --disallow-incomplete-defs"
MYPYOPTS="$MYPYOPS --disallow-untyped-defs"
# Add the following once the scenario is removed from teh main code or typed
# https://mypy.readthedocs.io/en/stable/command_line.html#configuring-warnings
# MYPYOPTS="$MYPYOPS --warn-unused-ignores"

mypy $MYPYOPTS --show-error-codes smac
Loading

0 comments on commit 8e9b336

Please sign in to comment.