Skip to content

Commit

Permalink
update travis script.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-young-2013 committed Mar 22, 2021
1 parent d5312d6 commit 063666e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
50 changes: 50 additions & 0 deletions litebo/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import sys
import numpy as np
from litebo.utils.start_smbo import create_smbo


def branin(x):
xs = x.get_dictionary()
x1 = xs['x1']
x2 = xs['x2']
a = 1.
b = 5.1 / (4. * np.pi ** 2)
c = 5. / np.pi
r = 6.
s = 10.
t = 1. / (8. * np.pi)
ret = a * (x2 - b * x1 ** 2 + c * x1 - r) ** 2 + s * (1 - t) * np.cos(x1) + s
return {'objs': (ret,)}


config_dict = {
"optimizer": "SMBO",
"parameters": {
"x1": {
"type": "float",
"bound": [-5, 10],
"default": 0
},
"x2": {
"type": "float",
"bound": [0, 15]
},
},
"advisor_type": 'default',
"max_runs": 50,
"surrogate_type": 'gp',
"time_limit_per_trial": 5,
"logging_dir": 'logs',
"task_id": 'hp1'
}


def main():
bo = create_smbo(branin, **config_dict)


if __name__ == "__main__":
sys.exit(main())
14 changes: 9 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import importlib.util
from pathlib import Path
from typing import Dict, List
from setuptools import setup, find_packages

import setuptools
from distutils.core import setup
from setuptools import find_packages


requirements: Dict[str, List[str]] = {}
requirements = dict()
for extra in ["dev", "main"]:
# Skip `package @ git+[repo_url]` because not supported by pypi
requirements[extra] = [r
Expand Down Expand Up @@ -44,9 +42,15 @@ def readme() -> str:
url='https://github.com/thomas-young-2013/lite-bo',
author="Thomas (Yang) Li from DAIM@PKU",
packages=find_packages(),
license="MIT",
install_requires=requirements["main"],
extras_require={"dev": requirements["dev"]},
package_data={"lite-bo": ["py.typed"]},
include_package_data=True,
python_requires='>=3.5.2'
python_requires='>=3.5.2',
entry_points={
"console_scripts": [
"litebo = litebo.__main__:main",
]
}
)

0 comments on commit 063666e

Please sign in to comment.