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

Add ifbo #115

Merged
merged 46 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b56b841
removing python 3.8 and 3.9 support
timurcarstensen Aug 26, 2024
78cf900
fixing version in pre-commit.yaml
timurcarstensen Aug 26, 2024
752f994
fixes
timurcarstensen Aug 26, 2024
33bacf0
removing from __future__ import annotations; removing typing_extensio…
timurcarstensen Aug 26, 2024
2df2389
removing mandatory import of `from __future__ import annotations`
timurcarstensen Aug 26, 2024
ed88a29
added back from `__future__ import annotations` where necessary; adde…
timurcarstensen Aug 26, 2024
e47ac91
fixing an import of `Self`
timurcarstensen Aug 26, 2024
2713e6a
Adding ifbo as dependency (for surrogates)
Neeratyoy Jul 8, 2024
cf6a8ac
Initial bulk commit
Neeratyoy Jul 15, 2024
46e39d5
Testing for ifbo as dep with mismatch of Python versions
Neeratyoy Jul 15, 2024
d97d3da
Trying again
Neeratyoy Jul 15, 2024
00530c5
Resolving scipy dependency
Neeratyoy Jul 15, 2024
41e254a
Simple format fix
Neeratyoy Jul 15, 2024
bbb9038
Adding MFPI-random + misc. changes
Neeratyoy Jul 15, 2024
a3c1a43
Major changes to get code synced; disabling Python 3.8 and 3.9 support
Neeratyoy Aug 5, 2024
38d2588
First ifBO successful run push
Neeratyoy Aug 29, 2024
2bd81db
Aggressive removal of code
Neeratyoy Aug 29, 2024
2916c6c
Removing GP support from freeze-thaw
Neeratyoy Aug 29, 2024
99a74be
Making ifbo related code much leaner
Neeratyoy Aug 29, 2024
f0515a0
Adding mean prediction for FT-PFN for fantasizing
Neeratyoy Aug 30, 2024
0b2a6ce
PFN perf maximizing + ifbo example + 3D plot
Neeratyoy Aug 30, 2024
d84f461
Updating example for debugging
Neeratyoy Aug 30, 2024
929ca3a
Adding ifbo fantasization initial
Neeratyoy Aug 30, 2024
6e02535
Import error fix
Neeratyoy Aug 30, 2024
78fd1e9
Aggresive cleanup and leaning
Neeratyoy Sep 1, 2024
9e74658
Fixing an assertion + minor comments
Neeratyoy Sep 1, 2024
1975c29
Updating ifbo dep version
Neeratyoy Sep 3, 2024
445a861
Minor signature change
Neeratyoy Sep 3, 2024
cc6bcec
Updating ifbo version
Neeratyoy Sep 3, 2024
6ad8672
Update freeze_thaw.py with ifbo HPs
Neeratyoy Sep 5, 2024
91030e9
Handling varying step_size in ifbo
Neeratyoy Sep 5, 2024
72113f3
Simplify initial design for ifbo
Neeratyoy Sep 5, 2024
9068fa3
plot3D refactor; small bugfix
karibbov Sep 6, 2024
076284c
fix: Update state tests with new optimizers
eddiebergman Sep 16, 2024
998b0b7
style: Fix typing/assertions for plotter3d
eddiebergman Sep 16, 2024
6b75aa8
fix(FTPFN): Workaround for windows download of surrogate model
eddiebergman Sep 17, 2024
24f7bde
fix(tensorboard): Ensure tensorboard knows about end of config
eddiebergman Sep 17, 2024
34775cd
fix: Create default path to avoid warning
eddiebergman Sep 17, 2024
304d3fb
fix: Pathing
eddiebergman Sep 17, 2024
53c7044
fix: Pre-commit fixes, docs, unused, typing
eddiebergman Sep 17, 2024
b65143f
style: ruff
eddiebergman Sep 17, 2024
b1c6ec4
fix: Incorrect typing leading to attribute error
eddiebergman Sep 17, 2024
7ad4eaa
fix: Only re-download the model if not downloaded before
eddiebergman Sep 17, 2024
dcdb722
feat: Cache ftpfn model
eddiebergman Sep 17, 2024
fae0628
fix: Ignore `.data` folder used in example that downloads MNIST
eddiebergman Sep 17, 2024
a2c5069
Freeze-thaw example tblogger update
Neeratyoy Sep 18, 2024
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: 1 addition & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: '3.10'
- run: pip install pre-commit
- run: pre-commit install
- run: pre-commit run --all-files

2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
defaults:
run:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ jahs_bench_data/

# Yaml tests
path

# From example that uses MNIST
.data
2 changes: 1 addition & 1 deletion docs/_code/api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# https://mkdocstrings.github.io/recipes/
"""
from __future__ import annotations


import logging
from pathlib import Path
Expand Down
2 changes: 0 additions & 2 deletions docs/_code/example_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# https://mkdocstrings.github.io/recipes/
"""
from __future__ import annotations

import logging
from pathlib import Path
Expand All @@ -16,7 +15,6 @@
EXAMPLE_FOLDER = ROOT / "neps_examples"
TAB = " "


