client.get_mutual_information

Calculates the mutual information (MI) between variables over a specified dataset.

Input ParameterTypeDefaultDescription
project_idstrNoneThe unique identifier for the project.
dataset_idstrNoneThe unique identifier for the dataset.
featureslistNoneA list of features for which to compute mutual information.
normalizedOptional [bool]FalseIf True, will compute normalized mutual information (NMI) instead.
slice_queryOptional [str]NoneA SQL query. If specified, mutual information will only be calculated over the dataset slice specified by the query.
sample_sizeOptional [int]NoneIf specified, only sample_size samples will be used in the mutual information calculation.
seedOptional [float]0.25The random seed used to sample when sample_size is specified.
PROJECT_ID = 'example_project'
DATASET_ID = 'example_dataset'

mutual_information_features = [
    'feature_1',
    'feature_2',
    'feature_3'
]

mutual_information = client.get_mutual_information(
    project_id=PROJECT_ID,
    dataset_id=DATASET_ID,
    features=mutual_information_features
)
PROJECT_ID = 'example_project'
DATASET_ID = 'example_dataset'

mutual_information_features = [
    'feature_1',
    'feature_2',
    'feature_3'
]

slice_query = f""" SELECT * FROM "{DATASET_ID}.{MODEL_ID}" WHERE feature_1 < 20.0 LIMIT 100 """

mutual_information = client.get_mutual_information(
    project_id=PROJECT_ID,
    dataset_id=DATASET_ID,
    features=mutual_information_features,
    slice_query=slice_query
)
Return TypeDescription
dictA dictionary containing mutual information results.