'Dot-product the features and current weights and return the best label.'

def predict(self, features):

    scores = defaultdict(float)
    for (feat, value) in features.items():
        if ((feat not in self.weights) or (value == 0)):
            continue
        weights = self.weights[feat]
        for (label, weight) in weights.items():
            scores[label] += (value * weight)
    return max(self.classes, key=(lambda label: (scores[label], label)))
