我发现在这种情况下TOPSIS或WeightedSum都不起作用...这是完整的代码:
from skcriteria import Data, MIN, MAX
from skcriteria.madm import closeness, simple
import pandas as pd
from pandas.compat import StringIO
txt=''' SINNOUVEAU PERTETOTAL CHANGGARAN SOCLOCATIO SINISAMEDI NOMASCONDU SINIREPET
0 0 0 0 0 0 1 0
1 0 0 0 0 0 1 0
2 0 0 0 0 0 1 0
3 0 0 0 0 0 1 0
4 1 0 0 0 0 1 0
5 0 0 0 0 0 1 0
6 0 0 0 0 0 1 0
7 0 0 0 0 1 0 0
8 0 0 0 0 0 1 0
9 0 0 0 0 1 0 0'''
DF = pd.read_csv(StringIO(txt), sep="\s+")
strategy = [max, max, max, max, max, max, max]
weights = [1, 1, 3, 1, 1, 1, 1]
data = Data(DF.values, strategy, weights = weights, anames=DF.index.values, cnames=DF.columns)
# apply TOPSIS
dm = simple.WeightedSum()
# dm = closeness.TOPSIS()
decide = dm.decide(data)
print(decide)
在使用简单数据集的情况下,它可以工作,但是我尝试使用此数据框进行所有操作,排名应该从第4行开始,但是在这种情况下,排名只是递增...
请帮助...,为此,您需要安装scikit-criteria。