Skip to main content

Comparative Judgement

A package for comparative judgement (CJ).

Installation

Dependencies

comparative-judgement requires:

  • Python (>= |PythonMinVersion|)
  • NumPy (>= |NumPyMinVersion|)
  • SciPy (>= |SciPyMinVersion|)
  • Ray

User installation

If you already have a working installation of NumPy and SciPy, the easiest way to install comparative_judgement is using pip::

    pip install comparative-judgement
    conda install -c conda-forge comparative-judgement

Bayesian CJ

Importing the BCJ model and initiating a instance of the model with 4 samples:

from cj.models import BayesianCJ

BCJ = BayesianCJ(4)

Creating the data:

import numpy as np

data = np.asarray([
    [0, 1, 0],
    [0, 1, 0],
    [0, 3, 0],
    [1, 0, 1],
    [1, 0, 1],
    [1, 0, 1],
    [1, 2, 1],
    [1, 2, 1],
    [1, 2, 1],
    [1, 2, 1],
    [1, 2, 1],
    [2, 1, 2],
    [2, 1, 2],
    [2, 1, 2],
    [2, 3, 2],
    [3, 0, 3],
    [3, 0, 3],
    [3, 0, 3],
    [3, 0, 3],
    [3, 2, 3],
    [3, 2, 3],
    [3, 2, 3],
])

running the model:

BCJ.run(data)

Finding the $\mathbb{E}[\mathbf{r}]$

BCJ.Er_scores
>>> [3.046875, 2.09765625, 3.05859375, 1.796875]

Finding the BCJ rank:

BCJ.rank
>>> array([3, 1, 0, 2])

Multi-Criteria BCJ

Importing the BCJ model and initiating a instance of the model with 4 samples:

from cj.models import MBayesianCJ

criteria_weights = [0.2, 0.2, 0.6]

MBCJ = MBayesianCJ(3, criteria_weights)
data = [
    #A, B,C1, 2, 3  
    [0, 1, 1, 1, 1],
    [1, 2, 1, 1, 1],
    [0, 2, 0, 0, 2]
]

running the model:

MBCJ.run(data)

Finding the overall MBCJ rank:

MBCJ.combined_rank
>>> array([1, 2, 0])

Finding the individual criteria BCJ ranks:

MBCJ.lo_rank_scores
>>> {0: [np.float64(2.0), np.float64(1.5), np.float64(2.5)],
     1: [np.float64(2.0), np.float64(1.5), np.float64(2.5)],
     2: [np.float64(2.5), np.float64(1.5), np.float64(2.0)]}

Traditional BTM CJ

Importing the BTM Model a instance of the model with 4 samples:

from cj.models import BTMCJ

BTM = BTMCJ(4)

running the model:

BTM.run(data)

Finding the optimised p scores:

BTM.optimal_params
>>> array([-0.44654627,  0.04240265, -0.41580243,  0.81994508])

find BTM rank:

BTM.rank
>>> array([3, 1, 2, 0])

Pair Selection Methods

Entropy

from cj.pair_selector import EntropyPairSelector
entropy_pairs = EntropyPairSelector(5)
scores = [55, 65, 72, 45, 80]
standard_dev = 5
entropy_pairs.run_entropy_pairs_simulation(scores, standard_dev)
entropy_pairs.results
>>> [[1, 4, 4],
 [1, 3, 1],
 [2, 3, 2],
 [1, 2, 2],
 [0, 2, 2],
 [0, 4, 4],
 [0, 1, 1],
 [3, 4, 4],
 [0, 3, 0],
 [2, 4, 4],
 [1, 2, 2],
 [2, 3, 2],
 [1, 4, 4],
 [3, 4, 4],
 [2, 4, 4],
 [0, 4, 4],
 [0, 2, 2],
 [0, 1, 1],
 [0, 3, 0],
 [1, 3, 1],
 [1, 4, 4],
 [0, 1, 1],
 [0, 4, 4],
 [3, 4, 4],
 [2, 3, 2],
...
 [2, 4, 4],
 [0, 1, 1],
 [0, 4, 4],
 [2, 3, 2],
 [1, 2, 2]]

Citing this Library:

@misc{comparative_judgement,
    author = {Andy Gray},
    title = {Comparative Judgement},
    year = {2024},
    publisher = {Python Package Index (PyPI)},
    howpublished = {\url{https://pypi.org/project/comparative-judgement/}}
}

Metadata

Release files for comparative-judgement 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for comparative-judgement 0.0.7
File Size Uploaded Provenance
comparative_judgement-0.0.7.tar.gz 11.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for comparative-judgement 0.0.7
File Interpreter ABI Platform
comparative_judgement-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / comparative_judgement-0.0.7.tar.gz

Download URL comparative_judgement-0.0.7.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e9bb3d13da3d1cac9dcf04a52c76b99e844a98948190023eda33ef8cd7dd2179
BLAKE2b-256 checksum
How to use checksums
1e9c001b676c4a0877ec83b0061b3225da6bd613dbfdef6e5c83ac4fc09f9890
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / comparative_judgement-0.0.7-py3-none-any.whl

Download URL comparative_judgement-0.0.7-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc07376bc9f40c1e90a25f54e35d3111e056d9cae2f93c0c2119a53af913c11f
BLAKE2b-256 checksum
How to use checksums
93d1e2cf40dbc2321ff2a143d23090e633fe3a676b4aee2f3bf5131d4de395fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for comparative-judgement 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page