QCA engines

class qca.QCAEngineBase(data, case_id=None, set_conditions=None, multivalue_conditions=None, outcome=None, conditions=None, condition_types=None, condition_specs=None)[source]

Bases: object

Shared computational base for QCA engines.

Parameters:
  • data (pd.DataFrame)

  • case_id (str | None)

  • set_conditions (Sequence[str] | None)

  • multivalue_conditions (Sequence[str] | None)

  • outcome (str | None)

  • conditions (Sequence[str] | None)

  • condition_types (dict[str, str] | None)

  • condition_specs (Sequence[ConditionSpec] | None)

classmethod from_condition_specs(data, outcome, condition_specs, case_id=None)[source]

Build a model from normalized ConditionSpec objects.

Parameters:
  • data (DataFrame)

  • outcome (str)

  • condition_specs (Sequence[ConditionSpec])

  • case_id (str | None)

Return type:

QCAEngineBase

property n_cases: int

Return the number of cases.

property n_conditions: int

Return the number of conditions.

property all_condition_names: list[str]

Return all condition names in engine order.

property condition_spec_map: dict[str, ConditionSpec]

Return normalized condition specs keyed by condition name.

property condition_schema: DataFrame

Return the normalized QCA condition schema.

property outcome_series: Series

Return the outcome series as floats.

fit(consistency_cutoff=None, coverage_cutoff=None, minimizer='standard', outcome_threshold=None, consistency_threshold=None, pri_cut=0.0, frequency_cutoff=1, directional_expectations=None, include_remainders_in_parsimonious=True)[source]

Run QCA minimization and return a unified PyQCA result object.

The low-level QMC output remains available as result.minimization and result.qm_solution. The high-level result exposes the stable PyQCA surface described in the README: truth_table, solutions, consistency, coverage, case_coverage, to_dataframe(), and to_markdown().

Parameters:
  • consistency_cutoff (float | None)

  • coverage_cutoff (float | None)

  • minimizer (str)

  • outcome_threshold (float | None)

  • consistency_threshold (float | None)

  • pri_cut (float)

  • frequency_cutoff (int)

  • directional_expectations (dict[str, Any] | None)

  • include_remainders_in_parsimonious (bool)

analyze(*args, **kwargs)[source]

Alias for fit() for workflow-style high-level API usage.

Parameters:
  • args (Any)

  • kwargs (Any)

conjunction_membership(literals)[source]

Compute fuzzy membership for a conjunction.

Parameters:

literals (Sequence[SetLiteral | MultiValueLiteral])

Return type:

Series

disjunction_membership(terms)[source]

Compute fuzzy membership for a disjunction.

Parameters:

terms (Sequence[Sequence[SetLiteral | MultiValueLiteral]])

Return type:

Series

evaluate_sufficiency(literals, solution_coverage=None)[source]

Evaluate sufficiency for one conjunction.

Parameters:
Return type:

SufficiencyResult

evaluate_solution(terms)[source]

Evaluate solution.

Parameters:

terms (Sequence[Sequence[SetLiteral | MultiValueLiteral]])

Return type:

SufficiencyResult

evaluate_necessity(literal)[source]

Evaluate necessity for one literal.

Parameters:

literal (SetLiteral | MultiValueLiteral)

Return type:

NecessityResult

compute_solution_coverages(terms)[source]

Compute unique coverage for terms in a solution.

Parameters:

terms (Sequence[Sequence[SetLiteral | MultiValueLiteral]])

Return type:

list[SufficiencyResult]

search_sufficient_configurations(max_depth=3, include_negations=True, min_consistency=0.8, min_coverage=0.1, min_cases=1)[source]

Search candidate sufficient configurations.

Parameters:
  • max_depth (int)

  • include_negations (bool)

  • min_consistency (float)

  • min_coverage (float)

  • min_cases (int)

Return type:

DataFrame

search_necessary_conditions(include_negations=True, min_consistency=0.9, min_coverage=0.1)[source]

Search candidate necessary conditions.

Parameters:
  • include_negations (bool)

  • min_consistency (float)

  • min_coverage (float)

