Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- 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
- #1
- cena = np.array([[1,1/7,1/5],
- [7,1,3],
- [5,1/3,1]])
- #2
- rozmiar_domu = np.array([[1,5,9],
- [1/5,1,4],
- [1/9,1/4,1]])
- #3
- dostep = np.array([[1,4,1/5],
- [1/4,1,1/9],
- [5,9,1]])
- #4
- dzielnica = np.array([[1,9,4],
- [1/9,1,1/4],
- [1/4,4,1]])
- #5
- wiek = np.array([[1,1,1],
- [1,1,1],
- [1,1,1]])
- #6
- rozmiar_ogrodka = np.array([[1,6,4],
- [1/6,1,1/3],
- [1/4,3,1]])
- #7
- wyposazenie = np.array([[1,9,6],
- [1/9,1,1/3],
- [1/6,3,1]])
- #8
- stan = np.array([[1,1/2,1/2],
- [2,1,1],
- [2,1,1]])
- parametry = np.array([[1,4,7,5,8,6,6,2],
- [1/4,1,5,3,7,6,6,1/3],
- [1/7,1/5,1,1/3,5,3,3,1/5],
- [1/5,1/3,3,1,6,3,4,1/2],
- [1/8,1/7,1/5,1/6,1,1/3,1/4,1/7],
- [1/6,1/6,1/3,1/3,3,1,1/2,1/5],
- [1/6,1/6,1/3,1/4,4,2,1,1/5],
- [1/2,3,5,2,7,5,5,1]])
- ranking = get_vector(parametry)
- print(ranking)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement