def _filter_params (param, estimator):
    """
    Given a set of parameters and an estimator: Remove the parameters
    that are not belonging to the estimator.

    :return: dictionary, containing only the supported parameters
    """
    valid_params = estimator.get_params()
    out = dict()
    for key, value in param.items():
        if key in valid_params.keys():
            out[key] = value
    return out