Previous Up Next

class Lexique

module lexique

This class is used for all of the computations of partitions, partitionings and HMM analysis.

A lexique is a set of descriptors. The prediction functions, used for all the computations, are defined by the descriptors.

Beware: The descriptors #33 and #94 should not be used (see descriptors).

Optionaly, some values can be put for the transitions between the descriptors: these values are used for HMM computations.

Construction

__init__
Optional keywords:
str=s
builds from string s, using read_str;
alpha=a
uses the letters of string a, in use with option str (see input);
Lprop=l
builds from Lproportion l, using read_Lprop;
fic=f
builds from filename f, using read_nf;
fprop=f
builds from filename f of Lproportion, using read_Lprop;
read_nf
builds from a filename and optionaly a string of letters (see input);
read_str
builds from a string and optionaly another string of letters (see input).
read_Lprop
builds from a Lproportion, each Proportion being translated as in read_prop, and the transitions between descriptors are valued by the logarithms of the transitions proportions.

Handling

is_empty
returns True if there is no descriptor, False otherwise;
__len__
returns the number of descriptors;
ls_num
returns the list of the numbers of the descriptors;
met_au_net
removes repetitions in patterns of descriptors (like ACAC cleaned in AC) and repetitions of descriptors (like A A cleaned in A);
__iter__
iterates over the descriptors, using for d in lx;
__delitem__
removes the Descripteur of given number;
__getitem__
gets the Descripteur of given number by COPYING it;
init_trans
initialises the array of the transition probabilities;
g_trans
gets the logarithm of the transition probability between Descripteurs of given numbers;
__iadd__
add the copies of the Descripteur of a given Lexique. If the number of a Descripteur is already in the Lexique, this Descripteur is not added;
__setitem__
For example:
>>> import lexique >>> l=lexique.Lexique(str="1:A 2,3:BC") >>> print l 3,2:CB 1:A >>> import descripteur >>> d=descripteur.Descripteur(3,str="Z") >>> print d Z >>> l[2]=d >>> print l 3,2:CZ 1:A >>> d.read_str("P") >>> print l 3,2:CZ 1:A >>> e=descripteur.Descripteur(3,str="Y") >>> l[5]=e 5:Y >>> print l 5:Y 3,2:CZ 1:A >>> l[4,3]=e,d Bad descriptor number 3 already used >>> l[4,6]=e,d 4,6:YP >>> print l 6,4:PY 5:Y 3,2:CZ 1:A >>> del l[3] >>> del l[2] >>> print l 6,4:PY 5:Y 1:A >>> l[3,2]="X",e 3,2:XY >>> print l 2,3:YX 6,4:PY 5:Y 1:A #########################
prediction
computes the maximum prediction on a data, without using between-descriptors transitions;

Optional keywords:

deb=d
sets the first position of the segment on which the prediction is computed (default: 0);
fin=f
sets the last position of the segment on which the prediction is computed (default: last position-1);

If deb>fin, it returns 0.

val_max
computes the maximum sum of predictions on a data, without using between-descriptors transitions; in that case, the maximal prediction is computed on each position, and the sum of these values is returned;

Optional keywords:

deb=d
sets the first position of the segment on which the prediction is computed (default: 0);
fin=f
sets the last position of the segment on which the prediction is computed (default: last position-1);

If deb>fin, it returns 0.

llh
computes the best log-likelihood on a Sequence.

Optional keywords:

deb=d
sets the first position of the segment on which the log-likelihood is computed (default: 0);
fin=f
sets the last position of the segment on which the log-likelihood is computed (default: last position-1);

If deb>fin, it returns 0.

ls_evalue
returns the dictionnary of tuple of (the pattern of) numbers of descriptors, prediction of this (pattern of) descriptor on the data, for all descriptors, on a given data.

Optional keywords:

deb=d
sets the first position of the segment on which the predictions are computed (default: 0);
fin=f
sets the last position of the segment on which the predictions are computed (default: last position -1 );

If deb>fin, it returns 0.

windows
computes the list of the best predictions on the data in a sliding window of a given size and with steps of a given length;
log_likelihood
computes the list of the log-likelihoods of the data given the numbers of segment, up to a given number of segments.

Input-Output


Previous Up Next