Neuraxle icon indicating copy to clipboard operation
Neuraxle copied to clipboard

Feature: Support the +, -, /, *, \, and the ** operators on hyperparameter distributions

Open guillaume-chevalier opened this issue 5 years ago • 1 comments

Is your feature request related to a problem? Please describe. Adding spaces would return wrappers of the two spaces. If encountering a float or an int, it'd wrap it by a FixedHyperParam before the addition.

Describe the solution you'd like

Do this in the abstract-most distribution such that every distribution have such operators:


def __add__(self, other): 
    if not isinstance(other, Distribution): 
        other = FixedHyperParam(other)  # wrap ints and floats and other things
    return AddWrapper(self, other) 

And then it'd look like this perhaps


class AddWrapper(...): 
    """A wrapper for lazily performing an addition between two other distributions."""
    def rvs(...): 
        return self.a.rvs() + self.b.rvs()

class ExpWrapper(...)...

class SubWrapper... 

I have the following idea... I only hope that in the operator wrappers it's possible to properly code the std, cdf' pdf, and all the other methods that must be normally coded.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

guillaume-chevalier avatar Dec 18 '20 18:12 guillaume-chevalier

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 180 days. Thank you for your contributions.

stale[bot] avatar Jun 22 '22 11:06 stale[bot]