Skip to content

Commit

Permalink
Repo flattening + adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekAbouChakra committed Nov 30, 2023
1 parent eec1222 commit c48417a
Show file tree
Hide file tree
Showing 106 changed files with 30 additions and 51 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions src/neps/api.py → neps/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

import ConfigSpace as CS

import metahyper
from metahyper import instance_from_map

from .metahyper import instance_from_map, metahyper_run
from .optimizers import BaseOptimizer, SearcherMapping
from .plot.tensorboard_eval import tblogger
from .search_spaces.parameter import Parameter
Expand Down Expand Up @@ -258,7 +256,7 @@ def run(
"skipped. Accurate continuation of runs can no longer be guaranteed!"
)

metahyper.run(
metahyper_run(
run_pipeline,
searcher_instance,
searcher_info,
Expand Down
2 changes: 2 additions & 0 deletions neps/metahyper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .api import ConfigResult, Sampler, read, metahyper_run
from .utils import instance_from_map
File renamed without changes.
2 changes: 1 addition & 1 deletion src/metahyper/api.py → neps/metahyper/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def _evaluate_config(
return result, {"time_end": time.time()}


def run(
def metahyper_run(
evaluation_fn,
sampler: Sampler,
sampler_info: dict,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from copy import deepcopy
from typing import Any

import metahyper
from metahyper.api import ConfigResult
import neps.metahyper as metahyper

from ..metahyper.api import ConfigResult
from ..search_spaces.search_space import SearchSpace
from ..utils.common import get_rnd_state, set_rnd_state
from ..utils.result_utils import get_cost, get_learning_curve, get_loss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from typing import Any

from metahyper import ConfigResult, instance_from_map

from ...metahyper import ConfigResult, instance_from_map
from ...optimizers.bayesian_optimization.acquisition_functions.cost_cooling import (
CostCooler,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from metahyper import instance_from_map

from ....metahyper import instance_from_map
from ....search_spaces.architecture.core_graph_grammar import CoreGraphGrammar
from ....search_spaces.hyperparameters.categorical import CategoricalParameter
from ....search_spaces.hyperparameters.float import FloatParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from scipy.stats import spearmanr
from typing_extensions import Literal

from metahyper import ConfigResult, instance_from_map

from ...metahyper import ConfigResult, instance_from_map
from ...search_spaces import (
CategoricalParameter,
ConstantParameter,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from metahyper.utils import MissingDependencyError
from neps.metahyper.utils import MissingDependencyError

from .gp import ComprehensiveGP
from .gp_hierarchy import ComprehensiveGPHierarchy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

from typing_extensions import Literal

from metahyper import ConfigResult, instance_from_map

from ...metahyper import ConfigResult, instance_from_map
from ...search_spaces.hyperparameters.categorical import (
CATEGORICAL_CONFIDENCE_SCORES,
CategoricalParameter,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import random

from metahyper.api import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.search_space import SearchSpace
from ..base_optimizer import BaseOptimizer

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import numpy as np

from metahyper import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.search_space import FloatParameter, IntegerParameter, SearchSpace
from ..base_optimizer import BaseOptimizer
from ..bayesian_optimization.acquisition_functions.base_acquisition import BaseAcquisition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import numpy as np

from metahyper import ConfigResult, instance_from_map

from ...metahyper import ConfigResult, instance_from_map
from ...search_spaces.search_space import FloatParameter, IntegerParameter, SearchSpace
from ..base_optimizer import BaseOptimizer
from ..bayesian_optimization.acquisition_functions import AcquisitionMapping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import numpy as np
from typing_extensions import Literal

from metahyper import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.search_space import SearchSpace
from ..bayesian_optimization.acquisition_functions.base_acquisition import BaseAcquisition
from ..bayesian_optimization.acquisition_samplers.base_acq_sampler import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import pandas as pd
import torch

from metahyper import instance_from_map

from ...metahyper import instance_from_map
from ..bayesian_optimization.models import SurrogateModelMapping
from ..multi_fidelity.utils import normalize_vectorize_config
from ..multi_fidelity_prior.utils import calc_total_resources_spent, update_fidelity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import pandas as pd
import torch

from metahyper import instance_from_map

from ...metahyper import instance_from_map
from ...search_spaces.search_space import SearchSpace
from ..bayesian_optimization.acquisition_functions import AcquisitionMapping
from ..bayesian_optimization.acquisition_functions.base_acquisition import BaseAcquisition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import pandas as pd
from typing_extensions import Literal

from metahyper import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.hyperparameters.categorical import (
CATEGORICAL_CONFIDENCE_SCORES,
CategoricalParameter,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import numpy as np
from typing_extensions import Literal

from metahyper import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.search_space import SearchSpace
from ..bayesian_optimization.acquisition_functions.base_acquisition import BaseAcquisition
from ..bayesian_optimization.acquisition_samplers.base_acq_sampler import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import logging
from typing import Any

from metahyper.api import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.search_space import SearchSpace
from ...utils.data_loading import read_tasks_and_dev_stages_from_disk
from .. import BaseOptimizer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from metahyper.api import ConfigResult

from ...metahyper import ConfigResult
from ...search_spaces.search_space import SearchSpace
from ..base_optimizer import BaseOptimizer

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from torch.utils.tensorboard import SummaryWriter
from torch.utils.tensorboard.summary import hparams

from metahyper.api import ConfigInRun

from ..metahyper.api import ConfigInRun
from ..status.status import get_summary_dict
from ..utils.common import get_initial_directory

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions src/neps/status/status.py → neps/status/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

import pandas as pd

from metahyper import read
from metahyper._locker import Locker
from metahyper.api import ConfigResult

from ..metahyper import ConfigResult, read
from ..metahyper._locker import Locker
from ..search_spaces.search_space import SearchSpace
from ..utils.result_utils import get_loss

Expand Down
3 changes: 1 addition & 2 deletions src/neps/utils/common.py → neps/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import torch
import yaml

from metahyper.api import ConfigInRun

from ..metahyper.api import ConfigInRun
from ..optimizers.info import SearcherConfigs


Expand Down
9 changes: 4 additions & 5 deletions src/neps/utils/data_loading.py → neps/utils/data_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import numpy as np
import yaml

import metahyper.api

from ..metahyper import read
from .result_utils import get_loss


Expand Down Expand Up @@ -40,7 +39,7 @@ def read_tasks_and_dev_stages_from_disk(
continue
dev_id = get_id_from_path(dev_dir_path)
# TODO: Perhaps use 2nd and 3rd argument as well
result, _, _ = metahyper.api.read(dev_dir_path)
result, _, _ = read(dev_dir_path)
results[task_id][dev_id] = result
return results

Expand All @@ -65,7 +64,7 @@ def read_user_prior_results_from_disk(path: str):
continue
# get name of the directory
name = os.path.basename(prior_dir_path)
results[name], _, _ = metahyper.api.read(prior_dir_path)
results[name], _, _ = read(prior_dir_path)
return results


Expand Down Expand Up @@ -163,7 +162,7 @@ def summarize_results(
# TOOD: only use IDs if provided
final_results = results[final_task_id][final_dev_id]
else:
final_results, _, _ = metahyper.api.read(seed_dir_path)
final_results, _, _ = read(seed_dir_path)

# This part is copied from neps.status()
best_loss = float("inf")
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions src/metahyper/__init__.py

This file was deleted.

0 comments on commit c48417a

Please sign in to comment.