Estimating local and global feature importance scores using DiCE

Summaries of counterfactual examples can be used to estimate importance of features. Intuitively, a feature that is changed more often to generate a proximal counterfactual is an important feature. We use this intuition to build a feature importance score.

This score can be interpreted as a measure of the necessity of a feature to cause a particular model output. That is, if the feature’s value changes, then it is likely that the model’s output class will also change (or the model’s output will significantly change in case of regression model).

Below we show how counterfactuals can be used to provide local feature importance scores for any input, and how those scores can be combined to yield a global importance score for each feature.

[1]:
from sklearn.compose import ColumnTransformer
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.ensemble import RandomForestClassifier

import dice_ml
from dice_ml import Dice
from dice_ml.utils import helpers  # helper functions
[2]:
%load_ext autoreload
%autoreload 2

Preliminaries: Loading the data and ML model

[3]:
dataset = helpers.load_adult_income_dataset().sample(5000)  # downsampling to reduce ML model fitting time
helpers.get_adult_data_info()
[3]:
{'age': 'age',
 'workclass': 'type of industry (Government, Other/Unknown, Private, Self-Employed)',
 'education': 'education level (Assoc, Bachelors, Doctorate, HS-grad, Masters, Prof-school, School, Some-college)',
 'marital_status': 'marital status (Divorced, Married, Separated, Single, Widowed)',
 'occupation': 'occupation (Blue-Collar, Other/Unknown, Professional, Sales, Service, White-Collar)',
 'race': 'white or other race?',
 'gender': 'male or female?',
 'hours_per_week': 'total work hours per week',
 'income': '0 (<=50K) vs 1 (>50K)'}
[4]:
target = dataset["income"]

# Split data into train and test
datasetX = dataset.drop("income", axis=1)
x_train, x_test, y_train, y_test = train_test_split(datasetX,
                                                    target,
                                                    test_size=0.2,
                                                    random_state=0,
                                                    stratify=target)

numerical = ["age", "hours_per_week"]
categorical = x_train.columns.difference(numerical)

# We create the preprocessing pipelines for both numeric and categorical data.
numeric_transformer = Pipeline(steps=[
    ('scaler', StandardScaler())])

categorical_transformer = Pipeline(steps=[
    ('onehot', OneHotEncoder(handle_unknown='ignore'))])

transformations = ColumnTransformer(
    transformers=[
        ('num', numeric_transformer, numerical),
        ('cat', categorical_transformer, categorical)])

# Append classifier to preprocessing pipeline.
# Now we have a full prediction pipeline.
clf = Pipeline(steps=[('preprocessor', transformations),
                      ('classifier', RandomForestClassifier())])
model = clf.fit(x_train, y_train)
[5]:
d = dice_ml.Data(dataframe=dataset, continuous_features=['age', 'hours_per_week'], outcome_name='income')
m = dice_ml.Model(model=model, backend="sklearn")

Local feature importance

We first generate counterfactuals for a given input point.

[6]:
exp = Dice(d, m, method="random")
query_instance = x_train[1:2]
e1 = exp.generate_counterfactuals(query_instance, total_CFs=10, desired_range=None,
                                  desired_class="opposite",
                                  permitted_range=None, features_to_vary="all")
e1.visualize_as_dataframe(show_only_changes=True)
100%|█████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  2.10it/s]
Query instance (original outcome : 1)

age workclass education marital_status occupation race gender hours_per_week income
0 37 Private Some-college Married Sales White Male 44 1

Diverse Counterfactual set (new outcome: 0)
age workclass education marital_status occupation race gender hours_per_week income
0 30 - - Separated - - - - 0
1 - - Doctorate Single - - - - 0
2 77 - Assoc - - - - - 0
3 - - School Divorced - - - - 0
4 - - - Divorced - - - - 0
5 24 - - - - - - - 0
6 - - - - - Other - 4 0
7 - Self-Employed School - - - - - 0
8 - - - - - - Female 4 0
9 - - - - Service - - 65 0

These can now be used to calculate the feature importance scores.

[7]:
imp = exp.local_feature_importance(query_instance, cf_examples_list=e1.cf_examples_list)
print(imp.local_importance)
[{'education': 0.4, 'marital_status': 0.4, 'age': 0.3, 'hours_per_week': 0.3, 'workclass': 0.1, 'occupation': 0.1, 'race': 0.1, 'gender': 0.1}]

Feature importance can also be estimated directly, by leaving the cf_examples_list argument blank.

[8]:
imp = exp.local_feature_importance(query_instance, posthoc_sparsity_param=None)
print(imp.local_importance)
100%|█████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  3.60it/s]
[{'age': 0.5, 'hours_per_week': 0.5, 'education': 0.3, 'marital_status': 0.2, 'workclass': 0.1, 'occupation': 0.1, 'race': 0.1, 'gender': 0.1}]

Global importance

For global importance, we need to generate counterfactuals for a representative sample of the dataset.

[9]:
cobj = exp.global_feature_importance(x_train[0:10], total_CFs=10, posthoc_sparsity_param=None)
print(cobj.summary_importance)
100%|███████████████████████████████████████████████████████████████████████████████████| 10/10 [00:03<00:00,  3.01it/s]
{'age': 0.53, 'marital_status': 0.46, 'hours_per_week': 0.45, 'occupation': 0.21, 'gender': 0.15, 'education': 0.13, 'workclass': 0.11, 'race': 0.07}

Convert the counterfactual output to json

[10]:
json_str = cobj.to_json()
print(json_str)
{"test_data": [[[48, "Government", "Bachelors", "Divorced", "Professional", "White", "Female", 60, 0]], [[37, "Private", "Some-college", "Married", "Sales", "White", "Male", 44, 1]], [[36, "Private", "Some-college", "Married", "White-Collar", "White", "Female", 35, 1]], [[30, "Private", "HS-grad", "Single", "Blue-Collar", "White", "Male", 40, 0]], [[32, "Private", "Assoc", "Married", "White-Collar", "White", "Female", 40, 1]], [[17, "Private", "School", "Single", "Service", "White", "Male", 20, 0]], [[28, "Private", "Bachelors", "Married", "Sales", "White", "Male", 45, 1]], [[41, "Private", "Some-college", "Married", "Sales", "White", "Male", 65, 1]], [[23, "Government", "Bachelors", "Single", "Professional", "White", "Male", 40, 0]], [[26, "Private", "Masters", "Single", "White-Collar", "White", "Female", 48, 0]]], "cfs_list": [[[48, "Government", "Prof-school", "Divorced", "Professional", "White", "Male", 60, 1], [48, "Government", "Bachelors", "Married", "Professional", "White", "Female", 41, 1], [65, "Government", "Doctorate", "Divorced", "Professional", "White", "Female", 60, 1], [48, "Government", "Bachelors", "Married", "Professional", "White", "Female", 91, 1], [48, "Government", "Bachelors", "Married", "Professional", "White", "Female", 32, 1], [48, "Private", "Bachelors", "Married", "Professional", "White", "Female", 60, 1], [48, "Government", "Bachelors", "Married", "Professional", "White", "Female", 46, 1], [48, "Government", "Bachelors", "Married", "Professional", "White", "Female", 30, 1], [48, "Government", "Bachelors", "Married", "Professional", "White", "Female", 80, 1], [41, "Government", "Bachelors", "Married", "Professional", "White", "Female", 60, 1]], [[37, "Private", "Some-college", "Widowed", "Sales", "White", "Male", 81, 0], [37, "Other/Unknown", "Some-college", "Divorced", "Sales", "White", "Male", 44, 0], [37, "Private", "Some-college", "Married", "Sales", "White", "Male", 17, 0], [37, "Self-Employed", "Some-college", "Married", "Sales", "White", "Male", 98, 0], [83, "Private", "Some-college", "Married", "Sales", "Other", "Male", 44, 0], [47, "Private", "Some-college", "Married", "Sales", "White", "Male", 22, 0], [37, "Private", "Some-college", "Married", "Sales", "White", "Male", 7, 0], [59, "Private", "Some-college", "Married", "Sales", "White", "Male", 89, 0], [37, "Private", "Some-college", "Single", "Sales", "Other", "Male", 44, 0], [32, "Private", "Some-college", "Married", "White-Collar", "White", "Male", 44, 0]], [[63, "Government", "Some-college", "Married", "White-Collar", "White", "Female", 35, 0], [73, "Private", "Some-college", "Separated", "White-Collar", "White", "Female", 35, 0], [36, "Private", "Some-college", "Married", "White-Collar", "White", "Female", 7, 0], [36, "Private", "Some-college", "Divorced", "White-Collar", "White", "Female", 5, 0], [36, "Private", "Some-college", "Separated", "White-Collar", "White", "Female", 24, 0], [36, "Private", "Some-college", "Married", "White-Collar", "Other", "Female", 83, 0], [36, "Private", "Some-college", "Widowed", "White-Collar", "White", "Female", 89, 0], [36, "Private", "Some-college", "Married", "White-Collar", "White", "Male", 47, 0], [36, "Private", "Some-college", "Single", "Service", "White", "Female", 35, 0], [54, "Private", "Some-college", "Married", "White-Collar", "White", "Female", 61, 0]], [[77, "Private", "HS-grad", "Single", "White-Collar", "White", "Male", 59, 1], [67, "Private", "HS-grad", "Married", "Blue-Collar", "White", "Female", 40, 1], [30, "Private", "HS-grad", "Married", "Blue-Collar", "White", "Male", 83, 1], [30, "Self-Employed", "HS-grad", "Married", "Blue-Collar", "White", "Male", 47, 1], [30, "Private", "HS-grad", "Married", "White-Collar", "White", "Male", 40, 1], [34, "Private", "Prof-school", "Single", "Sales", "White", "Male", 40, 1], [64, "Private", "HS-grad", "Married", "Professional", "White", "Male", 40, 1], [30, "Private", "Assoc", "Single", "Professional", "White", "Female", 40, 1], [30, "Private", "HS-grad", "Married", "Blue-Collar", "White", "Male", 94, 1], [68, "Private", "HS-grad", "Married", "Blue-Collar", "White", "Male", 89, 1]], [[43, "Other/Unknown", "Assoc", "Married", "White-Collar", "White", "Female", 40, 0], [32, "Private", "Assoc", "Divorced", "White-Collar", "White", "Female", 21, 0], [32, "Private", "Assoc", "Single", "White-Collar", "White", "Female", 40, 0], [32, "Private", "Assoc", "Married", "Other/Unknown", "Other", "Female", 40, 0], [76, "Private", "Assoc", "Single", "White-Collar", "White", "Female", 40, 0], [32, "Private", "Assoc", "Married", "White-Collar", "White", "Female", 16, 0], [68, "Private", "Assoc", "Married", "White-Collar", "Other", "Female", 40, 0], [32, "Private", "Assoc", "Single", "White-Collar", "White", "Female", 75, 0], [49, "Self-Employed", "Assoc", "Married", "White-Collar", "White", "Female", 40, 0], [68, "Private", "Assoc", "Married", "White-Collar", "White", "Female", 40, 0]], [[39, "Private", "School", "Single", "Professional", "White", "Male", 99, 1], [49, "Private", "School", "Single", "White-Collar", "White", "Male", 59, 1], [42, "Private", "Masters", "Single", "Service", "White", "Male", 76, 1], [81, "Private", "Doctorate", "Married", "Service", "White", "Male", 20, 1], [49, "Private", "Doctorate", "Single", "Service", "White", "Male", 92, 1], [66, "Other/Unknown", "Some-college", "Married", "Service", "White", "Male", 20, 1], [52, "Private", "Masters", "Married", "Service", "White", "Male", 20, 1], [81, "Private", "Doctorate", "Married", "Service", "White", "Male", 38, 1], [55, "Private", "School", "Single", "Professional", "White", "Male", 64, 0], [49, "Self-Employed", "Doctorate", "Single", "Service", "White", "Male", 92, 1]], [[28, "Private", "Bachelors", "Single", "Sales", "White", "Female", 45, 0], [28, "Private", "Bachelors", "Married", "Other/Unknown", "White", "Male", 14, 0], [27, "Private", "Bachelors", "Married", "Sales", "White", "Male", 79, 0], [28, "Private", "Bachelors", "Married", "Professional", "Other", "Male", 45, 0], [28, "Private", "Assoc", "Married", "Sales", "White", "Male", 45, 0], [28, "Private", "Bachelors", "Separated", "White-Collar", "White", "Male", 45, 0], [28, "Private", "Bachelors", "Separated", "Sales", "White", "Male", 77, 0], [46, "Private", "Bachelors", "Married", "Sales", "White", "Female", 45, 0], [28, "Other/Unknown", "Bachelors", "Married", "Professional", "White", "Male", 45, 0], [28, "Private", "HS-grad", "Married", "Sales", "White", "Male", 22, 0]], [[41, "Private", "Some-college", "Married", "White-Collar", "White", "Female", 65, 0], [72, "Private", "Some-college", "Married", "Service", "White", "Male", 65, 0], [41, "Private", "Some-college", "Separated", "Sales", "White", "Male", 25, 0], [28, "Private", "Some-college", "Married", "Blue-Collar", "White", "Male", 65, 0], [26, "Private", "Some-college", "Married", "Sales", "White", "Male", 65, 0], [41, "Private", "Some-college", "Married", "Professional", "White", "Male", 5, 0], [81, "Private", "Some-college", "Divorced", "Sales", "White", "Male", 65, 0], [30, "Private", "Some-college", "Married", "Sales", "White", "Male", 65, 0], [41, "Government", "Some-college", "Divorced", "Sales", "White", "Male", 65, 0], [41, "Private", "Some-college", "Single", "Professional", "White", "Male", 65, 0]], [[23, "Government", "Bachelors", "Married", "Professional", "Other", "Male", 40, 1], [55, "Government", "Bachelors", "Married", "Professional", "White", "Male", 40, 1], [37, "Government", "Bachelors", "Married", "Professional", "White", "Male", 40, 1], [82, "Government", "Bachelors", "Single", "Professional", "White", "Female", 40, 1], [88, "Government", "Bachelors", "Single", "Professional", "White", "Female", 40, 1], [23, "Government", "Bachelors", "Married", "Service", "White", "Male", 40, 1], [75, "Government", "Bachelors", "Single", "Professional", "White", "Female", 40, 1], [73, "Government", "Bachelors", "Married", "Professional", "White", "Male", 40, 1], [23, "Government", "Bachelors", "Married", "Professional", "White", "Male", 44, 1], [88, "Government", "Bachelors", "Married", "Professional", "White", "Male", 40, 1]], [[76, "Private", "Masters", "Single", "White-Collar", "White", "Female", 71, 1], [35, "Private", "Masters", "Single", "White-Collar", "White", "Female", 81, 1], [42, "Private", "Masters", "Single", "White-Collar", "White", "Male", 48, 1], [51, "Private", "Masters", "Single", "White-Collar", "White", "Female", 68, 1], [58, "Private", "Masters", "Single", "White-Collar", "White", "Male", 48, 1], [34, "Private", "Masters", "Single", "White-Collar", "White", "Male", 48, 1], [88, "Private", "Masters", "Single", "White-Collar", "White", "Male", 48, 1], [48, "Private", "Masters", "Married", "White-Collar", "White", "Female", 48, 1], [52, "Private", "Masters", "Single", "White-Collar", "White", "Male", 48, 1], [79, "Private", "Masters", "Single", "White-Collar", "White", "Female", 60, 1]]], "local_importance": [[0.2, 0.1, 0.2, 0.8, 0.0, 0.0, 0.1, 0.6], [0.4, 0.2, 0.0, 0.3, 0.1, 0.2, 0.0, 0.6], [0.3, 0.1, 0.0, 0.5, 0.1, 0.1, 0.1, 0.7], [0.5, 0.1, 0.2, 0.7, 0.5, 0.0, 0.2, 0.5], [0.5, 0.2, 0.0, 0.4, 0.1, 0.2, 0.0, 0.3], [1.0, 0.2, 0.7, 0.4, 0.3, 0.0, 0.0, 0.7], [0.2, 0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.4], [0.5, 0.1, 0.0, 0.4, 0.5, 0.0, 0.1, 0.2], [0.7, 0.0, 0.0, 0.7, 0.1, 0.1, 0.3, 0.1], [1.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.5, 0.4]], "summary_importance": [0.53, 0.11, 0.13, 0.46, 0.21, 0.07, 0.15, 0.45], "data_interface": {"outcome_name": "income", "data_df": "dummy_data"}, "feature_names": ["age", "workclass", "education", "marital_status", "occupation", "race", "gender", "hours_per_week"], "feature_names_including_target": ["age", "workclass", "education", "marital_status", "occupation", "race", "gender", "hours_per_week", "income"], "model_type": "classifier", "desired_class": 1, "desired_range": null, "metadata": {"version": "2.0"}}

