def mds(means, weights, d):
    """
    Dimensionality reduction using MDS.

    Args:
        means (array): genes x clusters
        weights (array): clusters x cells
        d (int): desired dimensionality

    Returns:
        W_reduced (array): array of shape (d, cells)
    """
    X = dim_reduce(means, weights, d)
    if X.shape[0]==2:
        return X.dot(weights)
    else:
        return X.T.dot(weights)
def mds ( means , weights , d ) : X = dim_reduce ( means , weights , d ) if X . shape [ 0 ] == 2 : return X . dot ( weights ) else : return X . T . dot ( weights )
Dimensionality reduction using MDS.

    Args:
        means (array): genes x clusters
        weights (array): clusters x cells
        d (int): desired dimensionality

    Returns:
        W_reduced (array): array of shape (d, cells)