3

I have been programming for years in python but now i was reading a program to do linnear regression and i found this.

    if X.ndim == 1:
        X = X[:, None]
    d = X - self.mean
    precision = np.linalg.inv(self.var)
    return (
        np.exp(-0.5 * np.sum(d @ precision * d, axis=-1))
        * np.sqrt(np.linalg.det(precision))
        / np.power(2 * np.pi, 0.5 * self.ndim))

what does the @ in this code?

Taku
  • 28,570
  • 11
  • 65
  • 77

1 Answers1

5

It's the matrix multiplication operator as described in PEP-465 and first made available in Python 3.5.

paxdiablo
  • 814,905
  • 225
  • 1,535
  • 1,899