Define and Build Labeler Module
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
描述
Write labeler module that retrieves a dataset with sample ID, `y_true` label, and ranked list of predicted codes (`y_pred_list`). sample_id is for real a multi-index. The list is demultiplexed for convenience:
| sample_id | y_true | y_pred | rank |
|-----------|--------|---------|------|
| id1 | A04.5 | A05.3 | 1 |
| id1 | A04.5 | A04.3 | 2 |
| id2 | K21.00 | K21.01 | 1 |
| id2 | K21.00 | L21.00 | 2 |
Check current API of what to expect and to return! Might differ from above description, e.g., distance/similarity might be added.
Behaviour: no columns are disregarded, but two columns the columns (taxonomic) `level` and `label` added, resulting in a labeler that returns for each sample, `y_pred` in `y_pred_list` and taxonomic level: chapter, category, subcategories, extended subcategories (if existing) a label 1 (True) or 0 (False). At most as many levels need to be given as the `y_true` label has or as soon as a descending level is False (as all deeper levels must False too).
Note, that a code can have multiple subcategories, therefore depth is tracked by appending underscore and a counter.
Output: pd.Dataframe in the format
| sample_id | y_true | y_pred | rank | level_category | level_name | label |
|-----------|----------|----------|------|------------------|--------------|-------|
| id1 | A04.5 | A05.3 | 1 | chapter | 1 | True |
| id1 | A04.5 | A05.3 | 1 | category | A04 | False |
| id1 | A04.5 | A04.3 | 2 | chapter | 1 | True |
| id1 | A04.5 | A04.3 | 2 | category | A04 | True |
| id1 | A04.5 | A04.3 | 2 | subcategory_1 | A04.5 | False |
| id2 | K21.00 | K21.01 | 1 | chapter | 11 | True |
| id2 | K21.00 | K21.01 | 1 | category | K21 | True |
| id2 | K21.00 | K21.01 | 1 | subcategory_1 | K21.0 | True |
| id2 | K21.00 | K21.01 | 1 | subcategory_2 | K21.00 | False |
| id2 | K21.00 | L21.00 | 2 | chapter | 11 | False |
level_name can be retrieved via the ICD10 module which provides `get_ancestor_name(code, level_name)`
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。