You can group features into categories to automatically assign a unique color to each group. This is useful for distinguishing between different types of variables (e.g., 'treatment' vs 'outcome').
When using category_to_features, if you do not provide a labels list, the node labels are automatically derived by flattening the category dictionary in order.
Example:
category_to_features = {
'demographics': ['Age', 'Education'],
'financial': ['Income', 'Spending'],
}
GraphUtils.plot_graph(Record['G'], category_to_features=category_to_features)
category_to_features = {
'demographics': ['Age', 'Education'],
'financial': ['Income', 'Spending'],
}
GraphUtils.plot_graph(Record['G'],
category_to_features=category_to_features,
title='Causal Graph by Category',
save_path='graph_by_category.png')