cafe.metric.metric_correlation
cafe.metric.metric_correlation
calculate_correlation(fadata, ref_model='ref', pred_model='default', return_type='score')
计算两条已添加 waypoint 的轨迹(ref_model vs pred_model)之间的地理距离 Spearman 相关性。 两个模型和它们对应的 waypoint_wrapper 都存储在同一个 FateAnnData.uns["cafe"]['trajectory_history_dict'] 中。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fadata
|
FateAnnData
|
已经对多条轨迹都调用过 add_trajectory() 和 add_waypoints() 的 FateAnnData。 |
required |
ref_model
|
str
|
参考模型的 key(trajectory_history_dict 中的字典键)。 |
'ref'
|
pred_model
|
str
|
预测模型的 key。 |
'default'
|
Returns:
| Name | Type | Description |
|---|---|---|
metrics |
float | Dict[str, float]
|
{ 'correlation': float, 'time_waypoint_geodesic_ref': float, 'time_waypoint_geodesic_pred': float, 'time_correlation': float |
float | Dict[str, float]
|
} |
|
float | Dict[str, float]
|
若任一模型不存在或未生成 waypoint_wrapper,则直接返回 {'correlation': 0.0}。 |
Source code in cafe/metric/metric_correlation.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |