mirror of
https://github.com/c-sooyoung/bo-ptycho.git
synced 2026-09-17 16:09:09 +09:00
renamed bo to samplers
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
from .base import BOEngine
|
||||
from .random import RandomBOEngine
|
||||
from .sobo import SingleObjectiveBOEngine
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
import traceback
|
||||
import multiprocessing as mp
|
||||
|
||||
import bo
|
||||
import samplers
|
||||
import ptycho
|
||||
|
||||
def run_ptycho_worker(worker_id, gpu_token, job_config, metric, run_id, result_queue):
|
||||
@@ -71,7 +71,7 @@ def sobo_pipeline(config):
|
||||
|
||||
|
||||
############################ RANDOM SAMPLING ###############################
|
||||
randombo = bo.RandomBOEngine(config)
|
||||
randombo = samplers.RandomSampler(config)
|
||||
|
||||
for j in range(RANDOM_ITERS):
|
||||
print(f"RANDOM sampling; iteration {j}")
|
||||
@@ -81,7 +81,7 @@ def sobo_pipeline(config):
|
||||
randombo.tell(job_config, y_value)
|
||||
|
||||
############################ SOBO SAMPLING ###############################
|
||||
sobo = bo.SingleObjectiveBOEngine(config)
|
||||
sobo = samplers.SOBOSampler(config)
|
||||
sobo.train_x = randombo.train_x
|
||||
sobo.train_y = randombo.train_y
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
from .base import Sampler
|
||||
from .random import RandomSampler
|
||||
from .sobo import SOBOSampler
|
||||
|
||||
samplers = {
|
||||
'sobo': SOBOSampler,
|
||||
'random': RandomSampler,
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import numpy as np
|
||||
|
||||
|
||||
class BOEngine(ABC):
|
||||
class Sampler(ABC):
|
||||
def __init__(self, config):
|
||||
self.config = config
|
||||
self.params = [key for key, spec in config["bo"]["params"].items() if spec is not None]
|
||||
@@ -1,9 +1,9 @@
|
||||
import copy
|
||||
import numpy as np
|
||||
from bo.base import BOEngine
|
||||
from samplers.base import Sampler
|
||||
|
||||
|
||||
class RandomBOEngine(BOEngine):
|
||||
class RandomSampler(Sampler):
|
||||
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
@@ -15,10 +15,10 @@ from botorch.sampling.normal import SobolQMCNormalSampler
|
||||
from botorch.utils.rounding import approximate_round
|
||||
|
||||
|
||||
from bo.base import BOEngine
|
||||
from samplers.base import Sampler
|
||||
|
||||
|
||||
class SingleObjectiveBOEngine(BOEngine):
|
||||
class SOBOSampler(Sampler):
|
||||
def __init__(self, config):
|
||||
super().__init__(config)
|
||||
self.acquisition = config['bo']['acquisition']
|
||||
Reference in New Issue
Block a user