explain_feature#

SurveyTangles.explain_feature(feature_id: int, specification: int, insert_labels: bool = True, extract_const_answers: bool = True) DataFrame | Tuple[DataFrame, DataFrame]#

Create a dataframe containing information about a feature specification. If the feature is a compound feature, i.e. a corner of other features, the resulting data frame contains the logical formula describing the feature in Disjunctive Normal Form. Every row of the dataframe describes a conjunction of features, the overall formula then is a logical or of all rows. In other words, respondents belong to the feature, if they answer the questions according to the answers given by at least one of the rows.

Parameters#

feature_idint

the id of the feature

specificationint

the specification given by -1 (complement) or 1.

insert_labelsbool

If True, the variable names in the metadata are replaced by the variables’ labels. Often the label is the question text.

extract_const_answersbool

If True, two dataframes are returned. This parameter only makes sense for compound features (corners), in this case, one of the data frames contains the literals that are part of every conjunction in the DNF of the description

Returns#

pandas.DataFrame or tuple (DataFrame, DataFrame)

A dataframe containing a DNF representation of a logical formula describing the given specified feature. If the argument extract_const_answers is True, a second dataframe is returned containing the literals that are equal in every conjunction of the DNF.