Metadata helpers
The InsideForest.metadata module bridges cluster descriptions with your organization’s data catalog so you can audit recommendations and design follow-up experiments.
Main utilities
MetaExtractor: maps the tokens found incluster_descriptionto rows in a metadata catalog and filters the columns to keep via theProfileenum.parse_rule_string,token_from_conditionandconditions_to_tokens: helpers that split rule text into individual conditions and reusable tokens.experiments_from_df2andrun_experiments: generate contrastive hypotheses between clusters, ranking where to intervene first.
Example
import pandas as pd
from InsideForest import MetaExtractor, Profile, run_experiments
metadata_df = profiler_table.set_index("variable_id") # must include the target row
mx = MetaExtractor(metadata_df, var_obj="target")
catalog = mx.extract(
clf.df_clusters_description_,
profile=Profile.INVESTIGATION,
)
records = training_df.copy()
records["target"] = y
hypotheses = run_experiments(
mx,
{"iris": clf.df_clusters_description_},
data_dict={"iris": records},
)
For examples with metadata.df.head(10), df_meta_sub, top_experiments, and generated hypotheses, review full pipeline outputs.
Note: the metadata catalog must be indexed by the variable tokens found in cluster_description plus the target column. The detailed DataFrames df_clusters_description_ and df_datos_explain_ are populated when the estimator is fitted with get_detail=True. Combine the extracted catalog with reproducibility assets from the Reproducibility guide.