Skip to content

No-op code & docs cleanups #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: devel
Choose a base branch
from

Conversation

alyst
Copy link
Contributor

@alyst alyst commented Feb 4, 2025

These are rather trivial commits cherry-picked from #193 that don't change anything essential, but once they are in, it should be easier to manage the rest.

The changes are:

  • code formatter whitespace fixes for the .md files
  • move some using directives from the individual unit test .jl files to the parent .jl file
  • in RAMSymbolic rename xxx_function to xxx_eval! as that better follows Julia naming conventions and should make the code a bit more readable (and shorter)
  • cleanups to the fitmeasures that simplify some method signatures (remove unused type parameters).
    This is a bit less trivial set of changes than the rest, but in the end it does not really change how the functions are calculated.
    Except for switching p-values calculation to use ccdf(x) instead of 1 - cdf(x) -- this could potentially give more precise results for p-values close to 0.

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

Attention: Patch coverage is 86.79245% with 14 lines in your changes missing coverage. Please review.

Project coverage is 72.81%. Comparing base (8b0f880) to head (0c7d594).
Report is 43 commits behind head on devel.

Files with missing lines Patch % Lines
src/optimizer/abstract.jl 11.11% 8 Missing ⚠️
ext/SEMNLOptExt/NLopt.jl 85.71% 2 Missing ⚠️
src/frontend/fit/fitmeasures/chi2.jl 93.75% 2 Missing ⚠️
src/implied/RAM/symbolic.jl 93.10% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #245      +/-   ##
==========================================
- Coverage   72.94%   72.81%   -0.14%     
==========================================
  Files          50       54       +4     
  Lines        2218     2218              
==========================================
- Hits         1618     1615       -3     
- Misses        600      603       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alyst
Copy link
Contributor Author

alyst commented Mar 22, 2025

I've rebased the PR after the #253 got merged.

@Maximilian-Stefan-Ernst I have also noticed that you have implemented #246.
I am not sure I understand what was exactly the reason for these changes -- I guess it was related to running some examples/tests, but if that's the case we can fix it differently.
To me this change defeats the purpose of using extension mechanism for supporting different optimization engines as it moves the SemOptimizer subtypes back into the main package.
There is no strong reason to make engine-specific SemOptimizer subtypes public and recommend the user constructing them explicitly, especially since these constructors take all their input as keyword arguments.
Yes, before #246 the SemOptimizerEngine type was only available within the extension and was not exposed upon extension activation,
but SemOptimizer(engine = ...) => SemOptimizer{engine}(...) => SemOptimizerEngine(...) mechanism can handle SemOptimizerEngine construction just fine.
It is a standard pattern for implementing Julia extensions.
Also, I think for the user it is easier to memorize the SemOptimizer(engine = ...) construct, and it also makes it easier to switch the engines.

So I have added commits that revert #246 in this PR, but also updated the optimization documentation to be in sync with the actual opt. engine API:

  • SemOptimizationOptim(), SemOptimizationNLopt() etc in the docs are replaced with SemOptimizer(engine = <engine_name>, args...).
  • I have updated the fallback SemOptimizer(engine = ...) constructor to inform the user, which packages should be loaded for NLopt and ProximalAlgorithms, if that was one of the reasons for Fix extensions #246.
  • For NLopt I have replaced NLoptConstraint(f = func, tol = tol) with func => tol.
    That simplifies the syntax and avoids defining NLoptContraint type, which is only really used for SemOptimizerNLopt construction.
    I have also allowed specifying just the function without the tolerance -- in that case the tolerance will be taken from the constraint_tol parameter.
  • In the documentation I have changed the term "backend" into "engine" to match the SemOptimizer keyword, but if you have strong preference for "backend",
    I can revert it and rename the "engine" keyword into "backend".
  • I have also simplified the examples: since the optimizer is now separate from the model, we don't need to duplicate the model if we want to fit it with another optimizer.

Please let me know if you have any concerns regarding these changes, I will be happy to address them.

@alyst alyst closed this Apr 26, 2025
@alyst alyst reopened this Apr 26, 2025
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.

1 participant