Skip to content

KPlanisphere/precision-r-comparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Precision R Table Comparison

This repository contains a Python script for comparing precision R values from two separate teams and generating a final table that highlights differences and averages.

Features

  • File Processing:
    • Reads and processes input files containing precision R values in a markdown-style table format.
  • Comparison:
    • Calculates the difference between precision R values from two teams for each query.
  • Summary Row:
    • Adds a summary row with the average precision R values and their differences.
  • Output:
    • Saves the final table in a readable text format.

Files

  • lab8.py: Main Python script for reading, processing, and comparing precision R values.
  • metrics_results.txt: Input file containing precision R values from Team 1.
  • metrics_results_gnok.txt: Input file containing precision R values from Team 2.
  • tabla_final.txt: Output file containing the comparison table with differences and averages.

How It Works

  1. Read Input Files: The script reads the precision R values from metrics_results.txt and metrics_results_gnok.txt. The columns are parsed, cleaned, and converted into numeric format.

  2. Calculate Differences: For each query, the difference between Team 1's and Team 2's precision R values is computed.

  3. Add Summary Row: The average precision R values for both teams and the mean difference are calculated and appended as a special row labeled P(PR).

  4. Save Final Table: The resulting table is saved as tabla_final.txt with a structured format:

    Consulta  PRA(i)  PRB(i)  PRA(i)-PRB(i)
           1   0.850   0.800          0.050
           2   0.780   0.750          0.030
          ...    ...     ...            ...
       P(PR)   0.815   0.775          0.040
    

Usage

  1. Clone the repository:

    git clone https://github.com/KPlanisphere/precision-r-comparison.git
    cd precision-r-comparison
  2. Place the input files (metrics_results.txt, metrics_results_gnok.txt) in the directory or update their paths in lab8.py.

  3. Run the script:

    python lab8.py
  4. Check the output in tabla_final.txt.

Requirements

  • Python 3.10+
  • pandas

To install the required library, run:

pip install pandas

Notes

  • Ensure the input files follow the expected markdown-style table format with a | delimiter.
  • The script includes error handling for missing or non-numeric data.