mescla.emma.archetypes.ArchetypeResult¶
- class mescla.emma.archetypes.ArchetypeResult(archetypes, weights, support, rss, tss, n_iter, converged, seed, restart_rss, space, samples, species, hull_fraction=None, diagnostics=<factory>)[source]¶
Bases:
objectArchetypes fitted to a set of water samples.
- Variables:
archetypes (EndMembers) – The
khull points, back-transformed to concentration units. These are candidates: real chemistry has to recognise them before they are end-members.weights (ndarray, shape (n_samples, n_archetypes)) – Reconstruction weights. Non-negative, rows sum to one, and not mixing ratios – see the module docstring and
ratios.support (ndarray, shape (n_archetypes, n_samples)) – How each archetype is built from the samples. A row concentrated on one sample is a single-sample end-member with all the fragility that implies; a row spread over several is the thing that answers “we have no replicates”.
tss (rss,) – Residual and total sum of squares in standardised space.
explained_variance (float) –
1 - rss / tss.hull_fraction (float or None) – Fraction of samples enclosed by the archetypes, when fitted through
mescla.emma.model.EMMA.archetypes()so that U-space is defined.restart_rss (ndarray) – Objective reached by each restart. When only a minority of restarts reach the best value the optimum is not being found reliably – see
restarts_at_bestand runarchetype_stability().
- Parameters:
- archetypes: EndMembers¶
- as_endmembers(labels=None)[source]¶
The archetypes, ready to hand to a mixing estimator.
Rename them as you go: an end-member called
A2has not been interpreted, and interpreting it against the conceptual model is the step that turns a hull point into a source.- Parameters:
- Return type:
- archetypes_frame()[source]¶
Archetype compositions in concentration units.
- Return type:
pd.DataFrame
- weights_frame()[source]¶
Reconstruction weights. Read
ratiosbefore you treat these as shares.- Return type:
pd.DataFrame
- support_frame(top=5)[source]¶
Which real samples define each archetype, and how strongly.
n_effectiveis the inverse participation ratio of the support weights: roughly how many samples the archetype actually rests on. Close to 1 means it is one analysis wearing a hat, and its uncertainty is assumed rather than measured – exactly the limitation that jackknifing over replicates exists to remove.- Parameters:
top (int)
- Return type:
pd.DataFrame
- negative_species()[source]¶
Species an archetype pushes below zero – a physically impossible water.
Not fatal (the fit is done in standardised space, where nothing forbids it) but it means the archetype has been extrapolated past any real water, and it should not be used as an end-member without comment.
- property restarts_at_best: float¶
Fraction of restarts landing within 1% of the best objective.
The honest measure of whether a non-convex fit found its optimum. Near 1 means the vertices are easy to find; a small value means most starting points end somewhere else, and the single answer you are looking at is one of several.