def init_from_dict(
        cls,
        d: Dict,
        optimizer: Optional[OptaxOptimizer] = None,
        **kwargs,
    ) -> PosteriorState:
        """
        Initialize a posterior distribution state from a dictionary.

        Parameters
        ----------
        d : Dict
            A dictionary including attributes of the posterior state.
        optimizer : Optional[OptaxOptimizer]
            An optax optimizer to assign to the posterior state.

        Returns
        -------
        PosteriorState
            A posterior state.
        """
        kwargs = {
            **kwargs,
            **{
                k: v
                for k, v in d.items()
                if k
                not in [
                    "params",
                    "mutable",
                    "optimizer",
                    "calib_params",
                    "calib_mutable",
                ]
            },
        }
        return cls.init(
            FrozenDict(d["params"]),
            FrozenDict(d["mutable"]) if d["mutable"] is not None else None,
            optimizer,
            (
                FrozenDict(d.get("calib_params"))
                if d["calib_params"] is not None
                else None
            ),
            (
                FrozenDict(d.get("calib_mutable"))
                if d["calib_mutable"] is not None
                else None
            ),
            **kwargs,
        )

        Initialize a posterior distribution state from a dictionary.

        Parameters
        ----------
        d : Dict
            A dictionary including attributes of the posterior state.
        optimizer : Optional[OptaxOptimizer]
            An optax optimizer to assign to the posterior state.

        Returns
        -------
        PosteriorState
            A posterior state.
        
fortuna/prob_model/posterior/state.py