CORA and LOGIGRAM

CORA and LOGIGRAM: A Duo of Python Packages for Combinational Regularity Analysis (CORA) - Published in JOSS (2023)

https://github.com/poliunilu/cora

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 31 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: wiley.com, joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Earth and Environmental Sciences Physical Sciences - 40% confidence
Economics Social Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

This repository contains all files for the CORA software package.

Basic Info
  • Host: GitHub
  • Owner: PoliUniLu
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 758 KB
Statistics
  • Stars: 5
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 3
Created over 5 years ago · Last pushed 5 months ago
Metadata Files
Readme License

README.md

CORA

Tests codecov License

DOI status

Open in Colab

logo

CORA is a Python library for Combinational Regularity Analysis (CORA).

Description

Combinational Regularity Analysis (CORA) is a member of the family of Configurational Comparative Methods (CCMs; Thiem et al. 2022). It is thus closely related to Qualitative Comparative Analysis (QCA; Ragin 1987) and Coincidence Analysis (CNA; Baumgartner 2009; Baumgartner and Ambühl 2020). Modern CCMs seek to detect INUS structures in data (Thiem 2017, 2022). Such structures are elaborate cause-effect relations that can be represented in the Boolean language of propositional logic (Baumgartner 2008; Mackie 1965; Psillos 2009). Most importantly, these relations are marked by causal conjunctivity (e.g., $a$ and not $b$ and $c$ and $\cdots$) and causal disjunctivity (e.g., $d$ or $e$ or $f$ or $\cdots$). For this reason, CCMs differ fundamentally from most other empirical research methods (Thiem et al. 2016).

In contrast to QCA and CNA, however, CORA has been inspired by switching circuit analysis, a subfield of electrical engineering. INUS structures and switching circuits have much in common because propositional logic - the language of INUS causation - and switching algebra - the language of switching circuit analysis - are operationally equivalent branches of the same underlying Boolean algebra (Lewin and Protheroe 1992). It is therefore no coincidence that one of the first systematic algorithms for Boolean optimization - the Quine-McCluskey algorithm (McCluskey 1956; Quine 1955) - had been co-developed by an analytical philosopher (Willard Van Orman Quine) and an electrical engineer (Edward J. McCluskey).

Most importantly, CORA is currently the only CCM able to analyze INUS structures that simultaneously feature simple as well as complex effects (e.g., $y$ and not $z$, not $y$ and $z$, $y$ and $z$). CORA can process such structures even in multi-value form (Mkrtchyan et al. 2023). In addition, CORA offers a configurational version of Occam's Razor: a data-mining approach to solution building that reduces model ambiguities by keeping the number of required variables for finding a solution at a minimum. Lastly, CORA includes a lean yet powerful visualization module called LOGIGRAM, with which two-level logic diagrams can be produced from any (system of) Boolean or multi-value function(s) in disjunctive normal form. Logic diagrams considerably outperfrom Venn diagrams, which are often used in QCA, when it comes to the representation and interpretability of INUS structures (Thiem et al. 2023). As a method, CORA is implemented by the duo of Python packages CORA and LOGIGRAM (Sebechlebská et al. 2023).

Installation

CORA requires Python>3.7 and uses Poetry for dependendecy management. Use the package manager pip to install CORA, including all dependencies.

bash pip install git+https://github.com/PoliUniLu/cora.git

It is recommended to install the package into a dedicated virtual environment.

Google Colab

To open CORA with a graphical interface in Google Colab, click the button below:

Open in Colab

Usage

The main features of the package are part of the OptimizationContext class, including functions: - get_prime_implicants, - prime_implicant_chart, - get_irredundant_systems, - get_irredundant_solutions.

Note: Use the help function to access the documentation of CORA.

