feijoa.search.oracles.meta package#
Submodules#
feijoa.search.oracles.meta.bandit module#
- class feijoa.search.oracles.meta.bandit.ThompsonSampler(*algorithms, algo_select_count=3)#
Bases:
feijoa.search.oracles.meta.bandit.UCB1- STRATEGY#
alias of
mab.algs.ThompsomSampling
- add_oracle(oracle)#
Append oracle to oracles list.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- aliases: Tuple = ('ThompsonSampler', 'thompson', 'th')#
- anchor = 'ThompsonSampler'#
- ask(n=1)#
Get configurations from oracle.
- Parameters
n (int, optional) – Preferred count of configurations.
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
Note
Parameter n may not affect on configuration’s count.
- Returns
List of configurations, or None if configurations are over.
- Raises
AnyError – If anything bad happens.
- Parameters
n (int) –
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
- attach(observer)#
Attach an observer to the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- detach(observer)#
Detach an observer from the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- property name#
Name of oracle.
- notify(event, *args, **kwargs)#
Notify all observers about an event.
- property order#
Get order for oracles.
- Raises
AnyError – If anything bad happens.
- remove_oracle(oracle)#
Remove oracle from inner oracles pool in meta-oracle.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- tell(config, result)#
Tell results to all search oracles.
An adaptive strategy is used with increasing reward upon convergence.
- Raises:
AnyError: If anything bad happens.
- update(event, subject, *args, **kwargs)#
Receive update from subject.
- Args:
- event:
Type of event.
- subject:
Subject of notification.
- Returns:
None
- Raises:
AnyError: If anything bad happens.
- class feijoa.search.oracles.meta.bandit.UCB1(*algorithms, algo_select_count=3)#
Bases:
feijoa.search.oracles.meta.meta.MetaOracleUCB1 bandit oracle.
Used for the optimal choice of optimization strategy
- Parameters
algorithms – List of oracles.
algo_select_count (int) – Count of oracles to yield (with ranking).
- Raises
AnyError – If anything bad happens.
- STRATEGY#
alias of
mab.algs.UCB1
- add_oracle(oracle)#
Append oracle to oracles list.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- aliases: Tuple = ('UCB1', 'ucb1', 'ucb')#
- anchor = 'UCB1'#
- ask(n=1)#
Get configurations from oracle.
- Parameters
n (int, optional) – Preferred count of configurations.
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
Note
Parameter n may not affect on configuration’s count.
- Returns
List of configurations, or None if configurations are over.
- Raises
AnyError – If anything bad happens.
- Parameters
n (int) –
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
- attach(observer)#
Attach an observer to the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- detach(observer)#
Detach an observer from the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- property name#
Name of oracle.
- notify(event, *args, **kwargs)#
Notify all observers about an event.
- property order#
Get order for oracles.
- Raises
AnyError – If anything bad happens.
- remove_oracle(oracle)#
Remove oracle from inner oracles pool in meta-oracle.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- tell(config, result)#
Tell results to all search oracles.
An adaptive strategy is used with increasing reward upon convergence.
- Raises:
AnyError: If anything bad happens.
- update(event, subject, *args, **kwargs)#
Receive update from subject.
- Args:
- event:
Type of event.
- subject:
Subject of notification.
- Returns:
None
- Raises:
AnyError: If anything bad happens.
- class feijoa.search.oracles.meta.bandit.UCBTuned(*algorithms, algo_select_count=3)#
Bases:
feijoa.search.oracles.meta.bandit.UCB1- STRATEGY#
alias of
mab.algs.UCBTuned
- add_oracle(oracle)#
Append oracle to oracles list.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- aliases: Tuple = ('UCBTuned', 'ucbtuned')#
- anchor = 'UCBTuned'#
- ask(n=1)#
Get configurations from oracle.
- Parameters
n (int, optional) – Preferred count of configurations.
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
Note
Parameter n may not affect on configuration’s count.
- Returns
List of configurations, or None if configurations are over.
- Raises
AnyError – If anything bad happens.
- Parameters
n (int) –
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
- attach(observer)#
Attach an observer to the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- detach(observer)#
Detach an observer from the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- property name#
Name of oracle.
- notify(event, *args, **kwargs)#
Notify all observers about an event.
- oracles_select_count: int#
- property order#
Get order for oracles.
- Raises
AnyError – If anything bad happens.
- remove_oracle(oracle)#
Remove oracle from inner oracles pool in meta-oracle.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- tell(config, result)#
Tell results to all search oracles.
An adaptive strategy is used with increasing reward upon convergence.
- Raises:
AnyError: If anything bad happens.
- update(event, subject, *args, **kwargs)#
Receive update from subject.
- Args:
- event:
Type of event.
- subject:
Subject of notification.
- Returns:
None
- Raises:
AnyError: If anything bad happens.
- feijoa.search.oracles.meta.bandit.relative_change_d1(x_cur, x_prev)#
Return the relative difference between two points.
- Parameters
x_cur (float) – Current value.
x_prev (float) – Previous value.
- Raises
AnyError – If anything bad happens.
feijoa.search.oracles.meta.meta module#
Meta oracle base class module.
- class feijoa.search.oracles.meta.meta.MetaOracle(*oracles, **kwargs)#
Bases:
feijoa.search.oracles.oracle.OracleMeta-search oracle.
Used for pick up oracles.
- Raises
AnyError – If anything bad happens.
- add_oracle(oracle)#
Append oracle to oracles list.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- abstract property aliases#
Synonyms for oracle name.
- abstract property anchor#
Name used for dynamic oracle detection.
- ask(n=1)#
Get configurations from oracle.
- Parameters
n (int, optional) – Preferred count of configurations.
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
Note
Parameter n may not affect on configuration’s count.
- Returns
List of configurations, or None if configurations are over.
- Raises
AnyError – If anything bad happens.
- Parameters
n (int) –
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
- attach(observer)#
Attach an observer to the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- detach(observer)#
Detach an observer from the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- property name#
Name of oracle.
- notify(event, *args, **kwargs)#
Notify all observers about an event.
- abstract property order#
Get order for oracles.
- abstract remove_oracle(oracle)#
Remove oracle from inner oracles pool in meta-oracle.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- tell(config, result)#
Tell results to all search oracles
- update(event, subject, *args, **kwargs)#
Receive update from subject.
- Args:
- event:
Type of event.
- subject:
Subject of notification.
- Returns:
None
- Raises:
AnyError: If anything bad happens.
feijoa.search.oracles.meta.roundrobin module#
Round robin meta oracle module.
- class feijoa.search.oracles.meta.roundrobin.RoundRobinMeta(*algorithms)#
Bases:
feijoa.search.oracles.meta.meta.MetaOracleRoundRobin meta oracle.
- Raises
AnyError – If anything bad happens.
- add_oracle(oracle)#
Append oracle to oracles list.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- aliases = ('roundrobin',)#
- anchor = 'roundrobin'#
- ask(n=1)#
Get configurations from oracle.
- Parameters
n (int, optional) – Preferred count of configurations.
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
Note
Parameter n may not affect on configuration’s count.
- Returns
List of configurations, or None if configurations are over.
- Raises
AnyError – If anything bad happens.
- Parameters
n (int) –
- Return type
Optional[List[feijoa.models.configuration.Configuration]]
- attach(observer)#
Attach an observer to the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- detach(observer)#
Detach an observer from the subject.
- Parameters
observer (feijoa.utils.mixins.Observer) –
- Return type
None
- property name#
Name of oracle.
- notify(event, *args, **kwargs)#
Notify all observers about an event.
- property order#
Get order for oracles.
- remove_oracle(oracle)#
Remove oracle from inner oracles pool in meta-oracle.
- Parameters
oracle (Oracle) – search oracle instance.
- Returns
None
- Raises
AnyError – If anything bad happens.
- tell(config, result)#
Tell results to all search oracles
- update(event, subject, *args, **kwargs)#
Receive update from subject.
- Args:
- event:
Type of event.
- subject:
Subject of notification.
- Returns:
None
- Raises:
AnyError: If anything bad happens.