Skip to content
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

[BUG]: nested constraint on exp + tanh not applied #402

Open
astro-nova opened this issue Jan 22, 2025 · 0 comments
Open

[BUG]: nested constraint on exp + tanh not applied #402

astro-nova opened this issue Jan 22, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@astro-nova
Copy link

What happened?

I have a few nested constraints, basically want to force it that each function can only take variables/constants as arguments, instead of more functions, here:

model = SRRegressor(
    binary_operators=[+,-,*,/], 
    unary_operators=[exp,tanh,erf,log10], 
    elementwise_loss=L1DistLoss(),
    batching=true,
    batch_size=200,
    turbo=true,
    constraints=[(^)=>(-1, 1), tanh=>5, erf=>5, exp=>5, log10=>5],
    complexity_of_variables=[3,1,1],
    complexity_of_constants=1,
    nested_constraints= [exp => [exp => 0, tanh => 0, erf => 0], tanh => [exp => 0, tanh => 0, erf => 0],
                        erf => [exp => 0, tanh => 0, erf => 0]],
    dimensional_constraint_penalty=0,
    maxsize=20,
    populations=50,
    population_size=100,
    niterations=1000,
    parsimony=0.0001,
    bumper=false,
    output_directory="fits/$param",
    ncycles_per_iteration=500,
);

In my hall of fame, it keeps optimizing to tanh(exp(x₃)) * x₁. It doesn't look like any other functions are improperly nested, just the exp appearing inside the tanh. Am I doing something wrong?

Cheers,
Liza

Version

1.5.2

Operating System

macOS

Interface

Julia REPL, Script (i.e., python my_script.py)

Relevant log output

Extra Info

No response

@astro-nova astro-nova added the bug Something isn't working label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants