Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused file optuna_multi_objective.py #17

Merged
merged 4 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
Expand All @@ -31,6 +31,7 @@ jobs:
if: matrix.python-version == 3.7
run: |
pip install --progress-bar off $(ls dist/*.tar.gz)[checking]
pip install --progress-bar off types-setuptools

- name: Run checks
if: matrix.python-version == 3.7
Expand Down
2 changes: 1 addition & 1 deletion examples/quadratic_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def current_step(self) -> int:

def evaluate(self, next_step: int) -> List[float]:
self._current_step = 1
return [self._x ** 2 + self._y]
return [self._x**2 + self._y]


if __name__ == "__main__":
Expand Down
5 changes: 4 additions & 1 deletion examples/random_solver.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from typing import List
from typing import Optional

import numpy as np

from kurobako import problem
Expand All @@ -18,7 +21,7 @@ def __init__(self, seed: int, problem: problem.ProblemSpec):
self._problem = problem

def ask(self, idg: solver.TrialIdGenerator) -> solver.NextTrial:
params = []
params: List[Optional[float]] = []
for p in self._problem.params:
if p.distribution == problem.Distribution.UNIFORM:
params.append(self._rng.uniform(p.range.low, p.range.high))
Expand Down
12 changes: 10 additions & 2 deletions kurobako/solver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ def __init__(self, trial_id: int, values: List[float], current_step: int):
self.current_step = current_step

def to_dict(self) -> Dict[str, Any]:
return {"id": self.trial_id, "values": self.values, "current_step": self.current_step}
return {
"id": self.trial_id,
"values": self.values,
"current_step": self.current_step,
}

@staticmethod
def from_dict(d: Dict[str, Any]) -> Any:
Expand Down Expand Up @@ -221,7 +225,11 @@ def _handle_ask_call(self, message: Dict[str, Any]):
solver = self._solvers[solver_id]
trial = solver.ask(idg)

message = {"type": "ASK_REPLY", "trial": trial.to_dict(), "next_trial_id": idg.next_id}
message = {
"type": "ASK_REPLY",
"trial": trial.to_dict(),
"next_trial_id": idg.next_id,
}
self._send_message(message)

def _handle_tell_call(self, message: Dict[str, Any]):
Expand Down
14 changes: 6 additions & 8 deletions kurobako/solver/optuna.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import optuna
from pkg_resources import get_distribution
from pkg_resources import DistributionNotFound
from pkg_resources import get_distribution
import queue
from typing import Callable
from typing import Dict # NOQA
Expand Down Expand Up @@ -28,11 +28,11 @@ def __init__(
self._warm_starting_trials = warm_starting_trials

def specification(self) -> solver.SolverSpec:
try:
try:
optuna_version = get_distribution("optuna").version
except DistributionNotFound:
optuna_version = "unknown"
optuna_version = "unknown"

try:
kurobako_version = get_distribution("kurobako").version
except DistributionNotFound:
Expand All @@ -41,9 +41,7 @@ def specification(self) -> solver.SolverSpec:
return solver.SolverSpec(
name=self._name,
attrs={
"version": "optuna={}, kurobako-py={}".format(
optuna_version, kurobako_version
),
"version": "optuna={}, kurobako-py={}".format(optuna_version, kurobako_version),
"github": "https://github.com/optuna/optuna",
"paper": 'Akiba, Takuya, et al. "Optuna: A next-generation hyperparameter '
'optimization framework." Proceedings of the 25th ACM SIGKDD International '
Expand Down Expand Up @@ -101,7 +99,7 @@ def _next_step(self, current_step: int) -> int:
rung = 0
while True:
n = pruner._min_early_stopping_rate + rung
step = pruner._min_resource * (pruner._reduction_factor ** n)
step = pruner._min_resource * (pruner._reduction_factor**n)
if step > current_step:
return min(step, self._problem.last_step)
rung += 1
Expand Down
173 changes: 0 additions & 173 deletions kurobako/solver/optuna_multi_objective.py

This file was deleted.