文獻復現——A New Geometric Mean FMEA Method Based on Information Quality
實現了作者的模型,並且新增了簡單的資料預處理:
#作者提出了一個新的FMEA方法,主要是對原有的RPN計算方法改進
#1、構建模糊評價矩陣,如果有 N個失效模式,那麼就構建N×3的模糊評價矩陣
#N行有N個失效模式FM,3列3個不同的指標,S O D
#模糊評價矩陣的元素為(a,b,c,....)是專家對該指標的滿意度評價
#2、計算模糊矩陣中每個元素的廣義資訊質量,生成廣義資訊質量矩陣
#3、對廣義資訊質量矩陣進行修正(qu_matrix/max(qu_matrix)),得到幾何平均權重矩陣(0.3365,0.4158,0.2475)
#4、通過幾何平均權重矩陣計算每個效模式的RPN
import numpy as np
import pandas as pd
import math
#1、根據專家意見構建模糊評價矩陣
# fuzzy_list=[[(0.8193,0.0771,0.1033),(0.0545,0.3105,0.6346),(0.2191,0.4894,0.2914)],
# [(0.7224,0.1373,0.1399),(0.0545,0.3104,0.6346),(0.8250,0.0776,0.1040)],
# [(0.8709,0.1039,0.0253),(0.0233,0.0722,0.2042),(0.2191,0.4892,0.2914)],
# [(0.3669,0.4475,0.1854),(0.0233,0.0722,0.9043) ,(0.0545,0.3104,0.6346)],
# [(0.3669,0.4475,0.1854) ,(0.1504,0.4446,0.4045) ,(0.7546,0.1373,0.1075)],
# [(0.3669,0.4475,0.1854) ,(0.1504,0.4446,0.4045) ,(0.7546,0.1373,0.1075)],
# [(0.7227,0.1374,0.1400) ,(0.1504,0.4446,0.4045) ,(0.0545,0.3104,0.6346)],
# [(0.8709,0.1039,0.0253) ,(0.0233,0.0722,0.9042),(0.2191,0.4894,0.2914)],
# [(0.3669,0.4475,0.1854) ,(0.1504,0.4446,0.4045) ,(0.7546,0.1373,0.1075)],
# [(0.7966,0.1070,0.1135) ,(0.3092,0.1103,0.5671),(0.3365,0.4158,0.2475)]]
# fuzzy_matrix=np.array(fuzzy_list);#轉換為矩陣
#x,y,z=fuzzy_matrix.shape;
#資料預處理
def checkdata(fuzzy_matrix):
x,y,z=fuzzy_matrix.shape;
m=0
for i in range(0,x):
for j in range(0,y):
sum=0
for k in range(0,z):
sum=sum+fuzzy_matrix[i,j,k]
if(round(sum,0)!=1):
m=m+1
print("(",i+1,",",j+1,")")
for k_ in range(0,z):
fuzzy_matrix[i,j,k_]=fuzzy_matrix[i,j,k_]/sum
print("保留0位小數後,一共有{0}個資料不符合條件,現在已經修改".format(m))
return fuzzy_matrix;
#2、計算廣義資訊質量
#2.0向量得自身長度得平方,z是大小
def selfDis2(pi,z):
sum=0.0
for i in range(0,z):
sum=sum+pi[i]*pi[i]
return sum;
#2.1 計算pi與pj之間的距離:元組
def distance(p_i,p_j):
#轉換為行向量
vector_i=np.array(p_i);
vector_j = np.array(p_j);
#計算差值:
vector_dif_T=vector_i-vector_j;#這是列項量
line=vector_dif_T.shape[0];#獲取行
vector_dif_T=vector_dif_T.reshape(line,1);#重新塑性,否則錯誤
vector_dif_line=vector_dif_T.reshape(1,line);#轉置
d=np.dot(vector_dif_line,vector_dif_T);#矩陣相乘
d=d[0,0]
d=pow(d,1/2);
return round(d,4);
#2.2 計算相似度
def sim(p_i,p_j):
return 1-distance(p_i,p_j);
#2.3構建每一個指標的sim矩陣,距離採用全部的
#返回矩陣
def simArray(fmatrix):
x,y,z=fmatrix.shape;
p=1
simMatrix=[]
for i in range(0,x):
tmp = []
for j in range(0,y):
pi=fmatrix[i,j,:];
sum=0.0
for i_ in range(0,x):
for j_ in range(0,y):
if(i==i_ and j==j_):
continue;
else:
pj=fmatrix[i_,j_,:];
sum=sum+sim(pi,pj);
tmp.append(round(sum,4))
simMatrix.append(tmp);
simM=np.array(simMatrix)
return simM
#2.4構建信用矩陣crdi
def crdi(fmatrix):
x,y,z=fmatrix.shape;
sup=simArray(fmatrix);
sum=0.0
for i in range(0,x):
for j in range(0,y):
sum=sum+sup[i,j]
for i in range(0,x):
for j in range(0,y):
sup[i,j]=sup[i,j]/sum
return sup;
#2.5構建廣義資訊質量矩陣
def qu(fmatrix):
crdiMatrix_=crdi(fmatrix);#信任矩陣
print(type(crdiMatrix_))
x,y,z=fmatrix.shape;
list_line=[]
for i in range(0,x):
list_column=[]
for j in range(0,y):
pi=fmatrix[i,j,:];#pi
doublePi=selfDis2(pi,z);
exp=crdiMatrix_[i,j]
expCrdi=pow(math.e,exp)
sum=expCrdi*doublePi;
list_column.append(sum)
list_line.append(list_column)
quMatrix=np.array(list_line)
# print("廣義資訊質量矩陣")
# print(quMatrix)
return quMatrix
#對廣義資訊質量矩陣進行修正,得到幾何平均權重矩陣
def weightMatrix(fmatrix):
quMatrix=qu(fmatrix);#廣義矩陣
maxValue=quMatrix.max();
x,y=quMatrix.shape;
for i in range(0,x):
for j in range(0,y):
quMatrix[i,j]=quMatrix[i,j]/maxValue;
#print("Geometric mean Matrix")
#print(quMatrix)
return quMatrix
#利用幾何均值法生成新的RPN矩陣
def geometricMean(fmatrix):
fmatrix = checkdata(fmatrix);#資料預處理
geoMatrix=weightMatrix(fmatrix);#生成geometric mean metric
x,y,z=fmatrix.shape;
finalResult=[];#最終的結果矩陣,預設大小為3*10,最後需要轉置
for q in range(0,z):
#q代表good、average、poor
tmp_q=[];#臨時矩陣
for i in range(0,x):
rqn=0.0;
w_line=0.0;#在權重矩陣中計算每一行的權重之和
m_line = 1; # 作為連乘的結果
for j in range(0,y):
w_line=w_line+geoMatrix[i,j];
m_line=m_line*pow(fmatrix[i,j,q],geoMatrix[i,j]);
w_line = 1 / w_line; # 作為指數
rqn=pow(m_line,w_line);
tmp_q.append(rqn);
finalResult.append(tmp_q);
finalR=np.array(finalResult);#轉為矩陣
x,y=finalR.shape
#轉置,不要用reshape,reshape是按照順序以及設定的x,y,一行一行的進行切割,不是真正意義上的轉置
finalResult=[]
for j in range(0,y):
tmp = []
for i in range(0,x):
tmp.append(finalR[i,j]);
finalResult.append(tmp);
return np.array(finalResult);
#生成等級RNK等級
def rankMake(fmatrix):
geoMetrix=geometricMean(fmatrix);
print("平均幾何均值矩陣 Geometric Mean Matrix")
print(geoMetrix)
x,y=geoMetrix.shape;#權重值未0.1 0.3 0.6
weight=[0.1,0.3,0.6];
results=[]
for i in range(0,x):
str_="A"+str(i+1)
tmp=[]
sum=0.0
tmp.append(str_)
for j in range(0,y):
sum=sum+geoMetrix[i,j]*weight[j]
tmp.append(sum);
results.append(tmp)
results=np.array(results)#這就是新合成的RPN
# print("新合成的RPN")
# print(results)
#應該加上rank等級這一列
results=results[results[:,1].argsort()]#根據每一列的值進行排序,調整行的順序
x, y = results.shape;
finals=[]
for i in range(0,x):
tmp=[]
for j in range(0,y):
tmp.append(results[i,j])
tmp.append(10-i)
finals.append(tmp)
results=np.array(finals)
results=results[results[:,0].argsort()]
print(results)
return results;
if __name__ == '__main__':
#fuzzy_list=[[(0.8193,0.0771,0.1033),(0.0545,0.3105,0.6346),(0.2191,0.4894,0.2914)]]
#(good,average,poor)
fuzzy_list=[[(0,0,1),(0,0,1),(0,0,1)],
[(0,0,1),(0,0,1),(0,0,1)],
[(0,0,1),(0,0,1),(0,0,1)]]
fuzzy_matrix = np.array(fuzzy_list);
# weightMatrix(fuzzy_matrix)
#print(geometricMean(fuzzy_matrix))
#simArray(fuzzy_matrix)
# crdi(fuzzy_matrix)
rankMake(fuzzy_matrix)
相關文章
- 論文翻譯五:A New Method of Automatic Modulation Recognition Based on Dimension Reduction
- MoreType – new method to build data in RecyclerView with Kotlin!UIViewKotlin
- 閱讀文獻《DCRNet:Dilated Convolution based CSI Feedback Compression for Massive MIMO Systems》
- A Method of Setting the LiDAR Field of View in NDT Relocation Based on ROIView
- 閱讀文獻《SCNet:Deep Learning-Based Downlink Channel Prediction for FDD Massive MIMO System》
- 實踐心得:從讀論文到復現到為開源貢獻程式碼
- QSAN A Quantum-probability based Signed Attention Network for Explainable False Information Detection(CIKM20)AIFalseORM
- Word交叉引用參考文獻如何更改文獻格式?
- 閱讀文獻
- 文獻常識
- Mean AP=-1
- 影像相加 Mean
- Beyond Fixed Grid: Learning Geometric Image Representation with a Deformable Grid——論文閱讀ORM
- Split to Be Slim: 論文復現
- Latex—參考文獻
- 參考文獻合集
- 論文解讀(Geom-GCN)《Geom-GCN: Geometric Graph Convolutional Networks》GC
- 《Cascade R-CNN: Delving into High Quality Object Detection》論文筆記CNNObject筆記
- 理解new和實現一個new
- 面向文獻的學習
- Network Motif 文獻調研
- 教材與參考文獻
- Mac文獻管理EndNote 20.5Mac
- 論文閱讀 Exploring Temporal Information for Dynamic Network EmbeddingORM
- 科研基本功——高效文獻檢索與文獻閱讀保姆級教程
- LEARNED STEP SIZE QUANTIZATION論文復現
- [論文閱讀筆記] Adversarial Learning on Heterogeneous Information Networks筆記ORM
- 預處理技術文獻
- New ownerAnyone Bug Allows For Anyone to ''Own'' Certain ERC20-Based Smart Contracts (CVE-2018-10705AI
- 論文復現|Panoptic Deeplab(全景分割PyTorch)PyTorch
- Squarified Treemaps 論文演算法復現演算法
- JavaScript new 關鍵詞解析及原生實現 newJavaScript
- SAP QM Cost of Quality Inspection
- Quality Inspection in drop shipment process
- Stability Study with SAP Quality Management
- 論文閱讀:A neuralized feature engineering method for entity relation extractionZed
- 論文解讀(GraRep)《GraRep: Learning Graph Representations with Global Structural Information》StructORM
- 論文解讀(LINE)《LINE: Large-scale Information Network Embedding》ORM