Return type:

DataFrame

build_truth_table(outcome_threshold=0.5, pri_cut=0.0)[source]

Build a QCA truth table.

Parameters:
  • outcome_threshold (float)

  • pri_cut (float)

Return type:

list[TruthTableRow]

truth_table_to_df(outcome_threshold=0.5, pri_cut=0.0)[source]

Return the truth table as a DataFrame.

Parameters:
  • outcome_threshold (float)

  • pri_cut (float)

Return type:

DataFrame

class qca.CSQCA(data, outcome, conditions=None, case_id=None, condition_types=None, set_conditions=None)[source]

Bases: QCAEngineBase

First-class csQCA engine for crisp binary set conditions.

Parameters:
  • data (pd.DataFrame)

  • outcome (str)

  • conditions (Sequence[str] | None)

  • case_id (str | None)

  • condition_types (dict[str, str] | None)

  • set_conditions (Sequence[str] | None)

class qca.MVQCA(data, outcome, conditions=None, case_id=None, condition_types=None, multivalue_conditions=None)[source]

Bases: QCAEngineBase

First-class mvQCA engine for categorical multi-value conditions.

Parameters:
  • data (pd.DataFrame)

  • outcome (str)

  • conditions (Sequence[str] | None)

  • case_id (str | None)

  • condition_types (dict[str, str] | None)

  • multivalue_conditions (Sequence[str] | None)

class qca.FSQCA(data, outcome, conditions=None, case_id=None, condition_types=None, set_conditions=None)[source]

Bases: QCAEngineBase

First-class fsQCA engine for calibrated set conditions.

Parameters:
  • data (pd.DataFrame)

  • outcome (str)

  • conditions (Sequence[str] | None)

  • case_id (str | None)

  • condition_types (dict[str, str] | None)

  • set_conditions (Sequence[str] | None)

class qca.GSQCA(data, case_id=None, set_conditions=None, multivalue_conditions=None, outcome=None, conditions=None, condition_types=None, condition_specs=None, schema=None)[source]

Bases: QCAEngineBase

Generalized-set QCA over crisp, fuzzy, and multi-value conditions.

GSQCA provides a generalized-set interface in which crisp-set, fuzzy-set, and multi-value QCA can be handled by a common truth-table and minimization workflow. The implementation is designed to make the generalized-set assumptions explicit in PyQCA rather than to claim one-to-one compatibility with any single external package. Multi-value conditions can be represented either by a crisp categorical column or by value-specific calibrated membership columns through qca.ConditionSpec.value_columns.

Parameters:
  • data (pd.DataFrame)

  • case_id (str | None)

  • set_conditions (Sequence[str] | None)

  • multivalue_conditions (Sequence[str] | None)

  • outcome (str | None)

  • conditions (Sequence[str] | None)

  • condition_types (dict[str, str] | None)

  • condition_specs (Any | None)

  • schema (Any | None)

classmethod from_schema(data, outcome, schema, case_id=None)[source]

Build GSQCA from a unified condition schema.

Parameters:
  • data (DataFrame)

  • outcome (str)

  • schema (Any)

  • case_id (str | None)

Return type:

GSQCA

classmethod from_condition_specs(data, outcome, condition_specs, case_id=None)[source]

Build GSQCA from normalized ConditionSpec objects.

Parameters:
  • data (DataFrame)

  • outcome (str)

  • condition_specs (Sequence[ConditionSpec])

  • case_id (str | None)

Return type:

GSQCA

property schema: DataFrame

Alias for the normalized condition schema.

property workflow_kinds: tuple[str, ...]

Condition kinds present in this workflow, in canonical order.

property workflow: str

Human-readable workflow label derived from the condition schema.

property is_generalized_workflow: bool

Whether the model combines more than one condition kind.

property has_crisp_conditions: bool

Return whether crisp-set conditions are present.

property has_fuzzy_conditions: bool

Return whether fuzzy-set conditions are present.

property has_multivalue_conditions: bool

Return whether multi-value conditions are present.