y_norm = y - y_mean
slope = np.einsum('ij,ij->i', x_norm, y_norm) / np.einsum('ij,ij->i',
    x_norm, x_norm)
intercept = y_mean[:, (0)] - slope * x_mean[:, (0)]
return np.column_stack((slope, intercept))
Множественная простая линейная регрессия Python