dso-org / deep-symbolic-optimization

A deep learning framework for symbolic optimization.
BSD 3-Clause "New" or "Revised" License
585 stars 125 forks source link

about putting constraints #92

Closed xuchuan8908 closed 7 months ago

xuchuan8908 commented 7 months ago

Thanks for this open-source software. My question is: whether we could put a constraint to force that every variable (feature in the dataset) should be included in the obtained formulation?

Thanks a lot, Chuan

brendenpetersen commented 7 months ago

This is a great idea of a prior when you know that your response variable is a function of all input variables. You can do this without any code changes using the RepeatConstraint, where you set min to 1 and max to None for each input variable. Thanks!

N-Ytn commented 4 months ago

Is this feature available? When implementing the prior as @brendenpetersen suggested DSO throws an error of Repeat minimum constraints are not yet supported. This requires knowledge of length constraints.

As given in prior.py

Prior.__init__(self, library)
assert min_ is not None or max_ is not None, \
"{}: At least one of (min_, max_) must not be None.".format(self.__class__.__name__)
self.min = min_
self.max = max_
self.tokens = library.actionize(tokens)

assert min_ is None, "{}: Repeat minimum constraints are not yet " \
"supported. This requires knowledge of length constraints.".format(self.__class__.__name__)

Thank you