-
Notifications
You must be signed in to change notification settings - Fork 0
/
rca.py
59 lines (50 loc) · 983 Bytes
/
rca.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import numpy as np
import pandas as pd
x_0_0 = """313.09
350.87
383.43
452.03
499.74
566.73
634.37"""
x_0_1 = """1.24
1.33
1.35
1.48
1.54
1.62
1.75"""
x_1 = """100946
106975
111384
113191
103275
111799
125058"""
x_2 = """13015.63
14169.88
15676.75
17606.13
19677.93
22143.58
24393.11"""
r = 0.5
x_0_0 = [float(item) for item in x_0_0.split("\n")]
x_0_1 = [float(item) for item in x_0_1.split("\n")]
x_1 = [float(item) for item in x_1.split("\n")]
x_2 = [float(item) for item in x_2.split("\n")]
x_0 = [x_0_0[i] / x_0_1[i] * 100 for i in range(len(x_0_0))]
data = np.array([x_0, x_1, x_2])
df = pd.DataFrame(data)
print(f'原始矩阵\n{df}')
for i in range(df.shape[0]):
df.iloc[i] = df.iloc[i] / df.iloc[i, 0]
print(f'规划化后的矩阵\n{df}')
df_ = np.abs(df - df.iloc[0, :])
global_max = df_.max().max()
global_min = df_.min().min()
df_r = (global_min + r * global_max) / (df_ + r * global_max)
print('-----')
print(df_r)
print('-----')
print(df_r.mean(axis=1))