Skip to content

Integer constants + how to use atan2 #344

Answered by MilesCranmer
benlabbeus asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Yes, the trick for this is to avoid constants altogether, and give 1 and 2 as features. For example:
data_cols = 5
integer_cols = 2
X = np.random.randn(100, data_cols + integer_cols)  # Normal data is first 5 columns
X[:, data_cols+0] = 1
X[:, data_cols+1] = 2

We have generated some random data and then set the last two columns equal to the constants we wish for PySR to use.

Then, we need to disable PySR from finding its own constants, by making them prohibitively expensive (and also disabling the constant optimization routine to speed things up):

settings_to_disable_constants = dict(
    complexity_of_constants=100,  # Make constants too expensive to use
    should_optimize_constants=F…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by benlabbeus
Comment options

You must be logged in to vote
1 reply
@MilesCranmer
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
PySR PySR-related discussion SymbolicRegression.jl SymbolicRegression.jl-related discussion
2 participants