icentia_mini
Classes
IcentiaMiniRhythm
Icentia rhythm labels
IcentiaMiniBeat
Incentia mini beat labels
IcentiaMiniDataset
Icentia-mini dataset
Source code in heartkit/datasets/icentia_mini.py
Attributes
patient_ids
property
Functions
get_train_patient_ids
get_test_patient_ids
label_key
Get label key
Parameters:
-
label_type
(str
, default:'rhythm'
) –Label type. Defaults to "rhythm".
Returns:
-
str
(str
) –Label key
Source code in heartkit/datasets/icentia_mini.py
patient_data
Get patient data
Parameters:
-
patient_id
(int
) –Patient ID
Returns:
-
None
–Generator[h5py.Group, None, None]: Patient data
Source code in heartkit/datasets/icentia_mini.py
signal_generator
signal_generator(
patient_generator: PatientGenerator, frame_size: int, samples_per_patient: int = 1, target_rate: int | None = None
) -> Generator[npt.NDArray, None, None]
Generate random frames.
Parameters:
-
patient_generator
(PatientGenerator
) –Generator that yields patient data.
-
frame_size
(int
) –Frame size
-
samples_per_patient
(int
, default:1
) –Samples per patient. Defaults to 1.
-
target_rate
(int | None
, default:None
) –Target rate. Defaults to None.
Returns:
-
SampleGenerator
(None
) –Generator of input data of shape (frame_size, 1)
Source code in heartkit/datasets/icentia_mini.py
download
Download dataset
This will download preprocessed HDF5 files from S3.
Parameters:
-
num_workers
(int | None
, default:None
) –parallel workers. Defaults to None.
-
force
(bool
, default:False
) –Force redownload. Defaults to False.
Source code in heartkit/datasets/icentia_mini.py
split_train_test_patients
split_train_test_patients(
patient_ids: npt.NDArray, test_size: float, label_map: dict[int, int] | None = None, label_type: str | None = None
) -> list[list[int]]
Perform train/test split on patients for given task.
Parameters:
-
patient_ids
(NDArray
) –Patient Ids
-
test_size
(float
) –Test size
-
label_map
(dict[int, int]
, default:None
) –Label map. Defaults to None.
-
label_type
(str
, default:None
) –Label type. Defaults to None.
Returns:
Source code in heartkit/datasets/icentia_mini.py
filter_patients_for_labels
filter_patients_for_labels(
patient_ids: npt.NDArray, label_map: dict[int, int] | None = None, label_type: str | None = None
) -> npt.NDArray
Filter patients based on labels. Useful to remove patients w/o labels for task to speed up data loading.
Parameters:
-
patient_ids
(NDArray
) –Patient ids
-
label_map
(dict[int, int]
, default:None
) –Label map. Defaults to None.
-
label_type
(str
, default:None
) –Label type. Defaults to None.
Returns:
-
NDArray
–npt.NDArray: Filtered patient ids
Source code in heartkit/datasets/icentia_mini.py
get_patients_labels
get_patients_labels(patient_ids: npt.NDArray, label_map: dict[int, int], label_type: str = 'rhythm') -> list[list[int]]
Get class labels for each patient
Parameters:
-
patient_ids
(NDArray
) –Patient ids
-
label_map
(dict[int, int]
) –Label map
-
label_type
(str
, default:'rhythm'
) –Label type. Defaults to "rhythm".
Returns:
Source code in heartkit/datasets/icentia_mini.py
get_patient_labels
get_patient_labels(patient_id: int, label_map: dict[int, int], label_type: str = 'rhythm') -> list[int]
Get class labels for patient
Parameters:
-
patient_id
(int
) –Patient id
-
label_map
(dict[int, int]
) –Label map
-
label_type
(str
, default:'rhythm'
) –Label type. Defaults to "rhythm".
Returns: