def reconstruct(self, codes):
        """
        Given a code tuple, reconstruct an approximate vector.

        :param tuple codes:
            a code tuple as returned from the predict method

        :returns ndarray:
            a reconstructed vector
        """
        coarse_codes, fine_codes = codes

        x = []
        for fc, split in iterate_splits(fine_codes, self.num_coarse_splits):

            # Get product quantizer parameters for this split
            C, R, mu, subC = self.get_split_parameters(split)

            # Concatenate the cluster centroids for this split of fine codes
            sx = reduce(lambda acc, c: np.concatenate((acc, subC[c[0]][c[1]])), enumerate(fc), [])

            # Project residual out of local space
            cluster = coarse_codes[split]
            r = np.dot(R[cluster].transpose(), sx) + mu[cluster]

            # Reconstruct from cluster centroid
            x = np.concatenate((x, r + C[cluster]))

        return x
dataset/ETHPy150Open yahoo/lopq/python/lopq/model.py/LOPQModel.reconstruct/original