SequenceFeatureTransformer.get_feature_names_out

SequenceFeatureTransformer.get_feature_names_out(input_features=None)[source]

Output feature names: the CPP feature ids selected in fit() (one per output column).

Each name is a PART-SPLIT-SCALE feature id, so the columns of transform() stay interpretable downstream (for example as row labels of CPPPlot.feature_map() or in a df_feat lookup) and scikit-learn’s set_output / Pipeline naming works.

Added in version 1.1.0.

Parameters:

input_features (array-like of str, optional) – Ignored (the output names are the selected CPP feature ids, not a function of the input columns); present for scikit-learn get_feature_names_out compatibility and to enable set_output(transform="pandas").

Returns:

feature_names_out – The selected CPP feature ids, in the column order of transform()’s output.

Return type:

np.ndarray of str, shape (n_selected_features,)

Examples

After fit, get_feature_names_out returns the selected CPP feature ids (one per output column of transform), which also enables set_output(transform="pandas"). First, the dataset:

import aaanalysis as aa
aa.options["verbose"] = False
df_seq = aa.load_dataset(name="DOM_GSEC", n=20)
labels = df_seq["label"].to_list()

Fit, then read the output feature names (input_features is ignored — the names are the selected feature ids):

sft = aa.SequenceFeatureTransformer(n_filter=25, random_state=42).fit(df_seq, labels)
names = sft.get_feature_names_out(input_features=None)
aa.display_df(__import__("pandas").DataFrame({"feature": names}), n_rows=10, show_shape=True)
DataFrame shape: (25, 1)
  feature
1 TMD-Pattern(C,4,8)-BEGF750101
2 TMD_C_JMD_C-Pat...4,8)-BEGF750101
3 TMD_C_JMD_C-Pat...,12)-CRAJ730103
4 TMD_C_JMD_C-Pat...,12)-MUNV940102
5 TMD_C_JMD_C-Per...4,2)-BEGF750103
6 TMD_C_JMD_C-Pat...,14)-ZIMJ680104
7 TMD_C_JMD_C-Pat...,14)-ZIMJ680104
8 TMD_C_JMD_C-Pat...,14)-MUNV940102
9 TMD-Segment(10,11)-CHAM820102
10 TMD_C_JMD_C-Per...3,1)-AURR980108