Convert the json output to a counterfactual object

[11]:
imp_r = imp.from_json(json_str)
print([o.visualize_as_dataframe(show_only_changes=True) for o in imp_r.cf_examples_list])
print(imp_r.local_importance)
print(imp_r.summary_importance)
Query instance (original outcome : 0)
age workclass education marital_status occupation race gender hours_per_week income
0 48 Government Bachelors Divorced Professional White Female 60 0

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 - - Prof-school - - - Male - 1
1 - - - Married - - - 41 1
2 65 - Doctorate - - - - - 1
3 - - - Married - - - 91 1
4 - - - Married - - - 32 1
5 - Private - Married - - - - 1
6 - - - Married - - - 46 1
7 - - - Married - - - 30 1
8 - - - Married - - - 80 1
9 41 - - Married - - - - 1
Query instance (original outcome : 1)
age workclass education marital_status occupation race gender hours_per_week income
0 37 Private Some-college Married Sales White Male 44 1

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 - - - Widowed - - - 81 0
1 - Other/Unknown - Divorced - - - - 0
2 - - - - - - - 17 0
3 - Self-Employed - - - - - 98 0
4 83 - - - - Other - - 0
5 47 - - - - - - 22 0
6 - - - - - - - 7 0
7 59 - - - - - - 89 0
8 - - - Single - Other - - 0
9 32 - - - White-Collar - - - 0
Query instance (original outcome : 1)
age workclass education marital_status occupation race gender hours_per_week income
0 36 Private Some-college Married White-Collar White Female 35 1

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 63 Government - - - - - - 0
1 73 - - Separated - - - - 0
2 - - - - - - - 7 0
3 - - - Divorced - - - 5 0
4 - - - Separated - - - 24 0
5 - - - - - Other - 83 0
6 - - - Widowed - - - 89 0
7 - - - - - - Male 47 0
8 - - - Single Service - - - 0
9 54 - - - - - - 61 0
Query instance (original outcome : 0)
age workclass education marital_status occupation race gender hours_per_week income
0 30 Private HS-grad Single Blue-Collar White Male 40 0

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 77 - - - White-Collar - - 59 1
1 67 - - Married - - Female - 1
2 - - - Married - - - 83 1
3 - Self-Employed - Married - - - 47 1
4 - - - Married White-Collar - - - 1
5 34 - Prof-school - Sales - - - 1
6 64 - - Married Professional - - - 1
7 - - Assoc - Professional - Female - 1
8 - - - Married - - - 94 1
9 68 - - Married - - - 89 1
Query instance (original outcome : 1)
age workclass education marital_status occupation race gender hours_per_week income
0 32 Private Assoc Married White-Collar White Female 40 1

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 43 Other/Unknown - - - - - - 0
1 - - - Divorced - - - 21 0
2 - - - Single - - - - 0
3 - - - - Other/Unknown Other - - 0
4 76 - - Single - - - - 0
5 - - - - - - - 16 0
6 68 - - - - Other - - 0
7 - - - Single - - - 75 0
8 49 Self-Employed - - - - - - 0
9 68 - - - - - - - 0
Query instance (original outcome : 0)
age workclass education marital_status occupation race gender hours_per_week income
0 17 Private School Single Service White Male 20 0

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 39 - - - Professional - - 99 1
1 49 - - - White-Collar - - 59 1
2 42 - Masters - - - - 76 1
3 81 - Doctorate Married - - - - 1
4 49 - Doctorate - - - - 92 1
5 66 Other/Unknown Some-college Married - - - - 1
6 52 - Masters Married - - - - 1
7 81 - Doctorate Married - - - 38 1
8 55 - - - Professional - - 64 -
9 49 Self-Employed Doctorate - - - - 92 1
Query instance (original outcome : 1)
age workclass education marital_status occupation race gender hours_per_week income
0 28 Private Bachelors Married Sales White Male 45 1

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 - - - Single - - Female - 0
1 - - - - Other/Unknown - - 14 0
2 27 - - - - - - 79 0
3 - - - - Professional Other - - 0
4 - - Assoc - - - - - 0
5 - - - Separated White-Collar - - - 0
6 - - - Separated - - - 77 0
7 46 - - - - - Female - 0
8 - Other/Unknown - - Professional - - - 0
9 - - HS-grad - - - - 22 0
Query instance (original outcome : 1)
age workclass education marital_status occupation race gender hours_per_week income
0 41 Private Some-college Married Sales White Male 65 1

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 - - - - White-Collar - Female - 0
1 72 - - - Service - - - 0
2 - - - Separated - - - 25 0
3 28 - - - Blue-Collar - - - 0
4 26 - - - - - - - 0
5 - - - - Professional - - 5 0
6 81 - - Divorced - - - - 0
7 30 - - - - - - - 0
8 - Government - Divorced - - - - 0
9 - - - Single Professional - - - 0
Query instance (original outcome : 0)
age workclass education marital_status occupation race gender hours_per_week income
0 23 Government Bachelors Single Professional White Male 40 0

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 - - - Married - Other - - 1
1 55 - - Married - - - - 1
2 37 - - Married - - - - 1
3 82 - - - - - Female - 1
4 88 - - - - - Female - 1
5 - - - Married Service - - - 1
6 75 - - - - - Female - 1
7 73 - - Married - - - - 1
8 - - - Married - - - 44 1
9 88 - - Married - - - - 1
Query instance (original outcome : 0)
age workclass education marital_status occupation race gender hours_per_week income
0 26 Private Masters Single White-Collar White Female 48 0

