资源简介
AHP层次分析法Python实现代码,如有需要,请大家下载!!!可用!!
代码片段和文件信息
import numpy as np
# 层次分析法确定各变量权重
A = np.array([[1 5 3 3]\
[1/511/3 1/3]\
[1/33 1 1]\
[1/33 1 1]])
S = sum(A)
for i in range(0len(A)):
for j in range(0len(A)):
A[ij] = A[ij]/S[j]
feature_vector_A = list(map(sumA))
weight_A = np.array(feature_vector_A)/len(A)
B1 = np.array([[1 5 7 5 7 7]\
[1/51 3 1 3 3]\
[1/71/31 1/3 1 1]\
[1/51 3 1 3 3]\
[1/71/311/3 1 1]
[1/71/311/3 1 1]])
S1 = sum(B1)
for i in range(0len(B1)):
for j in range(0len(B1)):
B1[ij] = B1[ij]/S1[j]
feature_vector_B1 = list(map(sumB1))
weight_B1 = np.array(feature_vector_B1)/len(B1)
weight_AB1 = weight_A[0]*weight_B1
B2 = np.array([[1 5 3 9 9 7]\
[1/5 1 31/51/51/3]\
[1/31/3 11/71/71/5]\
[1/9 5 7 1 11/5]\
[7 3 5 5 51/5]
[7 3 5 5 5 1]])
S2 = sum(B2)
for i in range(0len(B2)):
for j in range(0len(B2)):
B2[ij] = B2[ij]/S2[j]
feature_vector_B2 = list(map(sumB2))
weight_B2 = np.array(feature_vector_B2)/len(B2)
weight_AB2 = weight_A[1]*weight_B2
B3 = np.array([[1 1/3 1/5 1/3 3 5]\
[3 1 1/3 1 5 7]\
[5 3 1 3 7 9]\
[3 1 1/3 1 5 7]\
[1/31/51/7 1/5 1 3]\
[1/51/71/9 1/7 1/31]])
S3 = sum(B3)
for i in range(0len(B3)):
for j in range(0len(B3)):
B3[ij] = B3[ij]/S3[j]
feature_vector_B3 = list(map(sumB3))
weight_B3 = np.array(feature_vector_B3)/len(B3)
weight_AB3 = weight_A[2]*weight_B3
B4 = np.array([[1 3 3 5 5 1/5]\
[1/31 1 3 3 1/7]\
[1/31 1 3 3 1/7]\
[1/51/31/31 1 1/9]\
[1/51/31/31 1 1/9]\
[5 7 7 9 9 1]])
S4 = sum(B4)
for i in range(0len(B4)):
for j in range(0len(B4)):
B4[ij] = B4[ij]/S4[j]
feature_vector_B4 = list(map(sumB4))
weight_B4 = np.array(feature_vector_B4)/len(B4)
weight_AB4 = weight_A[3]*weight_B4
weight = weight_AB1 + weight_AB2 + weight_AB3 + weight_AB4
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2347 2019-08-04 16:04 AHP.py
文件 27 2019-08-04 16:19 readme.txt
----------- --------- ---------- ----- ----
2374 2
- 上一篇:python 爬取链家网信息
- 下一篇:基于python的微博热点话题舆情聚类分析
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论