def project_residuals_to_local(residuals, assignments, Rs, mu):
    projected = np.zeros(residuals.shape)
    for i in xrange(residuals.shape[0]):
        res = residuals[i]
        a = assignments[i]
        projected[i] = np.dot(Rs[a], res - mu[a])

    return projected
Given residuals for training datapoints, their cluster assignments,
dataset/ETHPy150Open yahoo/lopq/python/lopq/model.py/project_residuals_to_local