Example: ```python import pandas as pd from cora import OptimizationContext

df = pd.DataFrame([[1,1,0,1], [0,0,1,1], [1,0,1,0], [0,1,0,1]], columns=["A","B","C","OUT"])

context = OptimizationContext(data = df, outputlabels = ["OUT"]) PIs = context.getprimeimplicants() # result: {B, c, #a}; essential prime implicants marked by hashtags irredundantsolutions = context.getirredundantsums() # result: [M1: #a + B, M2: #a + c] ``` Configurational data-mining is another feature. It analyzes all n-tuples of input combinations to search for feasible tuples of solution-generating inputs. In essence, this feature thus provides a configurational version of Occam's Razor (Feldman 2016).

Example: ```python import pandas as pd import cora

df = pd.DataFrame([[1,2,0,1,1], [1,1,1,0,1], [0,2,1,0,0], [0,2,2,0,1],], columns=["A","B","C","D","OUT"]) result = cora.datamining(df, ["OUT"], lenoftuple = 2, incscore1 = 0.5, ncut = 1) result # print(result.tomarkdown())

| | Combination | Nrofsystems | Incscore | Covscore | Score | |---:|:--------------|----------------:|------------:|------------:|--------:| | 0 | ['A', 'B'] | 1 | 0.75 | 1 | 0.75 | | 1 | ['A', 'C'] | 1 | 1 | 1 | 1 | | 2 | ['A', 'D'] | 1 | 0.75 | 1 | 0.75 | | 3 | ['B', 'C'] | 1 | 1 | 1 | 1 | | 4 | ['B', 'D'] | 1 | 0.75 | 1 | 0.75 | | 5 | ['C', 'D'] | 1 | 0.75 | 1 | 0.75 |

`` To access more examples, see the/examples` folder or follow Open in Colab

Citation Info

When using CORA (method and software), please cite it as follows:

Method:

Thiem, Alrik, Lusine Mkrtchyan, and Zuzana Sebechlebská. 2022. "Combinational Regularity Analysis (CORA) - A New Method for Uncovering Complex Causation in Medical and Health Research." BMC Medical Research Methodology 22 (1):333. Link

Software:

Sebechlebská, Zuzana, Lusine Mkrtchyan and Alrik Thiem. 2023. CORA and LOGIGRAM: A Duo of Python Packages for Combinational Regularity Analysis (CORA)." JOSS: The Journal of Open Source Software 8 (85):5019. Link

Copyright

CORA is licensed under GNU GPLv3.

Contributions

We highly welcome contributions from the community. Feedback, bug reports, and feature requests should be placed as an Issue on GitHub.

Pull requests

To set up a development environment, use Poetry. console pip install poetry poetry install Test the code by running console poetry run pytest Pull requests are welcome. Note that, although the current codebase does not have an entirely consistent code style, the new code should be PEP-8 compliant.

