def explans_satistics(explanations_per_cluster, target_quality_measure='x_coverage', threshold=0):
    """
    Computes insight startistics for the generated set of explanations.

    Computed statistics includes total number of clusters, clusters with at least one explanation, and clusters with
    at least one explanation with quality > min_quality.

    :param explanations_per_cluster: The dictionary of clusters and list of explanations of each cluster.
    :param target_quality_measure: The target quality that determines accepted explanations.
    :param threshold: The minimum quality of the accepted explanation.
    :return:
    """
    stats = dict()
    # number of clusters
    stats['clusters_nums'] = len(explanations_per_cluster.keys())
    got_explans=list(filter(lambda v: len(v)>0, explanations_per_cluster.values()))
    stats['clusters_with_any_explans'] =  len(got_explans)
    stats['clusters_with_accepted_explans'] = sum([v[0].get_quality(target_quality_measure) > threshold
                                                   for v in got_explans])
    return stats