Counterfactual set (new outcome: 1)
age workclass education marital_status occupation race gender hours_per_week income
0 76 - - - - - - 71 1
1 35 - - - - - - 81 1
2 42 - - - - - Male - 1
3 51 - - - - - - 68 1
4 58 - - - - - Male - 1
5 34 - - - - - Male - 1
6 88 - - - - - Male - 1
7 48 - - Married - - - - 1
8 52 - - - - - Male - 1
9 79 - - - - - - 60 1
[None, None, None, None, None, None, None, None, None, None]
[{'marital_status': 0.8, 'hours_per_week': 0.6, 'age': 0.2, 'education': 0.2, 'workclass': 0.1, 'gender': 0.1, 'occupation': 0.0, 'race': 0.0}, {'hours_per_week': 0.6, 'age': 0.4, 'marital_status': 0.3, 'workclass': 0.2, 'race': 0.2, 'occupation': 0.1, 'education': 0.0, 'gender': 0.0}, {'hours_per_week': 0.7, 'marital_status': 0.5, 'age': 0.3, 'workclass': 0.1, 'occupation': 0.1, 'race': 0.1, 'gender': 0.1, 'education': 0.0}, {'marital_status': 0.7, 'age': 0.5, 'occupation': 0.5, 'hours_per_week': 0.5, 'education': 0.2, 'gender': 0.2, 'workclass': 0.1, 'race': 0.0}, {'age': 0.5, 'marital_status': 0.4, 'hours_per_week': 0.3, 'workclass': 0.2, 'race': 0.2, 'occupation': 0.1, 'education': 0.0, 'gender': 0.0}, {'age': 1.0, 'education': 0.7, 'hours_per_week': 0.7, 'marital_status': 0.4, 'occupation': 0.3, 'workclass': 0.2, 'race': 0.0, 'gender': 0.0}, {'occupation': 0.4, 'hours_per_week': 0.4, 'marital_status': 0.3, 'age': 0.2, 'education': 0.2, 'gender': 0.2, 'workclass': 0.1, 'race': 0.1}, {'age': 0.5, 'occupation': 0.5, 'marital_status': 0.4, 'hours_per_week': 0.2, 'workclass': 0.1, 'gender': 0.1, 'education': 0.0, 'race': 0.0}, {'age': 0.7, 'marital_status': 0.7, 'gender': 0.3, 'occupation': 0.1, 'race': 0.1, 'hours_per_week': 0.1, 'workclass': 0.0, 'education': 0.0}, {'age': 1.0, 'gender': 0.5, 'hours_per_week': 0.4, 'marital_status': 0.1, 'workclass': 0.0, 'education': 0.0, 'occupation': 0.0, 'race': 0.0}]
{'age': 0.53, 'marital_status': 0.46, 'hours_per_week': 0.45, 'occupation': 0.21, 'gender': 0.15, 'education': 0.13, 'workclass': 0.11, 'race': 0.07}