-
Notifications
You must be signed in to change notification settings - Fork 0
DecisionTrees
Decision trees in CRISP-T provide an interpretable supervised learning method for exploring how numeric (and optionally derived textual) features relate to an outcome variable. They support sense-making by producing hierarchical rules (splits) that can be triangulated with qualitative themes (e.g., topics or keywords) discovered in textual analysis. When a split on a numeric variable aligns with a topic frequently co-occurring in documents tagged with the same IDs, researchers gain confirmatory evidence grounded in multiple data modalities.
The repository exposes decision tree classification through the MCP server tool decision_tree_classification and via the analytical CLI using the --cart or --ml options (requires installation with crisp-t[ml]). Internally, scikit-learn's DecisionTreeClassifier is used to:
- Fit a tree on the numeric DataFrame (
corpus.df) where the outcome column is specified. - Compute feature importances, exporting them to corpus metadata (e.g.,
decision_tree_feature_importance). - Provide accuracy metrics (e.g.,
decision_tree_accuracy).
Grounded theory emphasizes iterative comparison and category development. Decision trees contribute by:
- Highlighting discriminative variables that can be compared with emergent qualitative categories.
- Suggesting conditional structures ("if-then" paths) that mirror theoretical propositions.
- Enabling selective coding: for example, if a qualitative theme "Time Pressure" corresponds to higher values of a numeric variable
workload_index, splits onworkload_indexsupport integration.
Suppose a dataset includes customer support tickets (text) and operational metrics (numeric). After topic modeling, a theme "Delayed Response" emerges. A decision tree predicting churn_flag may show early splits on avg_response_time. Alignment between textual theme and numeric predictor solidifies a grounded proposition that delayed service drives attrition.
In mixed interview (patient narratives) and clinical metrics data for fatigue assessment, a tree predicting high_fatigue might split first on sleep_balance. Narrative topics emphasizing "poor sleep" triangulate with the numeric split, supporting a substantive theory that disrupted sleep patterns contribute to fatigue.
crisp --inp crisp_input --ml --cart --out crisp_input- Ensure that the outcome variable is present in the DataFrame. Results (accuracy, importances) are stored in corpus metadata and can be printed:
crisp --inp crisp_input --print metadata --print decision_tree_accuracy
crisp --inp crisp_input --print metadata --print decision_tree_feature_importanceInvoke the decision_tree_classification tool from an MCP-compatible client to obtain feature importance and predictions for downstream interpretation.
Feature importance values indicate relative contribution to reducing impurity at decision nodes. For triangulation:
- Map top features to qualitative categories (keywords, topics).
- Check semantic search results for documents whose metadata values cluster in high-importance ranges.
- Form theoretical memos: e.g., "High travel_time and low sleep_balance co-occur with narratives expressing time scarcity."
- Single trees may overfit; use them primarily for interpretability rather than high-stakes prediction.
- Numeric variables derived from textual coding (e.g., counts of keywords per document) can be incorporated to strengthen cross-modal linkage.
- Class imbalance can distort impurity-based importance; consider stratified sampling or complementary metrics (e.g., ROC AUC from other models).
- Extend to ensemble methods (Random Forests, Gradient Boosting) for stability (see Future Plan).
- Export rule paths as structured JSON to enable automated comparison with qualitative category networks.
- Mettler et al. (2025) — Methodological reflection on computational text analysis.
- Rudkin & Dlotko (2024) — TDABM for structural exploration (can precede tree modeling).