qumin.config package¶
Module contents¶
qumin.config.config module¶
- class qumin.config.config.Actions(*values)[source]¶
-
Available actions. Each action triggers a different script.
- Parameters:
patterns – computes alternation patterns (to be imported by other scripts)
pred – compute predictability measures
lattice – compute inflection class lattices.
macroclasses – compute macroclasses clusters.
microclasses – compute a heatmap of microclass similarity.
pred_heatmap – compute a heatmap for predictability measures
Changed in version 3.2.0: Actions
Handent_heatmapare replaced bypredandpred_heatmap. They are deprecated starting from 4.0.0.- lattice = 'lattice'¶
- macroclasses = 'macroclasses'¶
- microclasses = 'microclasses'¶
- patterns = 'patterns'¶
- pred = 'pred'¶
- pred_heatmap = 'pred_heatmap'¶
- class qumin.config.config.FeaturesConfig(*, forms=None, lexemes=None)[source]¶
Bases:
objectAdd known features to condition predictability computations. Features can be lexeme-level (same value to all forms of the lexeme) or form-level (different values for individual forms).
Typical lexeme-level features are gender, derivational history, etc. Typical form-level features are syllable count, syllable structure, etc.
- Parameters:
- class qumin.config.config.HeatmapConfig(*, label=None, cmap=None, exhaustive_labels=False, dense=False, annotate=False, order=None, cols=None, display=<factory>)[source]¶
Bases:
object- Parameters:
label (str | None) – Lexeme column to use as label (for microclass heatmap, eg. inflection_class)
cmap (str | None) – Colormap name
exhaustive_labels (bool) – by default, seaborn shows only some labels on the heatmap for readability. This forces seaborn to print all labels.
dense (bool) – Use initials instead of full labels (only for entropy heatmap)
annotate (bool) – Display values on the heatmap. (only for entropy heatmap)
order (Any | None) – Priority list for sorting features (for entropy heatmap) ex: [number, case]). If no features-values file available, you can use the key cells to provide an ordered list of cells to display. Special value “autosort” in order to sort by cell similarity.
cols (List[str] | None) – List of features to show in columns (for zones heatmap) ex: [Mode, Tense]). All other features will constitute rows.
display (HeatmapDisplayConfig) – Options to switch on/off additional heatmaps.
- display: HeatmapDisplayConfig¶
- class qumin.config.config.HeatmapDisplayConfig(*, n_pairs=True, freq_margins=True)[source]¶
Bases:
objectSet to True/False to show or hide detailed information on the heatmap
- Parameters:
- class qumin.config.config.Kind(*values)[source]¶
-
Kind of algorithm for the patterns.
- Parameters:
phon – phonological distance
edits – simple edit distance
- edits = 'edits'¶
- phon = 'phon'¶
- class qumin.config.config.LatticeConfig(*, shorten=False, aoc=False, export=<factory>, display=<factory>)[source]¶
Bases:
objectConfiguration for the ``lattice`` action.
- Parameters:
shorten (bool) – Drop redundant columns altogether. Useful for big contexts, but loses information. The lattice shape and stats will be the same. Avoid using with –html
aoc (bool) – Only attribute and object concepts. Sometimes faster for large lattices.
export (LatticeExportConfig) – Options for lattice export.
display (LatticeDisplayConfig) – Options for lattice drawing.
- display: LatticeDisplayConfig¶
- export: LatticeExportConfig¶
- class qumin.config.config.LatticeDisplayConfig(*, horizontal=False, topdown=True, layout='qumin')[source]¶
Bases:
objectExport configuration for the ``lattice`` action.
- Parameters:
horizontal (bool) – direction of the lattice (top->down or left->right).
topdown (bool) – Whether to start drawing from top to down or vice-versa.
layout (str) – Drawing layout. Supported values are “qumin” for Qumin’s internal algorithm, or the following networkx layouts: ‘dot’ (requires
pygraphviz), ‘radial’ (requirespygraphviz), ‘spring’, ‘kamada_kawai’.
- class qumin.config.config.LatticeExportConfig(*, html=True, ctxt=False, stat=False, pdf=True, png=False)[source]¶
Bases:
objectExport configuration for the ``lattice`` action.
- Parameters:
- class qumin.config.config.MacroclassConfig(*, horizontal=False, square=False, topdown=True)[source]¶
Bases:
objectConfiguration for the ``macroclasses`` action.
- Parameters:
Example:
square=True square=False │ ┌──┴──┐ │ ╱╲ horizontal=False │ │ ┌─┴─┐ │ ╱ ╲ topdown=True │ │ │ │ │ ╱ ╱╲ │ │ │ │ │ ╱ ╱ ╲ │__│___│___│ │╱___╱____╲ │─────┐ │⟍ │───┐ ├ │ ⟍ horizontal=True │ ├─┘ │⟍ ⟋ topdown=True │───┘ │⟋ │____________ │____________
- class qumin.config.config.OverabundantPatternsConfig(*, keep=False, freq=True, tags=None)[source]¶
Bases:
objectConfiguration for the processing of overabundant forms.
- Parameters:
- class qumin.config.config.PatternsConfig(*, kind=Kind.phon, defective=False, gap_proportion=0.4, optim_mem=False, overabundant=<factory>)[source]¶
Bases:
objectConfiguration for the
patternsaction.- Parameters:
kind (Kind) – Options are (see docs): phon, edits
defective (bool) – Whether to keep defective entries
gap_proportion (float) – Proportion of the median score used to set the gap score
optim_mem (bool) – Attempt to use a little bit less memory
overabundant (OverabundantPatternsConfig) – Configuration for overabundance
- overabundant: OverabundantPatternsConfig¶
- class qumin.config.config.PredictabilityConfig(*, vis=True, n=<factory>, features=<factory>, importResults=None, exportApplicable=False, export_log=False, token_freq=<factory>)[source]¶
Bases:
objectConfiguration for entropy calculations.
- Parameters:
vis (bool) – Whether to create a heatmap of the metrics and of interpredictability zones.
n (List[int]) – Compute entropy for prediction from with n predictors.
features (FeaturesConfig) – Feature column in the Lexeme table. Features will be considered known in conditional probabilities: P(X~Y|X,f1,f2…)
importResults (str | None) – Import previous entropy computation results. with any file, use to compute entropy heatmap with n-1 predictors, allows for acceleration on nPreds entropy computation.
exportApplicable (bool) – whether to export applicable patterns for further entropy computations with different settings.
export_log (bool) – whether to export a full human readable markdown log of intermediate calculations (competition classes of alternation patterns and their respective probabilities)
token_freq (TokenFreqConfig) – Whether to use token frequencies for…
- features: FeaturesConfig¶
- token_freq: TokenFreqConfig¶
- class qumin.config.config.QuminConfig(*, action=Actions.patterns, data, patterns=None, pos=None, lexemes=None, cells=None, sample_lexemes=None, sample_cells=None, force_random=False, seed=1, force=False, cpus=1, resegment=False, checkSegments=True, pats=<factory>, lattice=<factory>, macroclasses=<factory>, heatmap=<factory>, pred=<factory>)[source]¶
Bases:
object- Parameters:
action (Actions) – Action, one of: patterns, pred, lattice, macroclasses, microclasses, pred_heatmap
data (str) – Path to paralex.package.json paradigms, segments
patterns (str | None) – Path to pattern computation metadata. If null, will compute patterns.
lexemes (str | None) – Lexemes to use (subset), path to a file with one lexeme id per row
sample_lexemes (int | None) – A number of lexemes to sample, for debug purposes.
sample_cells (int | None) – A number of cells to sample, for debug purposes. Samples by frequency if possible, otherwise randomly.
force_random (bool) – Whether to force random sampling.
seed (int) – Random seed for reproducible random effects.
force (bool) – Whether to overpass RAM usage security (2GB)
cpus (int) – Number of cpus to use for big computations Defaults to 1. 0 sets the number of available cpus to the maximum - 2.
resegment (bool) – Whether to ignore spaces in phon forms and re-compute phonemic segmentation
checkSegments (bool) – Whether to control if all forms contain licit segments.
pats (PatternsConfig) – Configuration for the
patternsaction.lattice (LatticeConfig) – Configuration for the
latticeaction.heatmap (HeatmapConfig) – Configuration for the
microclassesandpred_heatmapaction.pred (PredictabilityConfig) – Configuration for the
predaction.entropy – deprecated.
macroclasses (MacroclassConfig)
Changed in version 3.2.0: Namespace
entropyis replaced bypred.- heatmap: HeatmapConfig¶
- lattice: LatticeConfig¶
- macroclasses: MacroclassConfig¶
- pats: PatternsConfig¶
- pred: PredictabilityConfig¶