Skip to content

Conversation

@atomashevic
Copy link
Owner

  • Adds emotion evaluation suite (R/evaluate_emotions.R, tests/testthat/test_evaluate_emotions.R, vignettes/evaluate_emotions.Rmd) with accuracy/F1/AUROC/ECE/Krippendorff metrics, plotting
    support, and docs.
  • Introduces FindingEmo dataset tooling (R/datasets_findingemo.R, inst/python/download_findingemo.py, tests/testthat/test_findingemo.R, new inst/extdata/ assets) for download, caching,
    quality checks, and annotation loading.
  • Implements a local RAG stack (R/rag.R, R/rag_retrievers.R, R/rag_json.R, R/rag_evaluation.R, R/model_registry.R, R/model_management.R) covering retriever registry, JSON parsing/
    validation, evaluation, and model lifecycle helpers.
  • Extends VAD mapping and GPU/Python integration (R/map_discrete_to_vad.R, R/vad_scores.R, inst/python/image.py, inst/python/video.py, supporting tests) for smoother discrete→VAD
    conversions and refreshed registries.

Quick test of uv install, text and image scores with:

Rscript -e 'devtools::test()'

- rag: concise table outputs (labels+conf), sort by confidence; gate per-doc logs behind retriever_params; suppress device message unless progress
- bm25: use run_query in strict retry; add k1/b params; Unicode-aware tokenizer with override
- hf_auth: avoid huggingface_hub login() when token present (suppress note)
- demo: quieter (progress=FALSE) and rely on concise tables
- build: ignore WARP.md in .Rbuildignore
- misc: guard undefined embedding extraction in rag()
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +215 to +238
if (!is.null(annotations_df)) {
# Ensure expected columns exist
if (!"image_path" %in% names(annotations_df)) {
# Try common alternatives
alt <- intersect(c("filepath", "path", "image"), names(annotations_df))
if (length(alt) > 0) {
annotations_df$image_path <- annotations_df[[alt[1]]]
}
}
if (!"index" %in% names(annotations_df)) {
# Fallback to row index if no explicit id
annotations_df$index <- seq_len(nrow(annotations_df))
}
if (!"emotion" %in% names(annotations_df)) {
# Try to find an emotion/label column
emo_col <- grep("emotion|label", names(annotations_df), value = TRUE, ignore.case = TRUE)
if (length(emo_col) > 0) annotations_df$emotion <- annotations_df[[emo_col[1]]]
}

# Derive file name (guard against missing image_path)
ipath <- annotations_df$image_path
ipath[is.null(ipath)] <- ""
ipath[is.na(ipath)] <- ""
annotations_df$image_file <- basename(ipath)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Handle annotations without image_path before deriving filenames

The download helper unconditionally accesses annotations_df$image_path and subsets it (ipath <- annotations_df$image_path; ipath[is.null(ipath)] <- ""). When the annotations returned from load_findingemo_annotations() do not contain an image_path (the bundled Python loader only provides columns such as image_id, valence, arousal), annotations_df$image_path is NULL and the subsetting call throws object of type 'NULL' is not subsettable. This means a successful dataset download will still fail during post-processing on any schema that lacks an image_path column. Guard against the column being absent by creating a safe default (e.g. derive names from image_id or skip matching) before trying to index.

Useful? React with 👍 / 👎.

Comment on lines +76 to +101
# Optional label set enforcement (lowercase normalization)
if (!is.null(labels_set) && length(predictions$pred) > 0) {
allowed <- tolower(labels_set)
pred_low <- tolower(predictions$pred)
keep <- pred_low %in% allowed
if (any(!keep)) {
# Keep rows matching allowed set; drop others with a warning
n_drop <- sum(!keep)
if (n_drop > 0) {
warning(sprintf("Filtered %d predictions not in labels_set", n_drop), call. = FALSE)
}
predictions <- predictions[keep, , drop = FALSE]
}
predictions$pred <- pred_low[keep]
}

# Create evaluation dataset
eval_data <- create_evaluation_dataset(predictions, ground_truth, id_col)

# Forward to evaluate_emotions (probability columns not available here)
results <- evaluate_emotions(
data = eval_data,
truth_col = "truth",
pred_col = "pred",
probs_cols = NULL,
classes = labels_set,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Normalise ground truth and class labels when enforcing labels_set

In validate_rag_predictions() predictions are forced to lowercase when labels_set is supplied, but labels_set itself and the ground_truth vector are left untouched while the lowercased predictions are evaluated against the original labels_set. As a result, if callers pass labels in their natural casing (e.g. c("Joy","Anger")) the predictions become "joy"/"anger" and evaluate_emotions() receives mismatched class levels (classes = labels_set). Those rows are dropped as NAs and metrics are computed on an empty or truncated dataset. Convert labels_set and the ground_truth column to the same normalised case as predictions (or avoid altering the case at all) before delegating to evaluate_emotions().

Useful? React with 👍 / 👎.

@atomashevic atomashevic merged commit fe7d613 into main Sep 16, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants