':param labeled_featuresets: A list of classified featuresets,
i.e., a list of tuples ``(featureset, label)``.'

@classmethod
def train(cls, labeled_featuresets, estimator=ELEProbDist):

    label_freqdist = FreqDist()
    feature_freqdist = defaultdict(FreqDist)
    feature_values = defaultdict(set)
    fnames = set()
    for (featureset, label) in labeled_featuresets:
        label_freqdist[label] += 1
        for (fname, fval) in featureset.items():
            feature_freqdist[(label, fname)][fval] += 1
            feature_values[fname].add(fval)
            fnames.add(fname)
    for label in label_freqdist:
        num_samples = label_freqdist[label]
        for fname in fnames:
            count = feature_freqdist[(label, fname)].N()
            if ((num_samples - count) > 0):
                feature_freqdist[(label, fname)][None] += (num_samples - count)
                feature_values[fname].add(None)
    label_probdist = estimator(label_freqdist)
    feature_probdist = {}
    for ((label, fname), freqdist) in feature_freqdist.items():
        probdist = estimator(freqdist, bins=len(feature_values[fname]))
        feature_probdist[(label, fname)] = probdist
    return cls(label_probdist, feature_probdist)