if not SRCDIR.exists():
raise FileNotFoundError(
f"{SRCDIR} does not exist, make sure you are running this from the root of the repository."
Expand Down
2 changes: 1 addition & 1 deletion docs/doc_yamls/architecture_search_space.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

from torch import nn
import neps
from neps.search_spaces.architecture import primitives as ops
Expand Down
2 changes: 2 additions & 0 deletions neps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from neps.api import run
from neps.plot.plot import plot
from neps.plot.tensorboard_eval import tblogger
from neps.search_spaces import (
ArchitectureParameter,
CategoricalParameter,
Expand Down Expand Up @@ -38,4 +39,5 @@
"GraphGrammar",
"GraphGrammarCell",
"GraphGrammarRepetitive",
"tblogger",
]
4 changes: 2 additions & 2 deletions neps/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""API for the neps package."""

from __future__ import annotations


import inspect
import logging
Expand Down Expand Up @@ -80,7 +80,7 @@ def run(
root_directory: The directory to save progress to. This is also used to
synchronize multiple calls to run(.) for parallelization.
run_args: An option for providing the optimization settings e.g.
max_evaluation_total in a YAML file.
max_evaluations_total in a YAML file.
overwrite_working_directory: If true, delete the working directory at the start of
the run. This is, e.g., useful when debugging a run_pipeline function.
post_run_summary: If True, creates a csv file after each worker is done,
Expand Down
3 changes: 2 additions & 1 deletion neps/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from __future__ import annotations

import os
from typing import Any, Callable, TypeVar
from collections.abc import Callable
from typing import Any, TypeVar

T = TypeVar("T")
V = TypeVar("V")
Expand Down
11 changes: 6 additions & 5 deletions neps/optimizers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from __future__ import annotations


from functools import partial
from typing import Callable, Mapping

from .base_optimizer import BaseOptimizer
from .bayesian_optimization.cost_cooling import CostCooling
from .bayesian_optimization.mf_tpe import MultiFidelityPriorWeightedTreeParzenEstimator
from .bayesian_optimization.optimizer import BayesianOptimization
from .grid_search.optimizer import GridSearch
from .multi_fidelity.dyhpo import MFEIBO
from .multi_fidelity.ifbo import IFBO
from .multi_fidelity.hyperband import (
MOBSTER,
AsynchronousHyperband,
Expand Down Expand Up @@ -41,9 +40,11 @@
"asha": AsynchronousSuccessiveHalving,
"hyperband": Hyperband,
"asha_prior": AsynchronousSuccessiveHalvingWithPriors,
"multifidelity_tpe": MultiFidelityPriorWeightedTreeParzenEstimator,
"hyperband_custom_default": HyperbandCustomDefault,
"priorband": PriorBand,
"priorband_bo": partial(PriorBand, model_based=True),
"priorband_asha": PriorBandAsha,
"priorband_asha_hyperband": PriorBandAshaHB,
"mobster": MOBSTER,
"mf_ei_bo": MFEIBO,
"ifbo": IFBO,
}
2 changes: 1 addition & 1 deletion neps/optimizers/base_optimizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations


import logging
from abc import abstractmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from __future__ import annotations


from functools import partial
from typing import Callable

from neps.optimizers.bayesian_optimization.acquisition_functions.ei import (
ComprehensiveExpectedImprovement,
)
from neps.optimizers.bayesian_optimization.acquisition_functions.mf_ei import MFEI
from neps.optimizers.bayesian_optimization.acquisition_functions.mf_pi import MFPI_Random
from neps.optimizers.bayesian_optimization.acquisition_functions.ucb import (
UpperConfidenceBound,
MF_UCB,
)
from neps.optimizers.bayesian_optimization.acquisition_functions.prior_weighted import (
DecayingPriorWeightedAcquisition,
Expand All @@ -28,33 +27,28 @@
augmented_ei=False,
log_ei=True,
),
# # Uses the augmented EI heuristic and changed the in-fill criterion to the best test location with
# # the highest *posterior mean*, which are preferred when the optimisation is noisy.
## Uses the augmented EI heuristic and changed the in-fill criterion to the best test location with
## the highest *posterior mean*, which are preferred when the optimisation is noisy.
"AEI": partial(
ComprehensiveExpectedImprovement,
in_fill="posterior",
augmented_ei=True,
),
"MFEI": partial(
MFEI,
in_fill="best",
augmented_ei=False,
"MFPI-random": partial(
MFPI_Random,
threshold="random",
horizon="random",
),
"UCB": partial(
UpperConfidenceBound,
maximize=False,
),
"MF-UCB": partial(
MF_UCB,
maximize=False,
),
}

__all__ = [
"AcquisitionMapping",
"ComprehensiveExpectedImprovement",
"MFEI",
"UpperConfidenceBound",
"MF_UCB",
"DecayingPriorWeightedAcquisition",
"MFPI_Random",
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
if TYPE_CHECKING:
from neps.search_spaces import SearchSpace


class ComprehensiveExpectedImprovement(BaseAcquisition):
def __init__(
self,
Expand Down
Loading