简介
色综合评价法是针对复杂大系统进行效能评估时**,信息不完备,不全面不充分**的情况所提出的一种评估方法,是基于灰色关联度分析。
类型可分为单层次,灰色综合评价和多层次灰色综合评价
1、先确定最优指标集。
指标及要注意,**正向指标**、**负向指标**。
2、构造原始矩阵。
原始矩阵是指:评价对象在不同指标下组成的矩阵
3、数据无量纲化处理。
要把最优指标矩阵和原始矩阵**结合在一**起,共同无量纲化。
4、算灰色关联系数矩阵R。
5、确定各评价指标的权重矩阵 W。
各评价指标的权重矩阵可由:**因子分析、熵权法、层次分析法、Topsis**得到
6、计算灰色关联度矩阵A。
**A = W×R_T**
灰色关联度越大,说明其相应的评价对象越接近于最优,质量据此便可排除客评价对象的优劣顺序。
import numpy as np
from sklearn import datasets
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def Grey_paramters (bases,x,rho):
def Grey_paramter(base,x,rho=0.5):#对于一个参考数列
min_min = np.min(np.abs(x-base),axis=1).min()
max_max = np.max(np.abs(x-base),axis=1).max()
grey_paramter = []
for j in x:#计算每一个评价指标的chacy
chacy = []
for k in range(x.shape[0]):
chacy_k = (min_min + rho* max_max )/(np.abs(base.reshape(-1)[k]-j.reshape(-1)[k])+rho*max_max)
chacy.append(chacy_k)
grey_paramter.append(np.array(chacy).mean())
return np.array([grey_paramter]).T
grey_paramters = np.zeros((x.shape[0],1))
grey_paramters = []
for base in bases :
single_refer_paramter = Grey_paramter(base,x)
grey_paramters.append(single_refer_paramter)
return np.array(grey_paramters).T[0]
x,label = datasets.make_blobs(10,10,centers=1,random_state=10)
df = pd.DataFrame(Grey_paramters(x,x=x,rho=0.5))#,index = ['A','B','C','D'],columns=['指标1','指标2','指标3','指标4'])
plt.rcParams['font.sans-serif']='SimHei'
plt.rcParams['axes.unicode_minus']=False
sns.heatmap(df,cmap = 'Reds',linewidths=1)
plt.show()
计算出关联度矩阵,然后去定权重
A = W 点成 R的转置