Skip to content

Is there a way to make the time-varying intercept always positive? #800

Closed Answered by sangrey
sangrey asked this question in Q&A
Discussion options

You must be logged in to vote

It appears that you can inherit from the MMM class and reimplement the build_model method. Something like the following should work.

class NoomMMM(MMM):

    def __init__(self, *args, **kwargs):

      super(NoomMMM, self).__init__(*args, **kwargs)
    
    def build_model(
        self,
        X: pd.DataFrame,
        y: pd.Series | np.ndarray,
        **kwargs,
    ) -> None:
       
        self._generate_and_preprocess_model_data(X, y)
        with pm.Model(
            coords=self.model_coords,
            coords_mutable=self.coords_mutable,
        ) as self.model:
            channel_data_ = pm.Data(
                name="channel_data",
                value=self.preprocessed_data…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sangrey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants