Skip to content

Commit

Permalink
Remove doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
gen740 committed Mar 11, 2024
1 parent 44c1a20 commit 3930c89
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 121 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/sphinx-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,3 @@ jobs:
name: built-html
path: |
docs/build/html
doctest:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Install Dependencies
run: |
python -m pip install -U pip
pip install --progress-bar off -U .[document]
- name: Output installed packages
run: |
pip freeze --all
- name: Output dependency tree
run: |
pip install pipdeptree
pipdeptree
- name: Run Doctest
run: |
cd docs
make doctest
16 changes: 0 additions & 16 deletions optuna_integration/cma/cma.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,6 @@ class PyCmaSampler(BaseSampler):
Optimize a simple quadratic function by using :class:`~optuna_integration.PyCmaSampler`.
.. testcode::
import optuna
import optuna_integration
def objective(trial):
x = trial.suggest_float("x", -1, 1)
y = trial.suggest_int("y", -1, 1)
return x**2 + y
sampler = optuna_integration.PyCmaSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=20)
Note that parallel execution of trials may affect the optimization performance of CMA-ES,
especially if the number of trials running in parallel exceeds the population size.
Expand Down
57 changes: 0 additions & 57 deletions optuna_integration/mlflow/mlflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,6 @@ class MLflowCallback:
Add MLflow callback to Optuna optimization.
.. testsetup::
import pathlib
import tempfile
tempdir = tempfile.mkdtemp()
YOUR_TRACKING_URI = pathlib.Path(tempdir).as_uri()
.. testcode::
import optuna
from optuna_integration.mlflow import MLflowCallback
def objective(trial):
x = trial.suggest_float("x", -10, 10)
return (x - 2) ** 2
mlflc = MLflowCallback(
tracking_uri=YOUR_TRACKING_URI,
metric_name="my metric score",
)
study = optuna.create_study(study_name="my_study")
study.optimize(objective, n_trials=10, callbacks=[mlflc])
.. testcleanup::
import shutil
shutil.rmtree(tempdir)
Args:
tracking_uri:
The URI of the MLflow tracking server.
Expand Down Expand Up @@ -172,30 +139,6 @@ def track_in_mlflow(self) -> Callable:
Add additional logging to MLflow.
.. testcode::
import optuna
import mlflow
from optuna_integration.mlflow import MLflowCallback
mlflc = MLflowCallback(
tracking_uri=YOUR_TRACKING_URI,
metric_name="my metric score",
)
@mlflc.track_in_mlflow()
def objective(trial):
x = trial.suggest_float("x", -10, 10)
mlflow.log_param("power", 2)
mlflow.log_metric("base of metric", x - 2)
return (x - 2) ** 2
study = optuna.create_study(study_name="my_other_study")
study.optimize(objective, n_trials=10, callbacks=[mlflc])
Returns:
Objective function with tracking to MLflow enabled.
"""
Expand Down
17 changes: 0 additions & 17 deletions optuna_integration/sklearn/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,23 +517,6 @@ class OptunaSearchCV(BaseEstimator):
Examples:
.. testcode::
import optuna
import optuna_integration
from sklearn.datasets import load_iris
from sklearn.svm import SVC
clf = SVC(gamma="auto")
param_distributions = {
"C": optuna.distributions.FloatDistribution(1e-10, 1e10, log=True)
}
optuna_search = optuna_integration.OptunaSearchCV(clf, param_distributions)
X, y = load_iris(return_X_y=True)
optuna_search.fit(X, y)
y_pred = optuna_search.predict(X)
.. note::
By following the scikit-learn convention for scorers, the direction of optimization is
``maximize``. See https://scikit-learn.org/stable/modules/model_evaluation.html.
Expand Down

0 comments on commit 3930c89

Please sign in to comment.