opto.features.priority_search.examples¶
SequentialUpdate ¶
              Bases: PrioritySearch
A basic algorithm that explores the parameter space and proposes new candidates one by one.
This is realized by setting
num_candidates = 1
num_proposals = 1
memory_size = 1
This is the same as MinibatchAlgorithm when 1. no validation set is provided 2. sub_batch_size is None or batch_size.
validate_proposals here acts the same as ensure_improvement flag in MinibatchAlgorithm
train ¶
train(
    guide,
    train_dataset,
    *,
    validate_dataset=None,
    validate_guide=None,
    batch_size=1,
    sub_batch_size=None,
    score_range=None,
    num_epochs=1,
    num_threads=None,
    verbose=False,
    test_dataset=None,
    test_frequency: Union[int, None] = 1,
    num_eval_samples: int = 1,
    log_frequency=None,
    save_frequency: Union[int, None] = None,
    save_path: str = "checkpoints/agent.pkl",
    num_candidates: int = 10,
    num_proposals: int = 1,
    default_score: float = float("inf"),
    validate_proposals: bool = True,
    memory_size: Optional[int] = None,
    **kwargs
)
SequentialSearch ¶
              Bases: PrioritySearch
A sequential search that generates one candidate in each iteration by validating multiple proposals.
This is realized by setting num_proposals = 1 memory_size = 1
This is the same as BasicSearchAlgorithm when 1. a validation set is provided 2. validate_proposals is True. 3. sub_batch_size is None or batch_size.
train ¶
train(
    guide,
    train_dataset,
    *,
    validate_dataset=None,
    validate_guide=None,
    batch_size=1,
    sub_batch_size=None,
    score_range=None,
    num_epochs=1,
    num_threads=None,
    verbose=False,
    test_dataset=None,
    test_frequency: Union[int, None] = 1,
    num_eval_samples: int = 1,
    log_frequency=None,
    save_frequency: Union[int, None] = None,
    save_path: str = "checkpoints/agent.pkl",
    num_candidates: int = 10,
    num_proposals: int = 1,
    default_score: float = float("inf"),
    validate_proposals: bool = True,
    memory_size: Optional[int] = None,
    **kwargs
)
BeamSearch ¶
              Bases: PrioritySearch
A beam search algorithm that explores the parameter space and proposes new candidates based on the best candidates in the priority queue.
This is realized by setting num_proposals = beam_size memory_size = beam_size
train ¶
train(
    guide,
    train_dataset,
    *,
    validate_dataset=None,
    validate_guide=None,
    batch_size=1,
    sub_batch_size=None,
    score_range=None,
    num_epochs=1,
    num_threads=None,
    verbose=False,
    test_dataset=None,
    test_frequency: Union[int, None] = 1,
    num_eval_samples: int = 1,
    log_frequency=None,
    save_frequency: Union[int, None] = None,
    save_path: str = "checkpoints/agent.pkl",
    num_candidates: int = 10,
    num_proposals: int = 1,
    default_score: float = float("inf"),
    validate_proposals: bool = True,
    memory_size: Optional[int] = None,
    **kwargs
)