# Online Model Selection

## Repository Structure

This repository contains the code and datasets for online model selection experiments using contextual bandits with active learning.

### Directory Organization

```
├── create_dataset/          # Dataset generation scripts
│   ├── create_dataset_T2I.py     # Generate text-to-image datasets with CLIP scores
│   ├── create_dataset_LLM.py     # Generate LLM evaluation datasets
│   ├── change_scores.py          # Convert CLIP scores to ImageReward scores
│   └── generate_prompts.ipynb    # Prompt generation notebook
│
├── experiments/             # Experimental scripts and algorithm implementations
│   ├── compare_to_baselines.py        # Main T2I baseline comparison
│   ├── compare_to_baselines_LLM.py    # LLM baseline comparison
│   ├── compare_to_baselines_gert.py   # GERT baseline comparison
│   ├── model_addition.py              # Dynamic model addition experiments
│   ├── model_removal.py               # Dynamic model removal experiments
│   ├── n_models_queries.py            # K-query budget analysis
│   ├── budget.py                      # Budget sensitivity analysis
│   ├── theta.py                       # Hyperparameter tuning
│   ├── uncertainty_methods.py         # Uncertainty estimation ablation
│   ├── queries_comparison.py          # Query strategy comparison
│   ├── intermediate_results.py        # Intermediate results analysis
│   ├── query_trigger_strategies.py    # Query triggering strategies
│   ├── classes/                       # Algorithm implementations
│   │   ├── active_knn_ucb.py         # KNN-UCB with active learning
│   │   ├── pakucb.py                 # Polynomial kernel UCB
│   │   ├── linucb.py                 # Linear UCB
│   │   └── neuronal_s_nets.py        # Neural network baselines
│   ├── data/                          # Experimental results (pickled)
│   └── plots/                         # Generated plots and figures
│
├── figures/                 # Visualization and plotting notebooks
    ├── figures.ipynb                       # Main figures notebook
    ├── cut_plots.ipynb                     # Plot processing
    ├── plot_compare_to_baselines.ipynb     # T2I baseline plots
    ├── plot_compare_to_baselines_LLM.ipynb # LLM baseline plots
    ├── plot_query_trigger_strategies.ipynb # Query strategy plots
    ├── plot_n_models_queries.ipynb         # K-query analysis plots
    ├── plot_motivation.ipynb               # Motivation figures


### Key Components

**Datasets**: Contains metadata JSON files with prompts, model outputs, and evaluation scores. Each dataset includes results from multiple generative models evaluated on various prompts.

**Experiments**: Python scripts implementing bandit algorithms and running comparative experiments. The `classes/` subdirectory contains core algorithm implementations.

**Figures**: Jupyter notebooks for generating plots and visualizations from experimental results. The `final_plots/` directory contains publication-ready figures and tables.

**Create Dataset**: Tools for generating new datasets by running models on prompts and computing evaluation metrics (CLIP scores, ImageReward, etc.).