Jun-09-2020, 09:31 PM
X = rand.rand(10, 2) %matplotlib inline import matplotlib.pyplot as plt import seaborn; seaborn.set() # Plot styling plt.scatter(X[:, 0], X[:, 1], s=100); dist_sq = np.sum((X[:, np.newaxis, :] - X[np.newaxis, :, :]) ** 2, axis=-1)what I don't undersand is this part:
differences = X[:, np.newaxis, :] - X[np.newaxis, :, :]what's happening between these two brackets, these two colons. Help is appreciated.