Skip to content

critical_parameter_ranking

critical_parameter_ranking ¤

Outcome-driven ranking of candidate critical process parameters (CPPs).

During process development the question is rarely "is this signal in spec?" -- it is "which of these signals drives the outcome we care about?" This detector ranks candidate input parameters by their statistical association with a per-run quality outcome (yield, pass/fail, KPI), so the process development engineer can shortlist a small set of true CPPs for tighter control.

Three association measures are supported, all from scipy.stats:

  • pearson -- linear correlation (best when both inputs and outcome are continuous and approximately linear).
  • spearman -- rank correlation (robust to non-linear monotonic relationships and outliers).
  • anova_f -- one-way ANOVA F-statistic between groups defined by discrete levels of the parameter (the right test when factors were swept at discrete levels in a DOE).

CriticalParameterRankingEvents ¤

CriticalParameterRankingEvents(
    dataframe: DataFrame | None = None,
    *,
    event_uuid: str = "dev:cpp_ranking",
    time_column: str = "systime"
)

Bases: Base

Rank input parameters by their statistical link to a quality outcome.

The detector operates on a per-run table where each row is a completed run (batch, DOE point, shift), each candidate column is the aggregated value of an input parameter during that run, and an outcome column holds the quality / yield measurement of interest.

:meth:rank takes the wide per-run table directly, because aggregating "the right number" for each parameter is a development-engineer judgment call (mean of the hold phase? settled value? peak?) that varies by parameter. The constructor's long-format dataframe is optional and not used by :meth:rank: CriticalParameterRankingEvents().rank(runs, ...) works without a time column.

Example

import pandas as pd runs = pd.DataFrame({"temp": [180, 185, 190, 195, 200], ... "speed": [5, 3, 4, 2, 1], ... "yield_pct": [90, 92, 94, 96, 98]}) ranked = CriticalParameterRankingEvents().rank( ... runs, ["temp", "speed"], "yield_pct") ranked["parameter"].tolist() ['temp', 'speed']

Parameters:

Name Type Description Default
dataframe DataFrame | None

Optional long-format data; :meth:rank does not use it.

None
event_uuid str

uuid of the emitted rows.

'dev:cpp_ranking'
time_column str

Timestamp column of dataframe.

'systime'

rank ¤

rank(
    per_run_df: DataFrame,
    candidate_columns: list[str],
    outcome_column: str,
    *,
    method: str = "spearman",
    anova_bins: int = 3
) -> pd.DataFrame

Rank candidate parameters by statistical association with the outcome.

Parameters:

Name Type Description Default
per_run_df DataFrame

One row per run, one column per candidate parameter, plus an outcome column.

required
candidate_columns list[str]

Columns to evaluate as candidate CPPs.

required
outcome_column str

Outcome (response) column.

required
method str

"pearson", "spearman", or "anova_f".

'spearman'
anova_bins int

Only used for method="anova_f". Each candidate column is quantile-binned into this many groups before the one-way ANOVA is run.

3

Returns:

Type Description
DataFrame

Summary DataFrame: parameter, method, statistic,

DataFrame

p_value, abs_effect_size, rank. Sorted by

DataFrame

abs_effect_size descending so the top driver is the first

DataFrame

row.

Raises:

Type Description
ColumnNotFoundError

If outcome_column is not in per_run_df (a ValueError subclass).

top_drivers ¤

top_drivers(
    per_run_df: DataFrame,
    candidate_columns: list[str],
    outcome_column: str,
    *,
    method: str = "spearman",
    k: int = 5,
    alpha: float = 0.05,
    anova_bins: int = 3
) -> pd.DataFrame

Return the top-k candidates with p_value <= alpha.

Wraps :meth:rank and filters by significance. The result keeps the same column schema as :meth:rank.

Parameters:

Name Type Description Default
per_run_df DataFrame

One row per run, one column per candidate parameter, plus an outcome column.

required
candidate_columns list[str]

Columns to evaluate as candidate CPPs.

required
outcome_column str

Outcome (response) column.

required
method str

"pearson", "spearman", or "anova_f". Default "spearman".

'spearman'
k int

Maximum number of significant parameters to return.

5
alpha float

Significance level; only parameters with p_value <= alpha are kept.

0.05
anova_bins int

Only used for method="anova_f"; number of quantile bins per candidate column.

3

Returns:

Type Description
DataFrame

Same columns as :meth:rank (parameter, method,

DataFrame

statistic, p_value, abs_effect_size, rank),

DataFrame

limited to at most k significant rows.