Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- obs1 = np.random.rand(1 ,200) #Generujesz 200-wymiarową losową wartość
- obs2 = np.random.rand(1, 200)
- dimenstions = range(2, 200)
- distances = []
- for index in dimenstions:
- elems = [obs1[0][:index + 1], obs2[0][:index + 1]] #bierzesz tylko pierwsze "index" wymiarów
- distances.append(np.linalg.norm(elems, 2))
- fig, ax = plt.subplots()
- ax.plot(dimenstions, distances)
- ax.set(xlabel='dimension', ylabel='distance')
- ax.grid()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement