Skip to main content
Version: Next

ts_shape.events.development.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).
Classes
NameDescription
CriticalParameterRankingEventsRank input parameters by their statistical link to a quality outcome.

CriticalParameterRankingEvents​

classsource
CriticalParameterRankingEvents(
dataframe: pd.DataFrame | None = None,
*,
event_uuid: str = "dev:cpp_ranking",
time_column: str = "systime"
) -> None

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']
Functions
NameDescription
rankRank candidate parameters by statistical association with the outcome.
top_driversReturn the top-k candidates with p_value <= alpha.
event_uuid: ``uuid`` of the emitted rows.
time_column: Timestamp column of ``dataframe``.

rank​

methodsource
rank(
per_run_df: pd.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
NameTypeDescriptionDefault
per_run_dfDataFrameOne row per run, one column per candidate parameter, plus an outcome column.required
candidate_columnslist[str]Columns to evaluate as candidate CPPs.required
outcome_columnstrOutcome (response) column.required
methodstr"pearson", "spearman", or "anova_f".'spearman'
anova_binsintOnly used for method="anova_f". Each candidate column is quantile-binned into this many groups before the one-way ANOVA is run.3
Returns
TypeDescription
DataFrameSummary DataFrame: parameter, method, statistic,
DataFramep_value, abs_effect_size, rank. Sorted by
DataFrameabs_effect_size descending so the top driver is the first
DataFramerow.
Raises
TypeDescription
ColumnNotFoundErrorIf outcome_column is not in per_run_df (a ValueError subclass).

top_drivers​

methodsource
top_drivers(
per_run_df: pd.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
NameTypeDescriptionDefault
per_run_dfDataFrameOne row per run, one column per candidate parameter, plus an outcome column.required
candidate_columnslist[str]Columns to evaluate as candidate CPPs.required
outcome_columnstrOutcome (response) column.required
methodstr"pearson", "spearman", or "anova_f". Default "spearman".'spearman'
kintMaximum number of significant parameters to return.5
alphafloatSignificance level; only parameters with p_value <= alpha are kept.0.05
anova_binsintOnly used for method="anova_f"; number of quantile bins per candidate column.3
Returns
TypeDescription
DataFrameSame columns as :meth:rank (parameter, method,
DataFramestatistic, p_value, abs_effect_size, rank),
DataFramelimited to at most k significant rows.