综合评价方法之熵值法
# 正向指标标准化处理
data[["cured_rate", "StringencyIndex", "GovernmentResponseIndex", "ContainmentHealthIndex",
"EconomicSupportIndex"]] = (data[["cured_rate", "StringencyIndex", "GovernmentResponseIndex", "ContainmentHealthIndex",
"EconomicSupportIndex"]]-data[["cured_rate", "StringencyIndex", "GovernmentResponseIndex", "ContainmentHealthIndex",
"EconomicSupportIndex"]].min())/(data[["cured_rate", "StringencyIndex", "GovernmentResponseIndex", "ContainmentHealthIndex",
"EconomicSupportIndex"]].max()-data[["cured_rate", "StringencyIndex", "GovernmentResponseIndex", "ContainmentHealthIndex",
"EconomicSupportIndex"]].min())
# 反向指标标准化处理
data[["confirmed","confirmed_rate","dead_rate"]] = (data[["confirmed","confirmed_rate","dead_rate"]].max() - data[["confirmed","confirmed_rate","dead_rate"]])/(data[["confirmed","confirmed_rate","dead_rate"]].max()-data[["confirmed","confirmed_rate","dead_rate"]].min())
# 计算样本权重,data为标准化后的数据
p = data/data.sum()
# 计算指标熵值
K = 1/np.log(len(p))
e = -K*np.sum(p*np.log(p))
# 计算差异系数
d = 1-e
# 计算指标权重
w = d/d.sum()
# 计算综合得分
score = (w*data).sum(axis=1)