Skip to content

Docs/formatting parameters and maths#1291

Closed
sagar1sharma wants to merge 720 commits intomainfrom
docs/formatting_parameters_and_maths
Closed

Docs/formatting parameters and maths#1291
sagar1sharma wants to merge 720 commits intomainfrom
docs/formatting_parameters_and_maths

Conversation

@sagar1sharma
Copy link
Copy Markdown
Collaborator

Thanks for contributing a pull request! Please ensure you have taken a look at the contribution guidelines: https://github.com/automl/SMAC3/blob/main/CONTRIBUTING.md

Reference Issues/PRs

Example: Fixes #1234. See also #3456.
Please use keywords (e.g., Fixes) to create link to the issues or pull requests you resolved, so that they will automatically be closed when your pull request is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests

Description, Motivation and Context

Provide a short description of your changes.

Changes

Explain your changes in detail here.

Type Of Changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

What is Missing?

Please provide any further information that is needed to close this PR.
This could be another PR that is blocking this PR, or any further changes
that need to be addressed in the future.

Checklist

Go over all the following points, and put an x in all the boxes that apply.
Should there be a good argument to differ, please provide a reasoned explanation.

  • My change is based on the latest stage of the develop branch.
  • My change required a change of the documentation, which has been done.
  • I checked that the documentation can be build, visualizes everything as expected, and does not contain any warnings.
  • I have added/adapted tests to cover my changes.
  • The tests can be executed successfully.
  • I have added a description of the changes to CHANGELOG.rst.

Any other comments?

We appreciate your effort, but please be aware that we are not working full-time on this project. We welcome any contribution and value your effort, no matter how minor they are. If we are slow to review, either the pull request needs some benchmarking, tinkering, convincing, etc. or more likely the reviewers are simply busy. In either case, we ask for your understanding during the review process.

Thanks for contributing!

renesass and others added 30 commits December 30, 2022 12:05
This PR fixes a bug in which integer hyperparameters would not
be created correctly in the initial design. This went
unnoticed, except in the case where it was part of a condition
and the function deactivate_inactive_hyperparameters was
called.

This PR fixes this bug by mapping the random float that was
sampled by, for example and LHD or Sobol sequence, to the
float representation of an integer by calling _transform and
_inverse_transform of the integer hyperparameter.
Fix 531 correctly create integers in initial design
Co-authored-by: René Sass <mail@renesass.de>
Co-authored-by: René Sass <mail@renesass.de>
lhennig0103 and others added 25 commits November 13, 2025 17:07
Implement RunHistoryPercentileEncoder for response value transformation.
* Added ecosystem information in documentation

* Changed formatting from bullet points to sentences

* Update index.md

---------

Co-authored-by: sagar1sharma <sagarsharma.ss329.ss46@gmail.com>
Co-authored-by: C. Benjamins <75323339+benjamc@users.noreply.github.com>
* Play With paralelisation

* Update Parallelism Doc

* Update paralelisation example

* Update docs

* Update parallelism docs

* Update parallelism

* Adapt Changelog.md

---------

Co-authored-by: Lukas Fehring <l.fehring@ai.uni-hannover.de>
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…apts-sampling

1184 prioracquisitionfunction adapts sampling
Removed debug print statements and added warnings for non-positive values.
Removed comments that ensure minimal value and cutoff limits.
Fix formatting and indentation in docstring.
Copilot AI review requested due to automatic review settings February 10, 2026 00:55
@sagar1sharma sagar1sharma deleted the docs/formatting_parameters_and_maths branch February 10, 2026 01:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR substantially expands SMAC3’s functionality and documentation, including enabling math rendering in MkDocs, adding adaptive capping support (with cutoff propagation to target functions), and switching the default RandomForest surrogate from pyrfr to a scikit-learn based implementation (while keeping an opt-in pyrfr path).

Changes:

  • Enable MathJax + arithmatex in MkDocs and update math formatting in acquisition-function docs.
  • Add adaptive capping plumbing: scenario flags, cutoff computation in intensifier, and cutoff forwarding through runners/facade signature handling.
  • Replace the default RF surrogate backend with scikit-learn, add optional pyrfr RF implementation and related installation/docs updates.

Reviewed changes

Copilot reviewed 71 out of 73 changed files in this pull request and generated 29 comments.

Show a summary per file
File Description
tests/test_utils/test_configspace.py Adds test for creating a uniform-transformed ConfigSpace copy.
tests/test_multi_objective/test_combined_function.py Expands mean-aggregation test to loop over objective weights.
tests/test_model/test_rf.py Adds correctness checks and new log_y-related RF test.
tests/test_main/test_smbo.py Formatting + adds SMBO reset test.
tests/test_main/test_config_selector.py Adds test for exhausted configuration space exception.
tests/test_intensifier/test_intensifier.py Minor formatting and import changes.
tests/test_intensifier/test_hyperband_utils.py Updates expected budgets/trials + adds __main__ block.
tests/test_intensifier/test_adaptive_capping_intensifier.py Adds adaptive capping behavior test with logging mock.
tests/fixtures/config_selector.py Updates fixture to renamed max_new_config_tries parameter.
smac/utils/configspace.py Updates continuous design transform + adds create_uniform_configspace_copy.
smac/scenario.py Expands deterministic docs + adds adaptive capping + runtime cutoff params and validation.
smac/runner/target_function_script_runner.py Adds additional_info plumbing and cutoff forwarding.
smac/runner/target_function_runner.py Adds additional_info plumbing and cutoff forwarding.
smac/runner/dask_runner.py Forwards additional_info into the single-worker runner.
smac/runner/abstract_runner.py Passes TrialInfo.additional_info into runner calls.
smac/runhistory/runhistory.py Adds n_objectives to support RUNNING trial costs for multi-objective.
smac/runhistory/encoder/power_transform_encoder.py Adds Yeo–Johnson power transform encoder.
smac/runhistory/encoder/percentile_encoder.py Adds percentile-based encoder (currently prints debug output).
smac/runhistory/encoder/gaussian_copula_encoder.py Adds Gaussian-copula style encoder.
smac/runhistory/encoder/abstract_encoder.py Adjusts warning string formatting.
smac/runhistory/dataclasses.py Adds additional_info field to TrialInfo.
smac/multi_objective/parego.py Updates ParEGO reference URL.
smac/model/random_forest/random_forest.py Replaces pyrfr-based RF with scikit-learn-based RF implementation.
smac/model/random_forest/pyrfr/random_forest_pyrfr.py Introduces optional pyrfr RF implementation in separate module.
smac/model/random_forest/pyrfr/init.py Package init for pyrfr backend.
smac/main/smbo.py Allows runner=None for ask/tell; changes validate to use submit/iter_results; adds reset behavior.
smac/main/exceptions.py Adds ConfigurationSpaceExhaustedException.
smac/main/config_selector.py Renames retries param + adds fallback random sampling and exhaustion exception.
smac/intensifier/successive_halving.py Adds uses_cutoffs property + updates warning text.
smac/intensifier/intensifier.py Adds uses_cutoffs + adaptive capping cutoff computation and propagation.
smac/intensifier/hyperband_utils.py Fixes total budget computation to budget*configs.
smac/intensifier/abstract_intensifier.py Adds uses_cutoffs abstract property + dominance/rejection logic enhancements.
smac/initial_design/random_design.py Samples initial configs from uniformized ConfigSpace copy.
smac/initial_design/abstract_initial_design.py Adjusts n_configs scaling logic for n_configs<=1.
smac/facade/old/multi_fidelity_facade_pyrfr.py Adds legacy facade for pyrfr RF in multi-fidelity.
smac/facade/old/hyperparameter_optimization_facade_pyrfr.py Adds legacy facade for pyrfr RF in HPO.
smac/facade/old/init.py Exposes legacy pyrfr facades via smac.facade.old.
smac/facade/algorithm_configuration_facade.py Formatting-only change.
smac/facade/abstract_facade.py Makes target_function optional; threads cutoff requirement into signature args; runner meta handles None.
smac/acquisition/maximizer/local_search.py Changes init-point de-duplication to use a set (order impact).
smac/acquisition/function/thompson.py Updates math markup formatting.
smac/acquisition/function/probability_improvement.py Updates math markup formatting.
smac/acquisition/function/expected_improvement.py Updates math markup formatting.
smac/acquisition/function/confidence_bound.py Refactors confidence bound into abstract base + LCB/UCB; updates docs.
setup.py Moves pyrfr to extras; bumps scikit-learn minimum version.
mkdocs.yaml Enables MathJax + arithmatex; switches docstring style to numpy; updates nav.
examples/2_multi_fidelity/1_mlp_epochs.py Updates link formatting.
examples/1_basics/9_additional_arguments.py New example for passing additional arguments to target functions.
examples/1_basics/8_warmstart.py Updates usage text and argument naming.
examples/1_basics/8_adaptive_capping.py New adaptive capping example.
examples/1_basics/7_parallelization_cluster.py Refactors and updates cluster parallelization example.
examples/1_basics/6_priors.py Fixes configspace reference for prior example.
examples/1_basics/3_ask_and_tell.py Updates ask/tell guidance and target_function argument naming.
examples/1_basics/2_svm_cv.py Updates config dict extraction logic.
docs/index.md Adds ecosystem section + expands feature list.
docs/advanced_usage/9_parallelism.md Expands and restructures parallelism documentation.
docs/advanced_usage/5_ask_and_tell.md Adds note about ask/tell-only usage (terminology issue).
docs/advanced_usage/2_multi_fidelity.md Fixes link to examples.
docs/advanced_usage/1_components.md Adds warning about initial-design distributions being ignored + links.
docs/advanced_usage/13_adaptive_capping.md New adaptive capping documentation page.
docs/advanced_usage/11_reproducibility.md Adds reset-related warning.
docs/3_getting_started.md Adds deterministic behavior info + SMBO section (includes a runhistory usage mistake).
docs/1_installation.md Updates Python requirement + adds pyrfr optional installation instructions.
README.md Updates install guidance + adds pyrfr optional section.
CHANGELOG.md Adds 2.4.0 entry and additional 2.3.1 notes.
.gitignore Adds SMAC/Dask log paths and extra artifacts.
.github/workflows/recent_reminder.yml Bumps action-send-mail version.
.github/workflows/pytest.yml Updates python matrix and GitHub actions versions.
.github/workflows/pre-commit.yml Updates actions versions.
.github/workflows/pre-commit-update.yml Updates actions versions.
.github/workflows/docs.yml Updates actions versions.
.github/workflows/dist.yml Updates actions versions.
.github/workflows/citation.yml Updates checkout action version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +398 to +407
super().__init__(
DecisionTreeRegressor(),
n_estimators,
estimator_params=(
"criterion",
"max_depth",
"min_samples_split",
"min_samples_leaf",
"min_weight_fraction_leaf",
"max_features",
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EPMRandomForest accepts a splitter argument but it is not included in estimator_params, so the underlying DecisionTreeRegressor instances will keep their default splitter (typically "best") regardless of the provided value. Add "splitter" to estimator_params (and ensure it is forwarded) so the parameter actually takes effect.

Copilot uses AI. Check for mistakes.
Comment on lines +472 to +478
if self.log_y:
for tree, samples_idx in zip(self.estimators_, self.estimators_samples_):
curX = X[samples_idx]
curY = y[samples_idx]
preds = tree.apply(curX)
for k in np.unique(preds):
tree.tree_.value[k, 0, 0] = np.log(np.exp(curY[preds == k]).mean())
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fit() assumes self.estimators_samples_ is available when log_y is True. This attribute is not guaranteed to exist (e.g., when bootstrap=False), which would raise at runtime. Guard this logic (or enforce bootstrap) and ensure leaf-value adjustment works for non-bootstrap training too.

Copilot uses AI. Check for mistakes.
Comment on lines +167 to +169
if "cutoff" in self._required_arguments and additional_info is not None:
kwargs["cutoff"] = additional_info["cutoff"]

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing additional_info["cutoff"] can raise KeyError when additional_info is provided but does not contain a cutoff entry. Consider checking for the key (or using .get) and raising a clearer error if it is required.

Copilot uses AI. Check for mistakes.
into the intensification process.

Notice: if you are exclusively using the ask-and-tell interface and do not use `smac.optimize()`, then smac no longer
is responsible for the evaluation of the trials and therefore the Facade no longer will require a specified `target_algorithm` argument.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say the facade does not require a target_algorithm argument, but the constructor parameter is named target_function (and that's what users pass throughout the docs/examples). Please rename to target_function here to avoid confusion.

Suggested change
is responsible for the evaluation of the trials and therefore the Facade no longer will require a specified `target_algorithm` argument.
is responsible for the evaluation of the trials and therefore the Facade no longer will require a specified `target_function` argument.

Copilot uses AI. Check for mistakes.
Comment on lines +613 to 615
self._runner.submit_trial(trial_info=trial)
costs = [trial_value.cost for _, trial_value in self._runner.iter_results()]
np_costs = np.array(costs)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate() submits trials and immediately drains iter_results() without waiting for completion. For asynchronous runners (e.g. Dask), this can return an empty/partial costs list and yield nan or incorrect averages. Consider waiting until all submitted validation trials are finished (e.g. loop on is_running()/wait() or track expected trial count) before computing the mean, and ensure only the validation results are aggregated.

Copilot uses AI. Check for mistakes.

import warnings

from ConfigSpace import Categorical, Configuration, ConfigurationSpace, Float
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Categorical' is not used.

Suggested change
from ConfigSpace import Categorical, Configuration, ConfigurationSpace, Float
from ConfigSpace import Configuration, ConfigurationSpace, Float

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,150 @@
import logging
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'logging' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,150 @@
import logging
import shutil
from logging import Logger
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'Logger' is not used.

Copilot uses AI. Check for mistakes.
from smac.initial_design.random_design import RandomInitialDesign
from smac.intensifier.intensifier import Intensifier
from smac.main.config_selector import ConfigSelector
from smac.runhistory import TrialInfo, TrialKey, TrialValue
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'TrialInfo' is not used.
Import of 'TrialKey' is not used.
Import of 'TrialValue' is not used.

Copilot uses AI. Check for mistakes.
# start smac run
try:
smac.optimize()
except ConfigurationSpaceExhaustedException:
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'except' clause does nothing but pass and there is no explanatory comment.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.