Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Dataset Usage
|
2 |
+
|
3 |
+
## Description
|
4 |
+
|
5 |
+
The `load_dataset` function is a powerful tool to efficiently load and prepare the Mimic-IV dataset for various healthcare analysis tasks. It offers a wide range of options for encoding data and generating cohorts, allowing for seamless integration into your research or application.
|
6 |
+
|
7 |
+
## Function Signature
|
8 |
+
|
9 |
+
```python
|
10 |
+
load_dataset('thbndi/Mimic4Dataset', task, mimic_path=mimic_data, config_path=config_file, encoding=encod, generate_cohort=gen_cohort, val_size=size, cache_dir=cache)
|
11 |
+
```
|
12 |
+
|
13 |
+
## Arguments
|
14 |
+
|
15 |
+
1. `task` (string) :
|
16 |
+
- Description: Specifies the task you want to perform with the dataset.
|
17 |
+
- Default: "Mortality"
|
18 |
+
- Note: Possible Values : 'Phenotype', 'Length of Stay', 'Readmission', 'Mortality'
|
19 |
+
|
20 |
+
2. `mimic_path` (string) :
|
21 |
+
- Description: Complete path to the Mimic-IV raw data on user's machine.
|
22 |
+
- Note: You need to provide the appropriate path where the Mimic-IV data is stored.
|
23 |
+
|
24 |
+
3. `config_path` (string) optionnal :
|
25 |
+
- Description: Path to the configuration file for the cohort generation choices (more infos in '/config/readme.md').
|
26 |
+
- Default: Configuration file provided in the 'config' folder.
|
27 |
+
|
28 |
+
4. `encoding` (string) optionnal :
|
29 |
+
- Description: Data encoding option for the features.
|
30 |
+
- Options: "concat", "aggreg", "tensor", "raw", "text"
|
31 |
+
- Default: "concat"
|
32 |
+
- Note: Choose one of the following options for data encoding:
|
33 |
+
- "concat": Concatenates the one-hot encoded diagnoses, demographic data vector, and dynamic features at each measured time instant, resulting in a high-dimensional feature vector.
|
34 |
+
- "aggreg": Concatenates the one-hot encoded diagnoses, demographic data vector, and dynamic features, where each item_id is replaced by the average of the measured time instants, resulting in a reduced-dimensional feature vector.
|
35 |
+
- "tensor": Represents each feature as an 2D array. There are separate arrays for labels, demographic data ('DEMO'), diagnosis ('COND'), medications ('MEDS'), procedures ('PROC'), chart/lab events ('CHART/LAB'), and output events data ('OUT'). Dynamic features are represented as 2D arrays where each row contains values at a specific time instant.
|
36 |
+
- "raw": Provide cohort from the pipeline without any encoding for custom data processing.
|
37 |
+
- "text": Represents diagnoses as text suitable for BERT or other similar text-based models.
|
38 |
+
|
39 |
+
5. `generate_cohort` (bool) optionnal :
|
40 |
+
- Description: Determines whether to generate a new cohort from Mimic-IV data.
|
41 |
+
- Default: True
|
42 |
+
- Note: Set it to True to generate a cohort, or False to skip cohort generation.
|
43 |
+
|
44 |
+
6. `val_size`, 'test_size' (float) optionnal :
|
45 |
+
- Description: Proportion of the dataset used for validation during training.
|
46 |
+
- Default: 0.1 for validation size and 0.2 for testing size.
|
47 |
+
- Note: Can be set to 0.
|
48 |
+
|
49 |
+
7. `cache_dir` (string) optionnal :
|
50 |
+
- Description: Directory where the processed dataset will be cached.
|
51 |
+
- Note: Providing a cache directory for each encoding type can avoid errors when changing the encoding type.
|
52 |
+
|
53 |
+
## Example Usage
|
54 |
+
|
55 |
+
```python
|
56 |
+
from your_module import load_dataset
|
57 |
+
|
58 |
+
# Example 1: Load dataset with default settings
|
59 |
+
dataset = load_dataset('thbndi/Mimic4Dataset', task="Mortality")
|
60 |
+
|
61 |
+
# Example 2: Load dataset with custom settings
|
62 |
+
dataset = load_dataset('thbndi/Mimic4Dataset', task="Phenotype", mimic_path="/path/to/mimic_data", config_path="/path/to/config_file", encoding="aggreg", generate_cohort=False, val_size=0.2, cache_dir="/path/to/cache_dir")
|
63 |
+
```
|
64 |
+
|
65 |
+
Please note that the provided examples are for illustrative purposes only, and you should adjust the paths and settings based on your actual dataset and specific use case.
|