Result objects

class qca.QCAFitResult(truth_table_rows, minimization, solution_metrics, case_coverage, condition_schema=<factory>, settings=<factory>, selected_solution_type='intermediate', outcome=None, case_id=None, qca_type='GSQCA')[source]

High-level result returned by PyQCA engines.

This wraps backend-specific minimization output while exposing a stable, inspectable PyQCA surface: truth table, solutions, aggregate consistency and coverage, case-level coverage, and export helpers.

Parameters:
  • truth_table_rows (list[TruthTableRow])

  • minimization (QMSolution)

  • solution_metrics (dict[str, SufficiencyResult | None])

  • case_coverage (DataFrame)

  • condition_schema (DataFrame)

  • settings (dict[str, Any])

  • selected_solution_type (str)

  • outcome (str | None)

  • case_id (str | None)

  • qca_type (str)

property truth_table: DataFrame

Truth table as a DataFrame.

property solutions: DataFrame

Solution terms with aggregate metrics for each solution type.

property consistency: float | None

Consistency of the selected solution, or None if no solution exists.

property coverage: float | None

Coverage of the selected solution, or None if no solution exists.

property selected_solution: SufficiencyResult | None

Aggregate sufficiency result for the selected solution type.

property qm_solution: QMSolution

Compatibility alias for the backend QMC result.

property workflow: str | None

Workflow label recorded by the engine, when available.

property formula: str | None

Formula for the selected solution type.

property selected_formula: str | None

Compatibility alias for formula.

property formulas: dict[str, str]

Formula strings keyed by solution type.

to_formulas()[source]

Return minimized formulas for all available solution types.

Return type:

dict[str, str]

to_formula(solution_type=None)[source]

Return one minimized formula.

When solution_type is omitted, the selected solution type is used. Available solution types are complex, parsimonious, and intermediate.

Parameters:

solution_type (str | None)

Return type:

str | None

export_formula(path, solution_type=None)[source]

Write one minimized formula to a text file and return it.

Parameters:
  • path (str | Path)

  • solution_type (str | None)

Return type:

str | None

to_dataframe()[source]

Return the solution table as a DataFrame.

Return type:

DataFrame

to_markdown(path=None)[source]

Render a compact Markdown report and optionally write it to disk.

Parameters:

path (str | Path | None)

Return type:

str

to_markdown_report(path=None)[source]

Render the v0.6 automated Markdown report.

Parameters:

path (str | Path | None)

Return type:

str

to_latex(path=None, *, table='solutions', caption=None, label=None)[source]

Render one result table as LaTeX.

Parameters:
  • path (str | Path | None)

  • table (str)

  • caption (str | None)

  • label (str | None)

Return type:

str

to_jupyter_summary()[source]

Return a notebook-friendly summary object.

summary()[source]

Return a short human-readable summary.

Return type:

str

class qca.SufficiencyResult(antecedent, consistency, raw_coverage, unique_coverage, n_cases_in)[source]

Result of a sufficiency analysis.

Parameters:
  • antecedent (str)

  • consistency (float)

  • raw_coverage (float)

  • unique_coverage (float | None)

  • n_cases_in (int)

property is_sufficient: bool

Return whether the result meets the sufficiency criteria.

property strength: str

Return a qualitative strength label.

to_dict()[source]

Return a dictionary representation.

Return type:

dict[str, Any]

to_series()[source]

Return a pandas Series representation.

Return type:

Series

class qca.NecessityResult(condition, consistency, coverage, n_cases_in)[source]

Result of a necessity analysis.

Parameters:
  • condition (str)

  • consistency (float)

  • coverage (float)

  • n_cases_in (int)

property is_necessary: bool

Is necessary.

property is_trivial: bool

Is trivial.

property strength: str

Return a qualitative strength label.

to_dict()[source]

Return a dictionary representation.

Return type:

dict[str, Any]

to_series()[source]

Return a pandas Series representation.

Return type:

Series

class qca.TruthTableRow(config, n_cases, outcome_mean, outcome_raw_consist, case_ids, include=None, pri_consistency=None)[source]

One row in a QCA truth table.

Parameters:
  • config (dict[str, Any])

  • n_cases (int)

  • outcome_mean (float)

  • outcome_raw_consist (float)

  • case_ids (list[str])

  • include (bool | None)

  • pri_consistency (float | None)

property is_positive: bool

Return whether this row is included in the outcome.

property is_negative: bool

Return whether this row is excluded from the outcome.

property is_undecided: bool

Is undecided.

property n_cases_in_outcome: int

N cases in outcome.

to_dict()[source]

Return a dictionary representation.

Return type:

dict[str, Any]

to_series()[source]

Return a pandas Series representation.

Return type:

Series