Spaces:
Runtime error
Runtime error
import numpy as np | |
def show_most_confused(ds, source_intent, target_intent, estimator, class_names): | |
pair_name = f"{class_names[source_intent]} <> {class_names[target_intent]}" | |
closest_to_second = np.argsort([sample.sample_probability_norm[target_intent] for sample in estimator.similarity_arrays[source_intent].values()])[::-1][:10] | |
dataset_indices = estimator.class_indices[source_intent][closest_to_second] | |
return {pair_name : [ds[int(di)]["text"] for di in dataset_indices]} |