<commit_before>import numpy as np


def uncertainty(predictor, data):
	uncertainties = predictor.score(data)
	max_uncertainty_idx = np.argmax(uncertainties)
	return max_uncertainty_idx, data[max_uncertainty_idx]<commit_msg>utilities/classifier_uncertainty() refactored, bug fixed<commit_after>import numpy as np


def classifier_uncertainty(classifier, data):
	# calculate uncertainty for each point provided
	classwise_uncertainty = classifier.predict_proba(data)

	# for each point, select the maximum uncertainty
	return 1 - np.max(classwise_uncertainty, axis=1)

{'fraction_non_alphanumeric': 0.07420494699646643, 'fraction_numerical': 0.0035335689045936395, 'mean_word_length': 7.462686567164179, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2984676', 'n_tokens_mistral': 183, 'n_tokens_neox': 173, 'n_words': 42}