def METHOD_NAME(self, X, y, n_classes, mean_vectors):
    S_W = np.zeros((X.shape[1], X.shape[1]))
    for cl, mv in zip(range(n_classes), mean_vectors):
        class_sc_mat = np.zeros((X.shape[1], X.shape[1]))
        for row in X[y == cl]:
            row, mv = row.reshape(X.shape[1], 1), mv.reshape(X.shape[1], 1)
            class_sc_mat += (row - mv).dot((row - mv).T)
        S_W += class_sc_mat
    return S_W