def _check(self):
        """Validates model parameters prior to fitting.

        Raises
        ------

        ValueError
            If any of the parameters are invalid, e.g. if :attr:`startprob_`
            don't sum to 1.
        """
        self.startprob_ = np.asarray(self.startprob_)
        if len(self.startprob_) != self.n_components:
            raise ValueError("startprob_ must have length n_components")
        if not np.allclose(self.startprob_.sum(), 1.0):
            raise ValueError("startprob_ must sum to 1.0 (got {:.4f})"
                             .format(self.startprob_.sum()))

        self.transmat_ = np.asarray(self.transmat_)
        if self.transmat_.shape != (self.n_components, self.n_components):
            raise ValueError(
                "transmat_ must have shape (n_components, n_components)")
        if not np.allclose(self.transmat_.sum(axis=1), 1.0):
            raise ValueError("rows of transmat_ must sum to 1.0 (got {})"
                             .format(self.transmat_.sum(axis=1)))
def _check ( self ) : self . startprob_ = np . asarray ( self . startprob_ ) if len ( self . startprob_ ) != self . n_components : raise ValueError ( "startprob_ must have length n_components" ) if not np . allclose ( self . startprob_ . sum ( ) , 1.0 ) : raise ValueError ( "startprob_ must sum to 1.0 (got {:.4f})" . format ( self . startprob_ . sum ( ) ) ) self . transmat_ = np . asarray ( self . transmat_ ) if self . transmat_ . shape != ( self . n_components , self . n_components ) : raise ValueError ( "transmat_ must have shape (n_components, n_components)" ) if not np . allclose ( self . transmat_ . sum ( axis = 1 ) , 1.0 ) : raise ValueError ( "rows of transmat_ must sum to 1.0 (got {})" . format ( self . transmat_ . sum ( axis = 1 ) ) )
Validates model parameters prior to fitting.

        Raises
        ------

        ValueError
            If any of the parameters are invalid, e.g. if :attr:`startprob_`
            don't sum to 1.