Pular para o conteúdo principal

Capítulo 2: Pipelines de Avaliação Humana

Critérios de Avaliação​

CritérioDescriçãoEscala
UtilidadeResponde à pergunta?1-5
AcuráciaA informação está correta?1-5
InofensividadeÉ seguro e apropriado?Sim/Não
CoerênciaEstá bem estruturado?1-5

Interface de Anotação​

# Example annotation task structure
annotation_task = {
"task_id": "task_001",
"prompt": "What are the benefits of MLOps?",
"response_a": "MLOps provides...",
"response_b": "The benefits include...",
"evaluation_criteria": [
{"name": "helpfulness", "type": "rating", "scale": [1, 2, 3, 4, 5]},
{"name": "accuracy", "type": "rating", "scale": [1, 2, 3, 4, 5]},
{"name": "preference", "type": "choice", "options": ["A", "B", "Tie"]}
]
}

Acordo entre Anotadores​

from sklearn.metrics import cohen_kappa_score

def calculate_agreement(annotator_1: list, annotator_2: list) -> float:
"""Calculate Cohen's Kappa for inter-annotator agreement."""
kappa = cohen_kappa_score(annotator_1, annotator_2)

# Interpretation
if kappa < 0.20:
interpretation = "Poor"
elif kappa < 0.40:
interpretation = "Fair"
elif kappa < 0.60:
interpretation = "Moderate"
elif kappa < 0.80:
interpretation = "Good"
else:
interpretation = "Excellent"

return kappa, interpretation

Próximo: Capítulo 3: Testes de Segurança