def aligned_at_k(results, k=5): return ( results.head(k)["label"] .eq("aligned") .mean() ) __ __