Skip to content

Added print statements for probabilities without .max(axis=1), made various changes in training script, evaluation script and data processing script.#9

Merged
saattrupdan merged 18 commits into
mainfrom
annika
Aug 7, 2025
Merged

Added print statements for probabilities without .max(axis=1), made various changes in training script, evaluation script and data processing script.#9
saattrupdan merged 18 commits into
mainfrom
annika

Conversation

@AnnikaSimonsen
Copy link
Copy Markdown
Collaborator

No description provided.

@saattrupdan saattrupdan marked this pull request as ready for review August 6, 2025 10:09
Copilot AI review requested due to automatic review settings August 6, 2025 10:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the generative model training and evaluation pipeline to use scikit-learn pipelines with integrated normalization, adds a new evaluation script for LLM benchmarking, and includes debugging output for probability analysis.

Key changes:

  • Modified data processing to optionally skip normalization and return fitted scalers
  • Refactored training to use sklearn pipelines combining MinMaxScaler and GaussianMixture
  • Added comprehensive evaluation script with probability analysis and debugging output

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/scripts/train_generative_model.py Simplified data loading logic and integrated with new pipeline approach
src/scripts/evaluate_llm_benchmark.py New evaluation script for LLM benchmarking with probability analysis
src/european_values/llm_evaluation.py New module implementing GMM-based evaluation with pipeline support
src/european_values/generative_training.py Refactored to use sklearn pipelines and added extensive probability debugging
src/european_values/data_processing.py Modified to support optional normalization and return fitted scalers

Comment thread src/european_values/generative_training.py Outdated
Comment thread src/european_values/generative_training.py
Comment thread src/european_values/generative_training.py
Comment thread src/european_values/llm_evaluation.py
Comment thread src/european_values/llm_evaluation.py
Comment thread src/european_values/data_processing.py Outdated
Comment thread src/european_values/generative_training.py Outdated
Comment thread src/european_values/generative_training.py Outdated
Comment thread src/european_values/generative_training.py Outdated
Comment thread src/european_values/generative_training.py Outdated
Comment thread src/scripts/evaluate_llm_benchmark.py Outdated
Comment thread src/scripts/evaluate_llm_benchmark.py Outdated
Comment thread src/scripts/evaluate_llm_benchmark.py Outdated
Comment thread src/scripts/train_generative_model.py Outdated
Comment thread src/scripts/train_generative_model.py Outdated
AnnikaSimonsen and others added 9 commits August 6, 2025 10:36
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
@saattrupdan
Copy link
Copy Markdown
Member

@AnnikaSimonsen Please mark my comments as resolved if you've fixed them by now. Also, there's a code check failing, which is due to the processing function returning a tuple now. Needs to be fixed in the train_discriminative_classifier, optimise_survey, and create_plot scripts.

AnnikaSimonsen and others added 5 commits August 7, 2025 08:01
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
Co-authored-by: Dan Saattrup Smart <47701536+saattrupdan@users.noreply.github.com>
- Update train_discriminative_classifier.py to handle (df, scaler) return
- Update optimise_survey.py to handle (df, scaler) return
- Update create_plot.py to handle (df, scaler) return
- Fixes failing CI code check
…llm_benchmark.py

- Remove unnecessary load_gmm_pipeline function, use joblib.load directly
- Simplify process_responses function with minimal NaN handling
- Try pipeline.predict_proba() first, fallback to component access
- Add flexible data loading to support both EVS trend and EVS/WVS datasets
- Fix tuple unpacking for process_data return value

Addresses reviewer feedback
Comment thread src/scripts/evaluate_llm_benchmark.py Outdated
"""Main evaluation function."""
# Load data
logger.info("Loading data...")
df = load_evs_wvs_data()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still missing this one

from european_values.data_processing import process_data
from european_values.generative_training import train_generative_model
from european_values.generative_training import (
train_generative_model, # <-- This was missing!
Copy link
Copy Markdown
Member

@saattrupdan saattrupdan Aug 7, 2025

Choose a reason for hiding this comment

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

Nit: No internal comments in the code please 🙂

Suggested change
train_generative_model, # <-- This was missing!
train_generative_model

Copy link
Copy Markdown
Member

@saattrupdan saattrupdan left a comment

Choose a reason for hiding this comment

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

Looks good now!

@saattrupdan saattrupdan merged commit 0bda7c4 into main Aug 7, 2025
2 checks passed
@saattrupdan saattrupdan deleted the annika branch August 7, 2025 11:37
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.

3 participants