计算给定数据的变异系数(Coefficient of Variation)。 参数: data (list or np.array): 数据 返回: float: 变异系数(以百分比表示)
(data)
| 461 | return T |
| 462 | |
| 463 | def coefficient_of_variation(data): |
| 464 | """ |
| 465 | 计算给定数据的变异系数(Coefficient of Variation)。 |
| 466 | |
| 467 | 参数: |
| 468 | data (list or np.array): 数据 |
| 469 | |
| 470 | 返回: |
| 471 | float: 变异系数(以百分比表示) |
| 472 | """ |
| 473 | data = np.array(data) |
| 474 | mean = np.mean(data) # 计算均值 |
| 475 | std_dev = np.std(data) # 计算标准差 |
| 476 | |
| 477 | # 计算变异系数 |
| 478 | cv = (std_dev / mean) * 100 # 以百分比表示 |
| 479 | return cv |
| 480 | |
| 481 | |
| 482 | index2model = {model['index']: model['model_name'] for model in MODELS if 'index' in model} |
nothing calls this directly
no outgoing calls
no test coverage detected