项目描述
TOPSIS
TOPSIS 是一个首字母缩写词,代表“与理想解决方案的顺序偏好相似性技术”,是一种非常简单的 MCDA 方法。顾名思义,该方法基于找到一个理想和反理想的解决方案,并比较每个替代方案与这些方案的距离。它在 Hwang 和 Yoon(多属性决策:方法和应用。Springer,柏林,1981 年)和 Chen 和 Hwang(模糊多属性决策方法。Springer,柏林,1992 年)中进行了介绍,可以被认为是其中之一。经典的 MCDA 方法受到了学者和研究人员的广泛关注。
依赖项
• OS
• Pandas
安装
pip install TOPSIS-Parth-101983047==0.0.7
用法
perform_Topsis(source, weights, impacts, result)
参数
source : Input data file in .csv format
weights : List of weights for columns except first column
impacts : list of impacts for columns except first column
result : Output file name to store results in .csv format
处理的约束/异常
1. Correct number of parameters (source, weights, impacts, result)
2. Handling of “File not Found” exception
3. Input file must contain three or more columns.
4. From 2 nd to last columns must contain numeric values only (Handling of non-numeric values)
5. Number of weights, number of impacts and number of columns (from 2 nd to last columns) must
be same.
6. Impacts must be either +ve or -ve.
7. Impacts and weights must be separated by ‘,’ (comma).
8. Output "File already exists" condition
例子
同一文件夹中的“data.csv”---->
| 模型 |
更正 |
序列 |
均方根误差 |
准确性 |
| M1 |
0.79 |
0.62 |
1.25 |
60.89 |
| M2 |
0.66 |
0.44 |
2.89 |
63.07 |
| M3 |
0.56 |
0.31 |
1.57 |
62.87 |
| M4 |
0.82 |
0.67 |
2.68 |
70.19 |
| M5 |
0.75 |
0.56 |
1.3 |
80.39 |
>>>python
>>>from Topsis.topsis import perform_Topsis
>>>perform_Topsis('data.csv', [1,2,1,2], ['+','-','-','+'], 'result.csv')
Generating output file ....
Output file generated.
在同一文件夹中生成的“result.csv”---->
| 模型 |
更正 |
序列 |
均方根误差 |
准确性 |
Topsis 评分 |
秩 |
| M1 |
0.79 |
0.62 |
1.25 |
60.89 |
0.404270981738897 |
4.0 |
| M2 |
0.66 |
0.44 |
2.89 |
63.07 |
0.44542964404513863 |
3.0 |
| M3 |
0.56 |
0.31 |
1.57 |
62.87 |
0.6966994505305135 |
1.0 |
| M4 |
0.82 |
0.67 |
2.68 |
70.19 |
0.2312955403197052 |
5.0 |
| M5 |
0.75 |
0.56 |
1.3 |
80.39 |
0.534754530220428 |
2.0 |
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
内置分布