Skip to main content

Overview

The Humanity metric analyzes the emotional profile of assistant responses using the NRC Emotion Lexicon. It computes emotion distributions, emotional entropy, and Spearman correlation against ground truth responses.

Dimensions

For each interaction, the metric computes distribution scores across eight emotions:
EmotionDescription
AngerFrustration or hostility expressions
AnticipationForward-looking or expectant language
DisgustAversion or repulsion indicators
FearAnxiety or threat-related language
JoyPositive or happy expressions
SadnessSorrow or melancholy indicators
SurpriseUnexpected or astonishing content
TrustReliability and confidence markers
Additionally, it computes:
  • Emotional entropy: How diverse the emotional range is (higher = more diverse)
  • Ground truth Spearman correlation: How closely the emotional profile matches the expected response

Usage

from gaussia.metrics.humanity import Humanity

results = Humanity.run(MyRetriever)

for r in results:
    print(f"QA: {r.qa_id}")
    print(f"Emotional entropy: {r.humanity_assistant_emotional_entropy:.3f}")
    print(f"Spearman correlation: {r.humanity_ground_truth_spearman:.3f}")
    print(f"Joy: {r.humanity_assistant_joy:.3f}")

Parameters

ParameterTypeDefaultDescription
retrievertype[Retriever]requiredRetriever class
The Humanity metric does not require an LLM — it uses lexicon-based analysis.

Output schema

HumanityMetric

One result per interaction (not per session):
FieldTypeDescription
session_idstrSession identifier
qa_idstrInteraction identifier
assistant_idstrAssistant identifier
humanity_assistant_emotional_entropyfloatEmotional diversity (Shannon entropy)
humanity_ground_truth_spearmanfloatCorrelation with ground truth emotion profile
humanity_assistant_angerfloatAnger score (0–1)
humanity_assistant_anticipationfloatAnticipation score (0–1)
humanity_assistant_disgustfloatDisgust score (0–1)
humanity_assistant_fearfloatFear score (0–1)
humanity_assistant_joyfloatJoy score (0–1)
humanity_assistant_sadnessfloatSadness score (0–1)
humanity_assistant_surprisefloatSurprise score (0–1)
humanity_assistant_trustfloatTrust score (0–1)
Requires the humanity extra: pip install "gaussia[humanity]".