View source: R/datasets_findingemo.R
| prepare_findingemo_evaluation | R Documentation |
Prepares FindingEmo dataset annotations for use with evaluate_emotions().
Converts the dataset format to match the expected input structure for
evaluation functions.
prepare_findingemo_evaluation(
annotations,
predictions,
id_col = "image_id",
truth_col = "emotion_label",
pred_col = "predicted_emotion",
include_va = TRUE
)
annotations |
Data.frame. Annotations from |
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). |
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().
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
load_findingemo_annotations, evaluate_emotions
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.