dataeval-flow 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dataeval_flow/__init__.py +93 -0
- dataeval_flow/__main__.py +149 -0
- dataeval_flow/_app/__init__.py +5 -0
- dataeval_flow/_app/_model/__init__.py +5 -0
- dataeval_flow/_app/_model/_coerce.py +126 -0
- dataeval_flow/_app/_model/_discover.py +171 -0
- dataeval_flow/_app/_model/_execution.py +108 -0
- dataeval_flow/_app/_model/_introspect.py +280 -0
- dataeval_flow/_app/_model/_item.py +213 -0
- dataeval_flow/_app/_model/_registry.py +255 -0
- dataeval_flow/_app/_model/_state.py +322 -0
- dataeval_flow/_app/_model/_undo.py +61 -0
- dataeval_flow/_app/_panes/__init__.py +35 -0
- dataeval_flow/_app/_panes/_config_pane.py +173 -0
- dataeval_flow/_app/_panes/_result_pane.py +125 -0
- dataeval_flow/_app/_panes/_task_pane.py +91 -0
- dataeval_flow/_app/_panes/_widgets.py +111 -0
- dataeval_flow/_app/_screens/__init__.py +25 -0
- dataeval_flow/_app/_screens/_base.py +242 -0
- dataeval_flow/_app/_screens/_detail.py +333 -0
- dataeval_flow/_app/_screens/_model.py +102 -0
- dataeval_flow/_app/_screens/_params.py +80 -0
- dataeval_flow/_app/_screens/_pathpicker.py +68 -0
- dataeval_flow/_app/_screens/_section.py +621 -0
- dataeval_flow/_app/_screens/_settings.py +183 -0
- dataeval_flow/_app/_viewmodel/__init__.py +15 -0
- dataeval_flow/_app/_viewmodel/_builder_vm.py +272 -0
- dataeval_flow/_app/_viewmodel/_model_vm.py +70 -0
- dataeval_flow/_app/_viewmodel/_rendering.py +189 -0
- dataeval_flow/_app/_viewmodel/_result_vm.py +210 -0
- dataeval_flow/_app/_viewmodel/_section_vm.py +224 -0
- dataeval_flow/_app/app.py +742 -0
- dataeval_flow/_app/cli.py +592 -0
- dataeval_flow/_logging.py +102 -0
- dataeval_flow/cache.py +1355 -0
- dataeval_flow/config/__init__.py +80 -0
- dataeval_flow/config/_loader.py +79 -0
- dataeval_flow/config/_merge.py +92 -0
- dataeval_flow/config/_models.py +115 -0
- dataeval_flow/config/_paths.py +85 -0
- dataeval_flow/config/schemas/__init__.py +112 -0
- dataeval_flow/config/schemas/_dataset.py +111 -0
- dataeval_flow/config/schemas/_extractor.py +119 -0
- dataeval_flow/config/schemas/_metadata.py +28 -0
- dataeval_flow/config/schemas/_preprocessor.py +18 -0
- dataeval_flow/config/schemas/_selection.py +100 -0
- dataeval_flow/config/schemas/_task.py +89 -0
- dataeval_flow/config/schemas/_workflow.py +135 -0
- dataeval_flow/dataset.py +635 -0
- dataeval_flow/embeddings.py +135 -0
- dataeval_flow/metadata.py +48 -0
- dataeval_flow/preprocessing.py +141 -0
- dataeval_flow/py.typed +0 -0
- dataeval_flow/runner.py +118 -0
- dataeval_flow/selection.py +50 -0
- dataeval_flow/workflow/__init__.py +328 -0
- dataeval_flow/workflow/_text_report.py +511 -0
- dataeval_flow/workflow/base.py +69 -0
- dataeval_flow/workflow/orchestrator.py +454 -0
- dataeval_flow/workflows/__init__.py +1 -0
- dataeval_flow/workflows/analysis/__init__.py +38 -0
- dataeval_flow/workflows/analysis/outputs.py +202 -0
- dataeval_flow/workflows/analysis/params.py +114 -0
- dataeval_flow/workflows/analysis/workflow.py +1313 -0
- dataeval_flow/workflows/cleaning/__init__.py +23 -0
- dataeval_flow/workflows/cleaning/outputs.py +200 -0
- dataeval_flow/workflows/cleaning/params.py +160 -0
- dataeval_flow/workflows/cleaning/report.py +304 -0
- dataeval_flow/workflows/cleaning/workflow.py +794 -0
- dataeval_flow/workflows/drift/__init__.py +1 -0
- dataeval_flow/workflows/drift/outputs.py +144 -0
- dataeval_flow/workflows/drift/params.py +332 -0
- dataeval_flow/workflows/drift/report.py +201 -0
- dataeval_flow/workflows/drift/workflow.py +647 -0
- dataeval_flow/workflows/ood/__init__.py +1 -0
- dataeval_flow/workflows/ood/outputs.py +134 -0
- dataeval_flow/workflows/ood/params.py +161 -0
- dataeval_flow/workflows/ood/report.py +311 -0
- dataeval_flow/workflows/ood/workflow.py +728 -0
- dataeval_flow/workflows/prioritization/__init__.py +1 -0
- dataeval_flow/workflows/prioritization/outputs.py +122 -0
- dataeval_flow/workflows/prioritization/params.py +124 -0
- dataeval_flow/workflows/prioritization/report.py +117 -0
- dataeval_flow/workflows/prioritization/workflow.py +587 -0
- dataeval_flow/workflows/splitting/__init__.py +25 -0
- dataeval_flow/workflows/splitting/outputs.py +101 -0
- dataeval_flow/workflows/splitting/params.py +61 -0
- dataeval_flow/workflows/splitting/report.py +485 -0
- dataeval_flow/workflows/splitting/workflow.py +371 -0
- dataeval_flow-0.1.0.dist-info/METADATA +305 -0
- dataeval_flow-0.1.0.dist-info/RECORD +94 -0
- dataeval_flow-0.1.0.dist-info/WHEEL +4 -0
- dataeval_flow-0.1.0.dist-info/entry_points.txt +2 -0
- dataeval_flow-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"""Extractor configuration schemas — one class per model type."""
|
|
2
|
+
|
|
3
|
+
from typing import ClassVar, Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
6
|
+
|
|
7
|
+
from dataeval_flow.config._paths import validate_config_path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class _ExtractorConfigBase(BaseModel):
|
|
11
|
+
"""Common fields shared by all extractor model types."""
|
|
12
|
+
|
|
13
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
14
|
+
|
|
15
|
+
name: str = Field(description="Identifier for the extractor")
|
|
16
|
+
preprocessor: str | None = Field(default=None, description="Reference to a preprocessor name (optional)")
|
|
17
|
+
batch_size: int | None = Field(default=None, description="Batch size for embedding extraction")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class OnnxExtractorConfig(_ExtractorConfigBase):
|
|
21
|
+
"""Extractor config for ONNX models.
|
|
22
|
+
|
|
23
|
+
YAML example::
|
|
24
|
+
|
|
25
|
+
extractors:
|
|
26
|
+
- name: resnet_extractor
|
|
27
|
+
model: onnx
|
|
28
|
+
model_path: "./resnet50.onnx"
|
|
29
|
+
output_name: "flatten0"
|
|
30
|
+
preprocessor: resnet_preprocess
|
|
31
|
+
batch_size: 64
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
model: Literal["onnx"] = "onnx"
|
|
35
|
+
model_path: str = Field(description="Path to ONNX model file (relative to data root).")
|
|
36
|
+
output_name: str | None = Field(default=None, description="Output layer name.")
|
|
37
|
+
flatten: bool = Field(default=True, description="Flatten output to (N, D) shape.")
|
|
38
|
+
|
|
39
|
+
@field_validator("model_path")
|
|
40
|
+
@classmethod
|
|
41
|
+
def _model_path_must_be_relative(cls, v: str) -> str:
|
|
42
|
+
return validate_config_path(v)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class BoVWExtractorConfig(_ExtractorConfigBase):
|
|
46
|
+
"""Extractor config for Bag-of-Visual-Words.
|
|
47
|
+
|
|
48
|
+
YAML example::
|
|
49
|
+
|
|
50
|
+
extractors:
|
|
51
|
+
- name: bovw_extractor
|
|
52
|
+
model: bovw
|
|
53
|
+
vocab_size: 1024
|
|
54
|
+
batch_size: 32
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
model: Literal["bovw"] = "bovw"
|
|
58
|
+
vocab_size: int = Field(default=2048, ge=256, le=4096, description="Visual word count.")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class FlattenExtractorConfig(_ExtractorConfigBase):
|
|
62
|
+
"""Extractor config for simple flattening (no model).
|
|
63
|
+
|
|
64
|
+
YAML example::
|
|
65
|
+
|
|
66
|
+
extractors:
|
|
67
|
+
- name: flat_extractor
|
|
68
|
+
model: flatten
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
model: Literal["flatten"] = "flatten"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class TorchExtractorConfig(_ExtractorConfigBase):
|
|
75
|
+
"""Extractor config for PyTorch models.
|
|
76
|
+
|
|
77
|
+
YAML example::
|
|
78
|
+
|
|
79
|
+
extractors:
|
|
80
|
+
- name: torch_extractor
|
|
81
|
+
model: torch
|
|
82
|
+
model_path: "./resnet.pt"
|
|
83
|
+
layer_name: layer4
|
|
84
|
+
device: cpu
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
model: Literal["torch"] = "torch"
|
|
88
|
+
model_path: str = Field(description="Path to PyTorch model file (relative to data root).")
|
|
89
|
+
layer_name: str | None = Field(default=None, description="Layer for forward hook extraction.")
|
|
90
|
+
use_output: bool = Field(default=True, description="Capture layer output (True) or input (False).")
|
|
91
|
+
device: str | None = Field(default=None, description="Device (e.g., 'cpu', 'cuda:0').")
|
|
92
|
+
|
|
93
|
+
@field_validator("model_path")
|
|
94
|
+
@classmethod
|
|
95
|
+
def _model_path_must_be_relative(cls, v: str) -> str:
|
|
96
|
+
return validate_config_path(v)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class UncertaintyExtractorConfig(_ExtractorConfigBase):
|
|
100
|
+
"""Extractor config for uncertainty estimation models.
|
|
101
|
+
|
|
102
|
+
YAML example::
|
|
103
|
+
|
|
104
|
+
extractors:
|
|
105
|
+
- name: unc_extractor
|
|
106
|
+
model: uncertainty
|
|
107
|
+
model_path: "./classifier.pt"
|
|
108
|
+
preds_type: logits
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
model: Literal["uncertainty"] = "uncertainty"
|
|
112
|
+
model_path: str = Field(description="Path to model file (relative to data root).")
|
|
113
|
+
preds_type: Literal["probs", "logits"] | None = Field(default=None, description="Model output format.")
|
|
114
|
+
device: str | None = Field(default=None, description="Device (e.g., 'cpu', 'cuda:0').")
|
|
115
|
+
|
|
116
|
+
@field_validator("model_path")
|
|
117
|
+
@classmethod
|
|
118
|
+
def _model_path_must_be_relative(cls, v: str) -> str:
|
|
119
|
+
return validate_config_path(v)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Result metadata schema for JATIC compliance [IR-3-H-12]."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from datetime import datetime, timezone
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ResultMetadata(BaseModel):
|
|
11
|
+
"""Base metadata envelope for workflow results.
|
|
12
|
+
|
|
13
|
+
Contains JATIC-required fields (version, timestamp, tool info,
|
|
14
|
+
dataset identifiers).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
version: str = "1.0"
|
|
18
|
+
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
19
|
+
dataset_id: str | Sequence[str] = ""
|
|
20
|
+
label_source: str | None = None
|
|
21
|
+
model_id: str | None = None
|
|
22
|
+
preprocessor_id: str | None = None
|
|
23
|
+
selection_id: str | None = None
|
|
24
|
+
source_descriptions: Sequence[str] = ()
|
|
25
|
+
resolved_config: dict[str, Any] = Field(default_factory=dict)
|
|
26
|
+
tool: str = "dataeval-flow"
|
|
27
|
+
tool_version: str = ""
|
|
28
|
+
execution_time_s: float | None = None
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Preprocessor configuration schema."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel
|
|
6
|
+
|
|
7
|
+
from dataeval_flow.preprocessing import PreprocessingStep
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PreprocessorConfig(BaseModel):
|
|
11
|
+
"""Named preprocessor pipeline configuration.
|
|
12
|
+
|
|
13
|
+
Steps can be torchvision transforms (serializable, YAML-configurable)
|
|
14
|
+
or arbitrary callables (programmatic only).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
name: str
|
|
18
|
+
steps: Sequence[PreprocessingStep]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Selection configuration schema."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping, Sequence
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field, model_validator
|
|
7
|
+
|
|
8
|
+
_MAX_INDICES_RANGE = 1_000_000
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SelectionStep(BaseModel):
|
|
12
|
+
"""Single selection step - pass-through to dataeval.selection.
|
|
13
|
+
|
|
14
|
+
See: https://dataeval.readthedocs.io/en/latest/reference/autoapi/dataeval/selection/index.html
|
|
15
|
+
|
|
16
|
+
The ``indices`` param supports a range shorthand so that contiguous
|
|
17
|
+
index spans do not need to be enumerated in config files::
|
|
18
|
+
|
|
19
|
+
# Expanded form (still supported)
|
|
20
|
+
params:
|
|
21
|
+
indices: [500, 501, 502, ..., 549]
|
|
22
|
+
|
|
23
|
+
# Range shorthand
|
|
24
|
+
params:
|
|
25
|
+
indices: {start: 500, stop: 550}
|
|
26
|
+
|
|
27
|
+
# Range with step
|
|
28
|
+
params:
|
|
29
|
+
indices: {start: 0, stop: 100, step: 2}
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
type: str = Field(description="Selection class from dataeval.selection")
|
|
33
|
+
params: Mapping[str, Any] = Field(
|
|
34
|
+
default_factory=dict,
|
|
35
|
+
json_schema_extra={
|
|
36
|
+
"properties": {
|
|
37
|
+
"indices": {
|
|
38
|
+
"anyOf": [
|
|
39
|
+
{"type": "array", "items": {"type": "integer"}},
|
|
40
|
+
{
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"start": {"type": "integer"},
|
|
44
|
+
"stop": {"type": "integer"},
|
|
45
|
+
"step": {"type": "integer"},
|
|
46
|
+
},
|
|
47
|
+
"required": ["start", "stop"],
|
|
48
|
+
"additionalProperties": False,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
"description": "Indices as a list or {start, stop[, step]} range shorthand.",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
@model_validator(mode="before")
|
|
58
|
+
@classmethod
|
|
59
|
+
def _expand_range_params(cls, data: Any) -> Any:
|
|
60
|
+
"""Expand ``indices: {start, stop[, step]}`` into a list of ints."""
|
|
61
|
+
if not isinstance(data, dict): # pragma: no cover — Pydantic v2 rejects non-dict before reaching here
|
|
62
|
+
return data
|
|
63
|
+
params = data.get("params")
|
|
64
|
+
if not isinstance(params, dict):
|
|
65
|
+
return data
|
|
66
|
+
indices = params.get("indices")
|
|
67
|
+
if isinstance(indices, dict):
|
|
68
|
+
allowed = {"start", "stop", "step"}
|
|
69
|
+
extra = set(indices) - allowed
|
|
70
|
+
if extra:
|
|
71
|
+
raise ValueError(
|
|
72
|
+
f"Invalid keys in indices range shorthand: {extra}. "
|
|
73
|
+
f"Allowed keys are {allowed} (matching Python's range())."
|
|
74
|
+
)
|
|
75
|
+
if "start" not in indices or "stop" not in indices:
|
|
76
|
+
raise ValueError("indices range shorthand requires both 'start' and 'stop' keys.")
|
|
77
|
+
r = range(
|
|
78
|
+
indices["start"],
|
|
79
|
+
indices["stop"],
|
|
80
|
+
indices.get("step", 1),
|
|
81
|
+
)
|
|
82
|
+
if len(r) > _MAX_INDICES_RANGE:
|
|
83
|
+
raise ValueError(
|
|
84
|
+
f"indices range expands to {len(r):,} elements "
|
|
85
|
+
f"(max {_MAX_INDICES_RANGE:,}). Use a smaller range or load indices from a file."
|
|
86
|
+
)
|
|
87
|
+
params = dict(params)
|
|
88
|
+
params["indices"] = list(r)
|
|
89
|
+
data = {**data, "params": params}
|
|
90
|
+
return data
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class SelectionConfig(BaseModel):
|
|
94
|
+
"""Named selection pipeline configuration.
|
|
95
|
+
|
|
96
|
+
Similar to PreprocessorConfig - defines reusable selection pipelines.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
name: str
|
|
100
|
+
steps: Sequence[SelectionStep]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""Task configuration schema."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field, model_validator
|
|
7
|
+
|
|
8
|
+
AutoBinMethod = Literal["uniform_width", "uniform_count", "clusters"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TaskConfig(BaseModel):
|
|
12
|
+
"""Task/workflow configuration schema.
|
|
13
|
+
|
|
14
|
+
Tasks reference sources (dataset+selection bundles) and an optional
|
|
15
|
+
extractor (model+preprocessor+batch_size bundle) by name.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
name: str
|
|
19
|
+
workflow: str # reference to WorkflowConfig.name (e.g. "clean_zscore_stats")
|
|
20
|
+
enabled: bool = Field(default=True, description="Whether this task is included when running the pipeline.")
|
|
21
|
+
sources: str | Sequence[str] # reference to SourceConfig.name
|
|
22
|
+
extractor: str | None = None # reference to ExtractorConfig.name
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class MultiSourceTaskConfig(TaskConfig):
|
|
26
|
+
"""TaskConfig subclass that validates multiple sources/datasets for drift/ood tasks.
|
|
27
|
+
|
|
28
|
+
Validates that at least two sources are specified (reference + test).
|
|
29
|
+
The ``workflow`` field references a workflow instance whose type must
|
|
30
|
+
be either ``drift-monitoring`` or ``ood-detection`` — enforced at runtime
|
|
31
|
+
by the orchestrator.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
@model_validator(mode="after")
|
|
35
|
+
def _require_multiple_sources(self) -> "MultiSourceTaskConfig":
|
|
36
|
+
srcs = self.sources if isinstance(self.sources, list) else [self.sources]
|
|
37
|
+
if len(srcs) < 2:
|
|
38
|
+
raise ValueError(f"{self.workflow} requires at least 2 sources (reference + test), got {len(srcs)}: {srcs}")
|
|
39
|
+
return self
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class DataAnalysisTaskConfig(TaskConfig):
|
|
43
|
+
"""Task config for ``data-analysis`` workflows.
|
|
44
|
+
|
|
45
|
+
A typed subclass of :class:`TaskConfig` that enables typed overloads
|
|
46
|
+
on :func:`~dataeval_flow.workflow.orchestrator.run_tasks`, returning a
|
|
47
|
+
result with full access to analysis-specific metadata.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class DataCleaningTaskConfig(TaskConfig):
|
|
52
|
+
"""Task config for ``data-cleaning`` workflows.
|
|
53
|
+
|
|
54
|
+
A typed subclass of :class:`TaskConfig` that enables typed overloads
|
|
55
|
+
on :func:`~dataeval_flow.workflow.orchestrator.run_tasks`, returning a
|
|
56
|
+
:class:`~dataeval_flow.workflows.cleaning.outputs.DataCleaningResult`
|
|
57
|
+
with full access to cleaning-specific metadata (``mode``,
|
|
58
|
+
``clean_indices``, ``flagged_indices``, ``removed_count``).
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class DataSplittingTaskConfig(TaskConfig):
|
|
63
|
+
"""Task config for ``data-splitting`` workflows."""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class DriftMonitoringTaskConfig(MultiSourceTaskConfig):
|
|
67
|
+
"""Task config that validates drift-monitoring constraints.
|
|
68
|
+
|
|
69
|
+
Validates that at least two sources are specified (reference + test).
|
|
70
|
+
The ``workflow`` field references a workflow instance whose type must
|
|
71
|
+
be ``drift-monitoring`` — enforced at runtime by the orchestrator.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class OODDetectionTaskConfig(MultiSourceTaskConfig):
|
|
76
|
+
"""Task config that validates OOD detection constraints.
|
|
77
|
+
|
|
78
|
+
Validates that at least two datasets are specified (reference + test).
|
|
79
|
+
The ``workflow`` field references a workflow instance whose type must
|
|
80
|
+
be ``ood-detection`` — enforced at runtime by the orchestrator.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class DataPrioritizationTaskConfig(MultiSourceTaskConfig):
|
|
85
|
+
"""Task config for ``data-prioritization`` workflows.
|
|
86
|
+
|
|
87
|
+
Requires at least two sources: a reference (labeled) dataset and one
|
|
88
|
+
or more additional datasets to prioritize for labeling.
|
|
89
|
+
"""
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Workflow configuration schemas — one class per workflow type."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from dataeval_flow.workflows.analysis.params import DataAnalysisParameters
|
|
8
|
+
from dataeval_flow.workflows.cleaning.params import DataCleaningParameters
|
|
9
|
+
from dataeval_flow.workflows.drift.params import DriftMonitoringParameters
|
|
10
|
+
from dataeval_flow.workflows.ood.params import OODDetectionParameters
|
|
11
|
+
from dataeval_flow.workflows.prioritization.params import DataPrioritizationParameters
|
|
12
|
+
from dataeval_flow.workflows.splitting.params import DataSplittingParameters
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DataAnalysisWorkflowConfig(DataAnalysisParameters):
|
|
16
|
+
"""Typed workflow configuration for ``data-analysis``.
|
|
17
|
+
|
|
18
|
+
Inherits all fields from :class:`DataAnalysisParameters` — no ``params``
|
|
19
|
+
nesting required.
|
|
20
|
+
|
|
21
|
+
Example YAML::
|
|
22
|
+
|
|
23
|
+
workflows:
|
|
24
|
+
- name: cppe5_analysis
|
|
25
|
+
type: data-analysis
|
|
26
|
+
outlier_method: zscore
|
|
27
|
+
outlier_flags: [dimension, pixel, visual]
|
|
28
|
+
balance: true
|
|
29
|
+
diversity_method: simpson
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
name: str = Field(description="Identifier for this workflow")
|
|
33
|
+
type: Literal["data-analysis"] = "data-analysis"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class DataCleaningWorkflowConfig(DataCleaningParameters):
|
|
37
|
+
"""Typed workflow configuration for ``data-cleaning``.
|
|
38
|
+
|
|
39
|
+
Inherits all fields from :class:`DataCleaningParameters` — no ``params``
|
|
40
|
+
nesting required.
|
|
41
|
+
|
|
42
|
+
Example YAML::
|
|
43
|
+
|
|
44
|
+
workflows:
|
|
45
|
+
- name: clean_zscore_stats
|
|
46
|
+
type: data-cleaning
|
|
47
|
+
outlier_method: zscore
|
|
48
|
+
outlier_flags: [pixel, visual]
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
name: str = Field(description="Identifier for this workflow")
|
|
52
|
+
type: Literal["data-cleaning"] = "data-cleaning"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class DataSplittingWorkflowConfig(DataSplittingParameters):
|
|
56
|
+
"""Typed workflow configuration for ``data-splitting``.
|
|
57
|
+
|
|
58
|
+
Inherits all fields from :class:`DataSplittingParameters` — no ``params``
|
|
59
|
+
nesting required.
|
|
60
|
+
|
|
61
|
+
Example YAML::
|
|
62
|
+
|
|
63
|
+
workflows:
|
|
64
|
+
- name: split_stratified
|
|
65
|
+
type: data-splitting
|
|
66
|
+
test_frac: 0.2
|
|
67
|
+
val_frac: 0.1
|
|
68
|
+
stratify: true
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
name: str = Field(description="Identifier for this workflow")
|
|
72
|
+
type: Literal["data-splitting"] = "data-splitting"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class DriftMonitoringWorkflowConfig(DriftMonitoringParameters):
|
|
76
|
+
"""Typed workflow configuration for ``drift-monitoring``.
|
|
77
|
+
|
|
78
|
+
Inherits all fields from :class:`DriftMonitoringParameters` — no ``params``
|
|
79
|
+
nesting required.
|
|
80
|
+
|
|
81
|
+
Example YAML::
|
|
82
|
+
|
|
83
|
+
workflows:
|
|
84
|
+
- name: drift_knn
|
|
85
|
+
type: drift-monitoring
|
|
86
|
+
detectors:
|
|
87
|
+
- method: kneighbors
|
|
88
|
+
k: 10
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
name: str = Field(description="Identifier for this workflow")
|
|
92
|
+
type: Literal["drift-monitoring"] = "drift-monitoring"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class OODDetectionWorkflowConfig(OODDetectionParameters):
|
|
96
|
+
"""Typed workflow configuration for ``ood-detection``.
|
|
97
|
+
|
|
98
|
+
Inherits all fields from :class:`OODDetectionParameters` — no ``params``
|
|
99
|
+
nesting required.
|
|
100
|
+
|
|
101
|
+
Example YAML::
|
|
102
|
+
|
|
103
|
+
workflows:
|
|
104
|
+
- name: ood_knn
|
|
105
|
+
type: ood-detection
|
|
106
|
+
detectors:
|
|
107
|
+
- method: kneighbors
|
|
108
|
+
k: 10
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
name: str = Field(description="Identifier for this workflow")
|
|
112
|
+
type: Literal["ood-detection"] = "ood-detection"
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class DataPrioritizationWorkflowConfig(DataPrioritizationParameters):
|
|
116
|
+
"""Typed workflow configuration for ``data-prioritization``.
|
|
117
|
+
|
|
118
|
+
Inherits all fields from :class:`DataPrioritizationParameters` — no ``params``
|
|
119
|
+
nesting required.
|
|
120
|
+
|
|
121
|
+
Example YAML::
|
|
122
|
+
|
|
123
|
+
workflows:
|
|
124
|
+
- name: prioritize_knn
|
|
125
|
+
type: data-prioritization
|
|
126
|
+
method: knn
|
|
127
|
+
k: 10
|
|
128
|
+
order: hard_first
|
|
129
|
+
cleaning:
|
|
130
|
+
outlier_method: adaptive
|
|
131
|
+
outlier_flags: [dimension, pixel]
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
name: str = Field(description="Identifier for this workflow")
|
|
135
|
+
type: Literal["data-prioritization"] = "data-prioritization"
|