def fit(self, X_train, reduced_dim):
        """Trains the model, i.e., it computes the weight matrix w_PCA.

        Parameters
        ----------
        X_train : array of floats of dimension N x D, where N is the number
            of data points and D the number of features.
            The training data points.
        reduced_dim : float.
            The dimension of the subspace in which we want to project.

        """
        dim = np.size(X_train[0, :])
        self.m_PCA = np.mean(X_train, axis=0)
        X_train -= self.m_PCA
        S = np.dot(X_train.T, X_train)
        _, eigenvectors = eigh(S, eigvals=(dim - reduced_dim, 1 - dim),
                               overwrite_a=True)
        self.W_PCA = eigenvectors[:, ::-1]
dataset/ETHPy150Open vicgalle/machine-learning/reduce_dim.py/PCA.fit/swapped operands of `-`