prepare_findingemo_evaluation: Prepare FindingEmo Data for Evaluation

View source: R/datasets_findingemo.R

prepare_findingemo_evaluationR Documentation

Prepare FindingEmo Data for Evaluation

Description

Prepares FindingEmo dataset annotations for use with evaluate_emotions(). Converts the dataset format to match the expected input structure for evaluation functions.

Usage

prepare_findingemo_evaluation(
  annotations,
  predictions,
  id_col = "image_id",
  truth_col = "emotion_label",
  pred_col = "predicted_emotion",
  include_va = TRUE
)

Arguments

annotations

Data.frame. Annotations from load_findingemo_annotations().

predictions

Data.frame. Model predictions with same image IDs as annotations.

id_col

Character. Column name for image IDs (default: "image_id").

truth_col

Character. Column name for ground truth emotions (default: "emotion_label").

pred_col

Character. Column name for predicted emotions (default: "predicted_emotion").

include_va

Logical. Whether to include valence/arousal columns (default: TRUE).

Details

This function merges FindingEmo annotations with model predictions and formats the result for evaluation. It handles missing values, validates data consistency, and ensures the output matches the expected format for evaluate_emotions().

Value

A data.frame formatted for use with evaluate_emotions(), containing:

  • id: Image identifiers

  • truth: Ground truth emotion labels

  • pred: Predicted emotion labels

  • valence: Valence scores (if available and include_va = TRUE)

  • arousal: Arousal scores (if available and include_va = TRUE)

  • Additional probability columns if present in predictions

See Also

load_findingemo_annotations, evaluate_emotions

Examples

## Not run: 
# Load annotations
annotations <- load_findingemo_annotations("./findingemo_data")

# Create mock predictions (replace with actual model predictions)
predictions <- data.frame(
  image_id = annotations$image_id[1:100],
  predicted_emotion = sample(c("happy", "sad", "angry"), 100, replace = TRUE),
  prob_happy = runif(100),
  prob_sad = runif(100),
  prob_angry = runif(100)
)

# Prepare for evaluation
eval_data <- prepare_findingemo_evaluation(
  annotations = annotations,
  predictions = predictions
)

# Evaluate model performance
results <- evaluate_emotions(
  data = eval_data,
  probs_cols = c("prob_happy", "prob_sad", "prob_angry")
)

print(results)

## End(Not run)


transforEmotion documentation built on Jan. 8, 2026, 5:06 p.m.