def approximator(molecules, options, sort_order=None, frameworks=[], ensemble=[]):
    """
    recursively rank queries
    :param molecules:
    :param options:
    :param sort_order:
    :param frameworks:
    :param ensemble:
    :return:
    """

    # set variables
    ensemble_size = options.ensemble_size

    if not sort_order:
        sort_order = classification.get_sort_order(molecules)

    # construct ensemble
    print("Performing calculations for ensemble size {s}".format(s=(len(ensemble) + 1)))
    ensemble = rank_queries(molecules, ensemble, sort_order, options)

    # write stats & ensemble
    output.write_ensemble(list(ensemble), options)

    if len(ensemble) == ensemble_size:
        return 1
    else:
        return approximator(molecules, options, sort_order, frameworks, ensemble)
recursively rank queries
    :param molecules:
    :param options:
    :param sort_order:
    :param frameworks:
    :param ensemble:
    :return: