Skip to content

classify

classify(
    criteria,
    rules,
    *,
    default="unclassified",
    domains=None,
    domain_column=None,
) -> ndarray

Labels each block with the first rule whose conditions all hold.

Parameters:

Name Type Description Default
criteria Table or dict of str to array_like

Per-block metrics, e.g. slope, efficiency from predict(..., diagnostics=True), nearest_dist, n_holes from neighborhood_stats and distances from hole_distance.

required
rules sequence of (str, dict), or dict of domain to such a sequence

(label, {metric: (op, threshold)}) in priority order; op is one of <, <=, >, >=. NaN never satisfies a condition. With domains, a dict gives each domain its own rules; the None key covers domains not listed, and blocks of other domains get default.

required
default str

Label where no rule holds.

'unclassified'
domains array_like

Domain of each block, the keys of rules.

None
domain_column str

The column of criteria holding the domains; instead of domains.

None

Examples:

>>> classify(d, [("measured", {"slope": (">=", 0.8), "n_holes": (">=", 3)}),
...              ("indicated", {"slope": (">=", 0.5)})], default="inferred")

used in