![]() ![]() ![]() keys () elif version = "suffix" : lrows = fact. keys () elif version = "prefix" : lrows = pref. version if version = "classic" : lrows = pref. ![]() _create_hankel ( sample = sample, pref = pref, suff = suff, fact = fact, lrows = lrows, lcolumns = lcolumns ) print ( "End of compute Hankel matrix" ) return lhankel def _build_not_partial ( self, pref, suff, fact ): version = self. _build_partial ( pref = pref, suff = suff, fact = fact, lrows = lrows, lcolumns = lcolumns ) lhankel = self. _build_not_partial ( pref = pref, suff = suff, fact = fact ) else : ( lrows, lcolumns ) = self. def build ( self, sample, pref, suff, fact, lrows, lcolumns ): """ Create a Hankel matrix - Input: :param dict sample: sample dictionary :param dict pref: prefix dictionary :param dict suff: suffix dictionary :param dict fact: factor dictionary :param lrows: number or list of rows, a list of strings if partial=True otherwise, based on self.pref if version="classic" or "prefix", self.fact otherwise :type lrows: int or list of int :param lcolumns: number or list of columns a list of strings if partial=True otherwise, based on self.suff if version="classic" or "suffix", self.fact otherwise :type lcolumns: int or list of int - Output: :returns: list lhankel, list of hankel matrix, a DoK based sparse matrix or nuppy matrix based not sparse :rtype: list of matrix """ # calcul des lignes lrows et colonnes lcolumns print ( "Start compute Hankel matrix" ) if not self. _nbEx def nbEx ( self, nbEx ): if not isinstance ( nbEx, int ): raise TypeError ( "nbEx should be an integer" ) if nbEx = 0" ) self. _nbL = nbL def nbEx ( self ): """Number of examples""" return self. _nbL def nbL ( self, nbL ): if not isinstance ( nbL, int ): raise TypeError ( "nbL should be an integer" ) if nbL = 0" ) self. ![]() fact, lrows = lrows, lcolumns = lcolumns ) def nbL ( self ): """Number of letters""" return self. Class Hankel ( object ): """ A Hankel instance, compute the list of Hankel matrix :Example: > from sp2learn import Sample, Learning, Hankel > train_file = '0.ain' > pT = Sample(adr=train_file) > S_app = Learning(sample_instance=pT) > lhankel = Hankel( sample=pT.sample, pref=pT.pref, > suff=pT.suff, fact=pT.fact, > nbL=pT.nbL, nbEx=pT.nbEx, > lrows=6, lcolumns=6, version="classic", > partial=True, sparse=True).lhankel - Input: :param dict sample: sample dictionary :param dict pref: prefix dictionary :param dict suff: suffix dictionary :param dict fact: factor dictionary :param int nbL: the number of letters :param int nbS: the number of states :param lrows: number or list of rows, a list of strings if partial=True otherwise, based on self.pref if version="classic" or "prefix", self.fact otherwise :type lrows: int or list of int :param lcolumns: number or list of columns a list of strings if partial=True otherwise, based on self.suff if version="classic" or "suffix", self.fact otherwise :type lcolumns: int or list of int :param string version: (default = "classic") version name :param boolean partial: (default value = False) build of partial :param boolean sparse: (default value = False) True if Hankel matrix is sparse """ def _init_ ( self, sample_instance, lrows =, lcolumns =, version = "classic", partial = False, sparse = False ): # Size of the alphabet self. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |