dqm_ml_core.utils.processor_runner
Processor runner utility for executing metrics on DataFrames.
This module contains the ProcessorRunner class that provides a high-level API for running feature and metric processors directly on Pandas DataFrames.
logger = logging.getLogger(__name__)
module-attribute
ProcessorRunner
Orchestrator for executing metric processors on in-memory Pandas DataFrames.
This class provides a high-level API for users who want to compute metrics directly on DataFrames without using the full YAML-driven pipeline.
Source code in packages/dqm-ml-core/src/dqm_ml_core/utils/processor_runner.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
config = config or {}
instance-attribute
__init__(config: dict[str, Any] | None = None) -> None
Initialize the runner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | None
|
Optional configuration for metric default behaviors. |
None
|
run(df: DataFrame, processors: list[Processor]) -> dict[str, Any]
Execute the provided processors on a DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
The input Pandas DataFrame. |
required |
processors
|
list[Processor]
|
List of initialized Processor instances. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary containing the aggregated dataset-level metrics |
dict[str, Any]
|
and/or per-sample features. Features from FeaturesProcessor |
dict[str, Any]
|
instances are included alongside metrics from MetricsProcessor instances. |
Source code in packages/dqm-ml-core/src/dqm_ml_core/utils/processor_runner.py
run_gap(source_df: DataFrame, target_df: DataFrame, processor: GapProcessor, features: list[Processor] | None = None, source_selection_name: str = 'source', target_selection_name: str = 'target') -> dict[str, Any]
Execute a GapProcessor on two DataFrames and compute the domain gap.
This method handles the two-dataset execution pattern required by GapProcessor: 1. Optionally compute features (e.g. embeddings) on both DataFrames 2. Process source DataFrame to compute source statistics 3. Process target DataFrame to compute target statistics 4. Compute the domain gap delta between source and target
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_df
|
DataFrame
|
The source dataset DataFrame. |
required |
target_df
|
DataFrame
|
The target dataset DataFrame. |
required |
processor
|
GapProcessor
|
An initialized GapProcessor instance. |
required |
features
|
list[Processor] | None
|
Optional list of FeaturesProcessor instances to run on both DataFrames before computing the gap. For example, pass an ImageEmbeddingProcessor to compute embeddings from raw images. |
None
|
source_selection_name
|
str
|
Name for the source selection (default: "source"). |
'source'
|
target_selection_name
|
str
|
Name for the target selection (default: "target"). |
'target'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary containing: |
dict[str, Any]
|
|
dict[str, Any]
|
|
dict[str, Any]
|
|