Conditions and literals

class qca.ConditionSpec(name, kind, domain=None, calibrated=None, value_columns=None)[source]

Normalized description of one QCA condition.

Public engines can accept friendly APIs such as conditions plus condition_types or legacy set_conditions. Internally they should converge on this small schema object so csQCA, fsQCA, mvQCA, and gsQCA share the same condition contract.

Parameters:
  • name (str)

  • kind (Literal['crisp', 'fuzzy', 'multi'])

  • domain (tuple[Any, ...] | None)

  • calibrated (bool | None)

  • value_columns (Mapping[Any, str] | None)

qca.condition_specs_from_schema(schema)[source]

Normalize a user-facing condition schema into ConditionSpec objects.

Accepted inputs are:

  • a sequence of ConditionSpec objects;

  • a sequence of mapping objects with name and kind/type fields;

  • a pandas-like DataFrame with matching columns.

Optional mapping/DataFrame fields are domain, calibrated, and value_columns. value_columns maps a multi-value domain value to a calibrated membership column, which is the schema representation used for generalized-set QCA multivalent fuzzy set variables.

Parameters:

schema (Any)

Return type:

list[ConditionSpec]

class qca.SetLiteral(name, negated=False)[source]

Literal for a crisp-set or fuzzy-set condition.

Parameters:
  • name (str)

  • negated (bool)

label()[source]

Return a human-readable label.

Return type:

str

membership(df)[source]

Return membership scores for this literal.

Parameters:

df (DataFrame)

Return type:

Series

negate()[source]

Return the negated literal.

Return type:

SetLiteral

is_negation_of(other)[source]

Return whether another literal is the logical negation of this one.

Parameters:

other (object)

Return type:

bool

class qca.MultiValueLiteral(name, value)[source]

Literal for a multi-value QCA condition.

Parameters:
  • name (str)

  • value (Any)

label()[source]

Return a human-readable label.

Return type:

str

membership(df)[source]

Return membership scores for this literal.

Parameters:

df (DataFrame)

Return type:

Series

conflicts_with(other)[source]

Conflicts with.

Parameters:

other (object)

Return type:

bool

qca.parse_literal(text)[source]

Parse a literal label into a literal object.

Parameters:

text (str)

Return type:

SetLiteral | MultiValueLiteral

qca.parse_conjunction(text)[source]

Parse a conjunction label into literal objects.

Parameters:

text (str)

Return type:

list[SetLiteral | MultiValueLiteral]