teras.utils.compute_cardinalities#
- teras.utils.compute_cardinalities(x, categorical_idx, ordinal_encoded=True)[source]#
Compute cardinalities for features in the given dataset/dataframe. For numerical features, 0 is used as a placeholder.
- Parameters:
x – Input dataset or dataframe.
categorical_idx (
list) – list, a list of indices of categorical features in the given dataset.ordinal_encoded (
bool) – bool, Whether the categorical values have been ordinal encoded. Defaults to True.
- Returns:
A 1d numpy array of cardinalities of all features. For numerical features, a value of 0 is used.