Skip to main content

A package for conducting Comparative Judgement

Project description

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])

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])

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/}}
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

comparative_judgement-0.0.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file comparative_judgement-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for comparative_judgement-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aac47a41f3bb7ec9a4390950c869c3adc5f178c6fd27362682502006f4d1c5ce
MD5 903987e0de89e707416ada9627015c25
BLAKE2b-256 2c9f1d642cccbe37777b8aa1fff8542a5941881c85435e76c4fc2f0465c2956a

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