资源简介
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试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
评论
共有 条评论