Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import math
- def geo_mean(iterable):
- a = np.array(iterable)
- return a.prod()**(1.0/len(a))
- def get_vector(A):
- W = []
- norm = 0
- for i in range(A[0].size):
- W.append(geo_mean(A[i]))
- norm += W[i]
- return W/norm
- def max_eigen_value(A):
- return np.linalg.eig(A)[0].real.max()
- def Satty(A):
- return ((max_eigen_value(A)-len(A))/(len(A)-1))
- def Geometryczny(A):
- ranking = get_vector(A)
- for i in range (0,A.size):
- for j in range (i+1,A.size):
- math.log(A[i][j] * )**2
- A = np.array([
- [1, 7, 3],
- [1/7, 1, 2],
- [1/3, 1/2, 1]])
- B = np.array([
- [1, 1/5, 7,1],
- [5, 1, 1/2,2],
- [1/7, 2, 1,3],
- [1,1/2,1/3,1]])
- C = np.array([
- [1, 2, 5, 1, 7],
- [1/2, 1, 3, 1/2, 5],
- [1/5, 1/3, 1, 1/5, 2],
- [1, 2, 5, 1, 7],
- [1/7, 1/5, 1/2, 1/7, 1]])
- SattyA = Satty(A)
- SattyB = Satty(B)
- SattyC = Satty(C)
- GeoA = Geometryczny(A)
- print(SattyA)
- print(SattyB)
- print(SattyC)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement