Skip to content

Commit

Permalink
Directly import built-in features
Browse files Browse the repository at this point in the history
  • Loading branch information
HideakiImamura committed May 28, 2024
1 parent dd2e865 commit f2282f3
Show file tree
Hide file tree
Showing 47 changed files with 48 additions and 150 deletions.
4 changes: 2 additions & 2 deletions package/samplers/botorch_sampler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pip install optuna-integration botorch

## Example
```python
module = optunahub.load_module("samplers/botorch_sampler")
sampler = module.BoTorchSampler()
from optuna_integration import BoTorchSampler
sampler = BoTorchSampler()
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/botorch_sampler/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/brute_force/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import BruteForceSampler


def objective(trial):
x = trial.suggest_float("x", -5, 5)
return x**2


mod = optunahub.load_module("samplers/brute_force")
sampler = mod.BruteForceSampler()
sampler = BruteForceSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/brute_force/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/cmaes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install cmaes
## Example
```python
import optuna
import optunahub
from optuna.samplers import CmaEsSampler


def objective(trial):
Expand All @@ -27,8 +27,7 @@ def objective(trial):
return x**2 + y


mod = optunahub.load_module("samplers/cmaes")
sampler = mod.CmaEsSampler()
sampler = CmaEsSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=20)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/cmaes/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/gp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@ pip install scipy pytorch
## Example
```python
import optuna
import optunahub
from optuna.samplers import GPSampler


def objective(trial):
x = trial.suggest_float("x", -5, 5)
return x**2


mod = optunahub.load_module("samplers/gp")
sampler = mod.GPSampler()
sampler = GPSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=100)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/gp/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/grid_search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import GridSampler


def objective(trial):
Expand All @@ -23,8 +23,7 @@ def objective(trial):


search_space = {"x": [-50, 0, 50], "y": [-99, 0, 99]}
mod = optunahub.load_module("samplers/grid_search")
sampler = mod.GridSampler(search_space)
sampler = GridSampler(search_space)
study = optuna.create_study(sampler=sampler)
study.optimize(objective)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/grid_search/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/nsgaii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import NSGAIISampler


def objective(trial):
x = trial.suggest_float("x", -5, 5)
return x**2


mod = optunahub.load_module("samplers/nsgaii")
sampler = mod.NSGAIISampler()
sampler = NSGAIISampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/nsgaii/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/nsgaiii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import NSGAIIISampler


def objective(trial):
x = trial.suggest_float("x", -5, 5)
return x**2


mod = optunahub.load_module("samplers/nsgaiii")
sampler = mod.NSGAIIISampler()
sampler = NSGAIIISampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/nsgaiii/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/partial_fixed/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import PartialFixedSampler


def objective(trial):
Expand All @@ -24,8 +24,7 @@ def objective(trial):

tpe_sampler = optuna.samplers.TPESampler()
fixed_params = {"y": 0}
mod = optunahub.load_module("samplers/partial_fixed")
partial_sampler = mod.PartialFixedSampler(fixed_params, tpe_sampler)
partial_sampler = PartialFixedSampler(fixed_params, tpe_sampler)

study = optuna.create_study(sampler=partial_sampler)
study.optimize(objective, n_trials=10)
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/partial_fixed/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/samplers/pycma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pip install optuna-integration cma

## Example
```python
module = optunahub.load_module("samplers/pycma")
sampler = module.PyCmaSampler()
from optuna_integration import PyCmaSampler
sampler = PyCmaSampler()
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/pycma/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/qmc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import QMCSampler


def objective(trial):
x = trial.suggest_float("x", -5, 5)
return x**2


mod = optunahub.load_module("samplers/qmc")
sampler = mod.QMCSampler()
sampler = QMCSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/qmc/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/random_search/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import RandomSampler


def objective(trial):
x = trial.suggest_float("x", -5, 5)
return x**2


mod = optunahub.load_module("samplers/random_search")
sampler = mod.RandomSampler()
sampler = RandomSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)
```
Expand Down
4 changes: 0 additions & 4 deletions package/samplers/random_search/__init__.py

This file was deleted.

5 changes: 2 additions & 3 deletions package/samplers/tpe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ license: 'MIT License'
## Example
```python
import optuna
import optunahub
from optuna.samplers import TPESampler


def objective(trial):
x = trial.suggest_float("x", -10, 10)
return x**2


mod = optunahub.load_module("samplers/tpe")
sampler = mod.TPESampler()
sampler = TPESampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=10)
```
Expand Down
4 changes: 2 additions & 2 deletions package/visualization/plot_contour/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_contour")
mod.plot_contour(study)
from optuna.visualization import plot_contour
plot_contour(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_contour/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_edf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_edf")
mod.plot_edf(study)
from optuna.visualization import plot_edf
plot_edf(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_edf/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_hypervolume_history/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_hypervolume_history")
mod.plot_hypervolume_history(study, reference_point)
from optuna.visualization import plot_hypervolume_history
plot_hypervolume_history(study, reference_point)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_hypervolume_history/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_intermediate_values/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_intermediate_values")
mod.plot_intermediate_values(study)
from optuna.visualization import plot_intermediate_values
plot_intermediate_values(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_intermediate_values/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_optimization_history/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_optimization_history")
mod.plot_optimization_history(study)
from optuna.visualization import plot_optimization_history
plot_optimization_history(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_optimization_history/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_parallel_coordinate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_parallel_coordinate")
mod.plot_parallel_coordinate(study)
from optuna.visualization import plot_parallel_coordinate
plot_parallel_coordinate(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_parallel_coordinate/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_param_importances/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_param_importances")
mod.plot_param_importances(study)
from optuna.visualization import plot_param_importances
plot_param_importances(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_param_importances/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions package/visualization/plot_pareto_front/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license: 'MIT License'

## Example
```python
mod = optunahub.load_module("visualization/plot_pareto_front")
mod.plot_pareto_front(study)
from optuna.visualization import plot_pareto_front
plot_pareto_front(study)
```

## Others
Expand Down
4 changes: 0 additions & 4 deletions package/visualization/plot_pareto_front/__init__.py

This file was deleted.

Loading

0 comments on commit f2282f3

Please sign in to comment.