def computeConfusionMatrix(model, samples, responses):
    """computes the confusion matrix of the classifier (model)

    samples should be n samples by m variables"""
    classifications = {}
    predictions = model.predict(samples)
    for predicted, y in zip(predictions, responses):
        classifications[y, predicted] = classifications.get((y, predicted), 0
            ) + 1
    return classifications
