pymc4/flow/executor.py
def as_sampling_state(self) -> "SamplingState":
        """Create a sampling state that should be used within MCMC sampling.

        There are some principles that hold for the state.

            1. Check there is at least one distribution
            2. Check all transformed distributions are autotransformed
            3. Remove untransformed values if transformed are present
            4. Remove all other irrelevant values
        """
        if not self.distributions:
            raise TypeError(
                "No distributions found in the state. "
                "the model you evaluated is empty and does not yield any PyMC4 distribution"
            )
        untransformed_values = dict()
        transformed_values = dict()
        observed_values = dict()
        for name, dist in self.distributions.items():
            namespec = utils.NameParts.from_name(name)
            if dist.transform is not None and name not in self.observed_values:
                transformed_namespec = namespec.replace_transform(dist.transform.name)
                if transformed_namespec.full_original_name not in self.transformed_values:
                    raise TypeError(
                        "Transformed value {!r} is not found for {} distribution with name {!r}. "
                        "You should evaluate the model using the transformed executor to get "
                        "the correct sampling state.".format(
                            transformed_namespec.full_original_name, dist, name
                        )
                    )
                else:
                    transformed_values[
                        transformed_namespec.full_original_name
                    ] = self.transformed_values[transformed_namespec.full_original_name]
            else:
                if name in self.observed_values:
                    observed_values[name] = self.observed_values[name]
                elif name in self.untransformed_values:
                    untransformed_values[name] = self.untransformed_values[name]
                else:
                    raise TypeError(
                        "{} distribution with name {!r} does not have the corresponding value "
                        "in the state. This may happen if the current "
                        "state was modified in the wrong way."
                    )
        return self.__class__(
            transformed_values=transformed_values,
            untransformed_values=untransformed_values,
            observed_values=observed_values,
        )
Create a sampling state that should be used within MCMC sampling.

        There are some principles that hold for the state.

            1. Check there is at least one distribution
            2. Check all transformed distributions are autotransformed
            3. Remove untransformed values if transformed are present
            4. Remove all other irrelevant values
        
Create a sampling state that should be used within MCMC sampling.
There are some principles that hold for the state.

1. Check there is at least one distribution
2. Check all transformed distributions are autotransformed
3. Remove untransformed values if transformed are present
4. Remove all other irrelevant values
Create a sampling state that should be used within MCMC sampling . There are some principles that hold for the state . 1 . Check there is at least one distribution 2 . Check all transformed distributions are autotransformed 3 . Remove untransformed values if transformed are present 4 . Remove all other irrelevant values
def as_sampling_state(self) -> "SamplingState":
        if not self.distributions:
            raise TypeError(
                "No distributions found in the state. "
                "the model you evaluated is empty and does not yield any PyMC4 distribution"
            )
        untransformed_values = dict()
        transformed_values = dict()
        observed_values = dict()
        for name, dist in self.distributions.items():
            namespec = utils.NameParts.from_name(name)
            if dist.transform is not None and name not in self.observed_values:
                transformed_namespec = namespec.replace_transform(dist.transform.name)
                if transformed_namespec.full_original_name not in self.transformed_values:
                    raise TypeError(
                        "Transformed value {!r} is not found for {} distribution with name {!r}. "
                        "You should evaluate the model using the transformed executor to get "
                        "the correct sampling state.".format(
                            transformed_namespec.full_original_name, dist, name
                        )
                    )
                else:
                    transformed_values[
                        transformed_namespec.full_original_name
                    ] = self.transformed_values[transformed_namespec.full_original_name]
            else:
                if name in self.observed_values:
                    observed_values[name] = self.observed_values[name]
                elif name in self.untransformed_values:
                    untransformed_values[name] = self.untransformed_values[name]
                else:
                    raise TypeError(
                        "{} distribution with name {!r} does not have the corresponding value "
                        "in the state. This may happen if the current "
                        "state was modified in the wrong way."
                    )
        return self.__class__(
            transformed_values=transformed_values,
            untransformed_values=untransformed_values,
            observed_values=observed_values,
        )
def as_sampling_state ( self ) -> "SamplingState" : if not self . distributions : raise TypeError ( "No distributions found in the state. " "the model you evaluated is empty and does not yield any PyMC4 distribution" ) untransformed_values = dict ( ) transformed_values = dict ( ) observed_values = dict ( ) for name , dist in self . distributions . items ( ) : namespec = utils . NameParts . from_name ( name ) if dist . transform is not None and name not in self . observed_values : transformed_namespec = namespec . replace_transform ( dist . transform . name ) if transformed_namespec . full_original_name not in self . transformed_values : raise TypeError ( "Transformed value {!r} is not found for {} distribution with name {!r}. " "You should evaluate the model using the transformed executor to get " "the correct sampling state." . format ( transformed_namespec . full_original_name , dist , name ) ) else : transformed_values [ transformed_namespec . full_original_name ] = self . transformed_values [ transformed_namespec . full_original_name ] else : if name in self . observed_values : observed_values [ name ] = self . observed_values [ name ] elif name in self . untransformed_values : untransformed_values [ name ] = self . untransformed_values [ name ] else : raise TypeError ( "{} distribution with name {!r} does not have the corresponding value " "in the state. This may happen if the current " "state was modified in the wrong way." ) return self . __class__ ( transformed_values = transformed_values , untransformed_values = untransformed_values , observed_values = observed_values , )
Create a sampling state that should be used within MCMC sampling.
Create a sampling state that should be used within MCMC sampling .
"""Create a sampling state that should be used within MCMC sampling.

        There are some principles that hold for the state.

            1. Check there is at least one distribution
            2. Check all transformed distributions are autotransformed
            3. Remove untransformed values if transformed are present
            4. Remove all other irrelevant values
        """
self