Skip to content

DecisionTrees

Bell Eapen edited this page Nov 10, 2025 · 1 revision

DecisionTrees

Overview

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.

Implementation in Repository

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:

  1. Fit a tree on the numeric DataFrame (corpus.df) where the outcome column is specified.
  2. Compute feature importances, exporting them to corpus metadata (e.g., decision_tree_feature_importance).
  3. Provide accuracy metrics (e.g., decision_tree_accuracy).

Sense-making and Triangulation

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 on workload_index support integration.

Example (Business Domain)

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.

Example (Medical Domain)

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.

Usage

CLI

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_importance

MCP Server

Invoke the decision_tree_classification tool from an MCP-compatible client to obtain feature importance and predictions for downstream interpretation.

Interpreting Feature Importance

Feature importance values indicate relative contribution to reducing impurity at decision nodes. For triangulation:

  1. Map top features to qualitative categories (keywords, topics).
  2. Check semantic search results for documents whose metadata values cluster in high-importance ranges.
  3. Form theoretical memos: e.g., "High travel_time and low sleep_balance co-occur with narratives expressing time scarcity."

Limitations & Considerations

  • 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).

Recommended Next Steps

  • 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.

References

  • Mettler et al. (2025) — Methodological reflection on computational text analysis.
  • Rudkin & Dlotko (2024) — TDABM for structural exploration (can precede tree modeling).

See Also

Clone this wiki locally