nexuml_library.scenarios.data.dcase¶
nexuml_library.scenarios.data.dcase
¶
DCASE Task 2 data specification builders.
MachineSpec
¶
Bases: BaseModel
Identifies a DCASE machine type together with the year it was released.
The year determines which dataset subdirectory the files live in
(e.g. year=2023 → dcase2023t2/). data_type is either
"dev" (labelled development set) or "eval" (evaluation set).
dcase_machine_specs
¶
dcase_machine_specs(
machine_types: list[str] | None = None,
years: list[int] | None = None,
data_types: list[str] | None = None,
dedupe_machine_types: bool = False,
) -> list[MachineSpec]
Return known DCASE machine specs from the static scenario catalog.
When dedupe_machine_types is true, keep at most one spec per raw machine
type, preferring eval over dev and newer years over older years.
dcase_data
¶
dcase_data(
data_root: str | Path = "DCASET2",
machine_types: list[str] | None = None,
machine_specs: list[MachineSpec] | None = None,
train_machine_specs: list[MachineSpec] | None = None,
test_machine_specs: list[MachineSpec] | None = None,
years: list[int] | None = None,
data_types: list[str] | None = None,
dedupe_machine_types: bool = False,
download: bool = False,
sample_rate: int = 16000,
clip_num_samples: int = 160000,
batch_size: int = 64,
num_workers: int = 4,
validate_machine_specs: bool = True,
) -> DataSpec
DCASE Task 2 anomaly detection data spec.
Pass machine_specs for explicit multi-year control, or machine_types
to filter the built-in DCASE machine catalog.
Set NEXUML_DATA_ROOT so scenario files can use logical dataset
paths without cluster-specific paths in code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_root
|
str | Path
|
Logical root. Resolved via |
'DCASET2'
|
machine_types
|
list[str] | None
|
Names of machine types to keep from the catalog. |
None
|
machine_specs
|
list[MachineSpec] | None
|
Explicit per-machine year + data_type (multi-year) for both fit and test. |
None
|
train_machine_specs
|
list[MachineSpec] | None
|
Explicit machine specs used only for fit. |
None
|
test_machine_specs
|
list[MachineSpec] | None
|
Explicit machine specs used only for test. |
None
|
years
|
list[int] | None
|
Optional year filter. |
None
|
data_types
|
list[str] | None
|
Optional data type filter, e.g. ["eval"] for additional/eval machines. |
None
|
dedupe_machine_types
|
bool
|
Keep at most one spec per raw machine type, preferring eval/newer year. |
False
|
download
|
bool
|
Download/extract missing Zenodo zips from the DCASE manifest. |
False
|
sample_rate
|
int
|
Audio sample rate in Hz. |
16000
|
clip_num_samples
|
int
|
Samples per audio clip. |
160000
|
batch_size
|
int
|
DataLoader batch size. |
64
|
num_workers
|
int
|
DataLoader workers. |
4
|
validate_machine_specs
|
bool
|
Validate explicit machine_specs against the catalog. Set to False to allow custom/experimental machines not in the catalog. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
DataSpec |
DataSpec
|
DCASE dataset specification with fit and test splits. |