Skip to main content

Implements Selective Preference Aggregation (SPA), a rank aggregation framework that constructs collective rankings while limiting the fraction of individual preferences that can be overruled.

Project description

SPA

Selective Preference Aggregation

├── data         # processed datasets                `data_dir`
├── spa          # source code                       `pkg_dir`
├── scripts      # scripts that run source code                            
├── results      # results                           `results_dir`
├── reporting    # source code for reporting
├── reports      # reports                           `reports_dir`          			

1. Add Your Dataset

  1. Location: Create a subfolder for your dataset within the data/ directory (e.g., data/movie/).

  2. File Naming: Place your data file(s) in this subfolder, named according to the pattern: {dataset_name}_{type}.csv (e.g., movie_ratings.csv, movie_pairwise.csv).

  3. Data Format: Ensure your CSV file matches one of the following structures based on the {type} in your filename:

    • For ranking or rating types:

      • Headers (First Row): User ids.
      • First Column: Item ids.
      • Cell A1 (Top-Left): Must contain the exact text item_name.
      • Data Cells: Preference values (rating or rank) given by the user (column) for the item (row)

      Example (movie_ratings.csv):

      item_name,user101,user102,user103
      ItemA,5,4,3
      ItemB,3,4,5
      ItemC,2,1,4
      ItemD,1,2,2
      
    • For pairwise comparison types:

      • Headers (First Row): Must be exactly judge_id, item_id_1, item_id_2, pref.
      • Rows: Each row represents a single comparison made by a judge_id.
      • pref Column: Indicates the user preference:
        • 1: item_id_1 is preferred over item_id_2.
        • -1: item_id_2 is preferred over item_id_1.
        • 0: Represents a tie or indifference.

      Example (movie_pairwise.csv):

      judge_id,item_id_1,item_id_2,pref
      judgeA,itemX,itemY,1
      judgeA,itemY,itemZ,-1
      judgeB,itemX,itemY,0
      judgeB,itemX,itemZ,1
      judgeC,itemY,itemZ,1
      

2. Configure and Run Experiments

  1. Update Dataset Creation Script:

    • Open the file scripts/create_datasets.py.
    • Find the settings dictionary.
    • Add the {dataset_name} string (e.g., "movie") from Step 1 to the data_names list.
      settings = {
          "data_names": ["movie"], 
          ...
      }
      
    • Execute the script
  2. Update Main Experiment Script:

    • Open the file scripts/dev_spa.py.
    • Find the settings dictionary within this script.
    • Add the same {dataset_name} string to the data_names list (or similar configuration entry) in this file as well.
      settings = {
          "data_names": ["movie"], # Added "movie"
          "seed": 2338,
          ...
      }
      
    • Execute dev_spa.py

3. Generating and Viewing Results

  1. Aggregate Base Results:

    • Configure settings within scripts/aggregate_base_results.py.
    • Execute the script .
  2. Combine All Results:

    • Configure settings within scripts/combine_all_results.py.
    • Execute the script.
  3. Locate Output CSV:

    • The final, combined results are saved as a CSV file within the results/ directory (results_dir).
    • The filename includes a timestamp for uniqueness.
  4. (Optional) Generate LaTeX Table:

    • Modify and run the R script located at scripts/create_big_table.R. Update the script to point to the correct input CSV file from the previous step.
    • This will output a .tex file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selectiverank-0.0.1.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

selectiverank-0.0.1-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file selectiverank-0.0.1.tar.gz.

File metadata

  • Download URL: selectiverank-0.0.1.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for selectiverank-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8e07be6708e13a62a782b4b54f613e8c3e3133fc08452ec2cf7bca92cc096859
MD5 b1f3b237064e98393e9a762a016e97cd
BLAKE2b-256 d1ba94d82c865d93de43b058cdecd0cfcb9f1ce1aa963f6febd63e6d2a7a3f92

See more details on using hashes here.

File details

Details for the file selectiverank-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: selectiverank-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for selectiverank-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4732fb86ab59d9f510cdaf2613155fa1f2b1df7d30e45c1436da89e17578e9ac
MD5 2596dc41b6ae2bf698c1825f87dd0b1c
BLAKE2b-256 669788d0b5c78f2c6765adf81109f87306d8355f73b1227732d5601333694384

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page