in dynalab/tasks/annotation_mock_data.py [0:0]
def generate_multiclass_probs_mock_data(annotation, name_to_annotation_dict):
mock_data = []
source_reference_name = annotation["constructor_args"]["reference_name"]
source_annotation = name_to_annotation_dict[source_reference_name]
labels = source_annotation["constructor_args"]["labels"]
for _ in range(3):
probs_dict = {}
probs_sum = 0
for label in labels:
probs_dict[label] = random.random()
probs_sum += probs_dict[label]
# normalize
for label in labels:
probs_dict[label] /= probs_sum
mock_data.append(probs_dict)
return mock_data