Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3.0.1
ci:
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.17
uses: JRubics/poetry-publish@v2.0
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
9 changes: 3 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ repos:
- id: detect-private-key
- id: forbid-new-submodules
- id: check-docstring-first
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.15
rev: v0.3.4
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
rev: 'v1.9.0'
hooks:
- id: mypy
args: [--strict, --ignore-missing-imports, --allow-untyped-decorators, --allow-subclassing-any]
Expand Down
1 change: 1 addition & 0 deletions examples/blueprint_example/src/example_blueprint_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
executor class tailored for the NlBlueprint team and utility functions for pre-
submission setup and post-run cleanup.
"""

import os
import shutil
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions examples/blueprint_example/src/processing_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
the cost function defined in total_cost and writes it, together with the optimization
parameters to a csv file in a format that can be read by smart-stopos and use to
generate new sets of parameters."""

import os
import pickle
from argparse import ArgumentParser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
saved, how many runs per data point to simulate, the name of the saved file and whether
the simulation results should be plotted.
"""

import copy
import os
import pickle
Expand Down
1 change: 1 addition & 0 deletions examples/run_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
If the `main`-method takes an argument `no_output` this will be passed as `True`
to avoid creating plots etc.
"""

import importlib
import inspect
import os
Expand Down
1 change: 1 addition & 0 deletions examples/wobbly_function/analyse_function_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

csv_output.csv.
"""

import csv
import os
from argparse import ArgumentParser
Expand Down
1 change: 1 addition & 0 deletions examples/wobbly_function/example_wobbly_bayesian.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module demonstrates the process for a blackbox bayesian optimization using the
Yotse framework."""

from bayes_opt import UtilityFunction

from examples.wobbly_function.example_wobbly_main import remove_files_after_run
Expand Down
1 change: 1 addition & 0 deletions examples/wobbly_function/example_wobbly_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
It leverages genetic algorithms for the optimization process, handles file management,
and cleans up after execution, showcasing a very basic use-case.
"""

import os
import shutil
from typing import Any
Expand Down
7 changes: 4 additions & 3 deletions examples/wobbly_function/example_wobbly_param_switching.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module demonstrates the process for parameter switching during optimization
using the Yotse framework."""

from examples.wobbly_function.example_wobbly_main import remove_files_after_run
from examples.wobbly_function.example_wobbly_main import wobbly_pre
from yotse.execution import Executor
Expand Down Expand Up @@ -63,11 +64,11 @@ def main() -> None:
print("Solution after first GA: ", solution)

# Switching active params from param 1 & 2 to param 2 & 3
param_switch_example.experiment.parameters[0].parameter_active = False
param_switch_example.experiment.parameters[2].parameter_active = True
param_switch_example.experiment.set_parameter_activity("x", False)
param_switch_example.experiment.set_parameter_activity("z", True)
# create new datapoints with new active params and write them to experiment
param_switch_example.experiment.data_points = (
param_switch_example.experiment.create_datapoint_c_product()
param_switch_example.experiment.create_initial_active_param_cprod()
)
# todo: maybe nice additional functionality could be that this is done automatically when params have changed.

Expand Down
7 changes: 4 additions & 3 deletions examples/wobbly_function/example_wobbly_resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
It initializes the optimization process, runs for a few generations, and then showcases
how to resume the process from where it left off.
"""

from examples.wobbly_function.example_wobbly_main import remove_files_after_run
from examples.wobbly_function.example_wobbly_main import wobbly_pre
from yotse.execution import Executor
Expand All @@ -27,9 +28,9 @@ def main() -> None:

# write resume parameter to experiment
resume_experiment = wobbly_pre()
resume_experiment.system_setup.cmdline_arguments[
"--resume"
] = stop_resume_example.aux_dir
resume_experiment.system_setup.cmdline_arguments["--resume"] = (
stop_resume_example.aux_dir
)

resume_example = Executor(experiment=resume_experiment)
for i in range(
Expand Down
1 change: 1 addition & 0 deletions examples/wobbly_function/example_wobbly_whitebox.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module demonstrates the process for a whitebox optimization using the Yotse
framework."""

import random
from typing import Any

Expand Down
1 change: 1 addition & 0 deletions examples/wobbly_function/wobbly_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Usage:
python3 function.py -filebasename <folder-to-store-output>/<somefilebasename> -x 3 -y 5.5
"""

import csv
from argparse import ArgumentParser
from typing import Any
Expand Down
Loading