-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
To replicate:
import equation_tree
from equation_tree.prior import priors_from_space, structure_prior_from_max_depth, structure_prior_from_depth
import numpy as np
max_vars = 2
prior={'structures': {'[0, 1, 2, 3]': 0.25,
'[0, 1, 2, 2]': 0.25,
'[0, 1, 2, 1]': 0.25,
'[0, 1, 1, 2]': 0.25},
'functions': {'squared': 1.0},
'operators': {'+': 0.25,
'-': 0.25,
'/': 0.25,
'*': 0.25},
'features': {'constants': 0.3,
'variables': 0.7}}
np.random.seed(864)
equation = equation_tree.sample(
n=1, prior=prior, max_num_variables=max_vars
)
print(equation)
np.random.seed(556)
equation = equation_tree.sample(
n=1, prior=prior, max_num_variables=max_vars
)
print(equation)will output:
Processing: 100%|█████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 45.17iteration/s]
[(c_1 + x_1)**2]
Processing: 100%|█████████████████████████████████████████████████████████████████| 1/1 [00:31<00:00, 31.80s/iteration]
[None]
So it seems the prior in general is not inconsistent, but a sampled structure + other spaces might be (not "enough leaves", maybe?). The much longer time that the failed run takes, makes it seem that some loop runs for a defined amount of iterations and, if not sucessfull, returns nan instead of raising an exception.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels