hankel module

This module contains the Hankel class

class hankel.Hankel(sample_instance, lrows=[], lcolumns=[], version='classic', partial=False, sparse=False)[source]

Bases: object

A Hankel instance , compute the list of Hankel matrix

Example:
>>> from sp2learn import Sample, Learning, Hankel
>>> train_file = '0.spice.train'
>>> 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:
Parameters:
  • sample (dict) – sample dictionary
  • pref (dict) – prefix dictionary
  • suff (dict) – suffix dictionary
  • fact (dict) – factor dictionary
  • nbL (int) – the number of letters
  • nbS (int) – the number of states
  • lrows (int or list of int) – 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
  • lcolumns (int or list of int) – 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
  • version (string) – (default = “classic”) version name
  • partial (boolean) – (default value = False) build of partial
  • sparse (boolean) – (default value = False) True if Hankel matrix is sparse
build(sample, pref, suff, fact, lrows, lcolumns)[source]

Create a Hankel matrix

  • Input:
Parameters:
  • sample (dict) – sample dictionary
  • pref (dict) – prefix dictionary
  • suff (dict) – suffix dictionary
  • fact (dict) – factor dictionary
  • lrows (int or list of int) – 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
  • lcolumns (int or list of int) – 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
  • Output:
Returns:list lhankel, list of hankel matrix, a DoK based sparse matrix or nuppy matrix based not sparse
Return type:list of matrix
nbEx

Number of examples

nbL

Number of letters