References

  • Baumgartner, Michael. 2008. "Regularity Theories Reassessed." Philosophia 36 (3):327-54. Link
  • Baumgartner, Michael. 2009. "Inferring Causal Complexity." Sociological Methods & Research 38 (1):71-101. Link
  • Baumgartner, Michael, and Mathias Ambühl. 2020. "Causal modeling with multi-value and fuzzy-set Coincidence Analysis." Political Science Research and Methods 8 (3):526-42. Link
  • Feldman, Jacob. 2016. "The Simplicity Principle in Perception and Cognition." Wiley Interdisciplinary Reviews: Cognitive Science 7 (5):330-40. Link
  • Lewin, Douglas, and David Protheroe. 1992. Design of Logic Systems. 2nd ed. London: Chapman & Hall.
  • Mackie, John L. 1965. "Causes and Conditions." American Philosophical Quarterly 2 (4):245-64. Link
  • McCluskey, Edward J. 1956. "Minimization of Boolean Functions." Bell Systems Technical Journal 35 (6):1417-44. Link
  • Mkrtchyan, Lusine, Alrik Thiem, and Zuzana Sebechlebská. 2023. "Re-Establishing a Lost Connection: Multi-Value Logic in Causal Data Analysis in Social Science Disciplines." IEEE Access 11:10471-82. Link
  • Psillos, Stathis. 2009. "Regularity Theories." In The Oxford Handbook of Causation, ed. H. Beebee, C. Hitchcock and P. Menzies. Oxford: Oxford University Press, pp.131-157. Link
  • Quine, Willard V. O. 1955. "A Way to Simplify Truth Functions." American Mathematical Monthly 62 (9):627-31. Link
  • Ragin, Charles C. 1987. The Comparative Method: Moving beyond Qualitative and Quantitative Strategies. Berkeley: University of California Press. Link
  • Sebechlebská, Zuzana, Lusine Mkrtchyan, and Alrik Thiem. 2023. "CORA and LOGIGRAM: A Duo of Python Packages for Combinational Regularity Analysis (CORA)." JOSS: The Journal of Open Source Software 8 (85):5019. Link
  • Thiem, Alrik. 2017. "Conducting Configurational Comparative Research with Qualitative Comparative Analysis: A Hands-On Tutorial for Applied Evaluation Scholars and Practitioners." American Journal of Evaluation 38 (3):420-33. Link
  • Thiem, Alrik. 2022. "Qualitative Comparative Analysis (QCA)." In Handbook of Research Methods in International Relations, ed. R. J. Huddleston, T. Jamieson and P. James. Cheltenham: Edward Elgar, pp.607-28. Link
  • Thiem, Alrik, Lusine Mkrtchyan, and Zuzana Sebechlebská. 2022. "Combinational Regularity Analysis (CORA) - A New Method for Uncovering Complex Causation in Medical and Health Research." BMC Medical Research Methodology 22 (1):333. Link
  • Thiem, Alrik, Zuzana Sebechlebská, and Lusine Mkrtchyan. 2023. "Logic Diagrams: A Visual Tool with Untapped Potential." Nature Reviews Methods Primers 3 (1):21. Link
  • Thiem, Alrik, Michael Baumgartner, and Damien Bol. 2016. "Still Lost in Translation! A Correction of Three Misunderstandings Between Configurational Comparativists and Regressional Analysts." Comparative Political Studies 49 (6):742-74. Link

Owner

  • Name: PoliUniLu
  • Login: PoliUniLu
  • Kind: organization

JOSS Publication

CORA and LOGIGRAM: A Duo of Python Packages for Combinational Regularity Analysis (CORA)
Published
May 08, 2023
Volume 8, Issue 85, Page 5019
Authors
Zuzana Sebechlebská ORCID
University of Lucerne, Switzerland
Lusine Mkrtchyan ORCID
University of Lucerne, Switzerland
Alrik Thiem ORCID
University of Lucerne, Switzerland
Editor
Vissarion Fisikopoulos ORCID
Tags
configurational comparative method multi-output optimization combinational regularity analysis switching circuit analysis

GitHub Events

Total
  • Watch event: 1
  • Push event: 3
Last Year
  • Watch event: 1
  • Push event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 347
  • Total Committers: 3
  • Avg Commits per committer: 115.667
  • Development Distribution Score (DDS): 0.305
Past Year
  • Commits: 6
  • Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Zuzana Sebechlebská z****a@g****m 241
Alrik Thiem a****m@g****m 69
Lusine Mkrtchyan 7****k 37

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 13
  • Total pull requests: 8
  • Average time to close issues: 7 months
  • Average time to close pull requests: about 13 hours
  • Total issue authors: 5
  • Total pull request authors: 2
  • Average comments per issue: 0.31
  • Average comments per pull request: 0.0
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Naeemkh (6)
  • ZuzanaSebb (3)
  • AlrikThiem (2)
  • Ianyliu (1)
  • vissarion (1)
Pull Request Authors
  • LusineMk (7)
  • ZuzanaSebb (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/coverage.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • codecov/codecov-action v3 composite
.github/workflows/python-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
poetry.lock pypi
  • NativePetric 0.2
  • numpy 1.22.0
  • numpy 1.23.5
  • pandas 1.5.3
  • parameterized 0.8.1
  • python-dateutil 2.8.2
  • pytz 2023.3
  • six 1.16.0
pyproject.toml pypi