MCPcopy Create free account
hub / github.com/Tencent/digitalhuman / coefficient_of_variation

Function coefficient_of_variation

SWF/src/utils.py:463–479  ·  view source on GitHub ↗

计算给定数据的变异系数(Coefficient of Variation)。 参数: data (list or np.array): 数据 返回: float: 变异系数(以百分比表示)

(data)

Source from the content-addressed store, hash-verified

461 return T
462
463def 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
482index2model = {model['index']: model['model_name'] for model in MODELS if 'index' in model}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected