<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reconstruct_mds(edm, all_points, completion='optspace', mask=None, method='geometric', print_out=False, n=1):
 """ Reconstruct point set using MDS and matrix completion algorithms. """

    from .point_set import dm_from_edm
    from .mds import MDS
    N = all_points.shape[0]
    d = all_points.shape[1]
    if mask is not None:
        edm_missing = np.multiply(edm, mask)
        if completion == 'optspace':
            from .edm_completion import optspace
            edm_complete = optspace(edm_missing, d + 2)
        elif completion == 'alternate':
            from .edm_completion import rank_alternation
            edm_complete, errs = rank_alternation(
                edm_missing, d + 2, print_out=False, edm_true=edm)
        else:
            raise NameError('Unknown completion method {}'.format(completion))
        if (print_out):
            err = np.linalg.norm(edm_complete - edm)**2 / \
                np.linalg.norm(edm)**2
            print('{}: relative error:{}'.format(completion, err))
        edm = edm_complete
    Xhat = MDS(edm, d, method, False).T
    Y, R, t, c = procrustes(all_points[n:], Xhat, True)
    #Y, R, t, c = procrustes(all_points, Xhat, True)
    return Y