Decision Tree Diagram Calculator

Create interactive classification and regression trees, inspect every split, test predictions, compare settings, measure performance, and export clear decision diagrams from your dataset instantly.

Results

Train a tree to populate the diagram, metrics, rules, and exports.
Not trained
Task
Nodes
Leaves
Maximum depth
Training score
Testing score
Features used
Training time
Decision Tree Diagram

Selected node

Select a node in the diagram.

Feature importance

Performance metrics

Metrics appear after training.

Decision rules

No rules generated.

Prediction path

Train a tree before predicting.

Node and branch table

IDDepthTypeRuleSamplesImpurityGainPrediction
No model trained.

Dataset and model settings

25% test data

Use the first row for column names. Commas, semicolons, or tabs are accepted.

Formula used

Gini impurity: Gini = 1 − Σp². Lower values indicate purer classification nodes.

Entropy: H = −Σp log₂(p). Information gain subtracts weighted child entropy from parent entropy.

Regression error: MSE = Σ(y − ȳ)² / n. Splits maximize weighted error reduction.

Feature importance: each feature receives its accumulated impurity reduction, weighted by node sample share.

How to use

  1. Paste data, upload CSV, or edit the manual table.
  2. Select the target column and task type.
  3. Choose depth, leaf, split, pruning, and display settings.
  4. Build the tree and inspect nodes, rules, metrics, and paths.
  5. Enter new values to highlight a prediction route.
  6. Export the diagram, node table, rules, or complete model.

Example data

OutlookTemperatureHumidityWindyPlay
Sunny8585FalseNo
Overcast8378FalseYes
Rain7096FalseYes
Sunny6970FalseYes

Frequently asked questions

What does each node show?

Each node shows its rule, samples, impurity, gain, and prediction.

Can this calculator handle categories?

Yes. It evaluates categorical equality splits and numeric thresholds.

How are missing values handled?

Choose row removal, imputation, or a fixed branch direction.

What causes overfitting?

Excessive depth and tiny leaves often memorize training observations.

What is pruning?

Pruning removes weak branches to improve generalisation and clarity.

Can it perform regression?

Yes. Numeric targets can use MSE, MAE, or variance reduction.

How is feature importance calculated?

Importance accumulates weighted impurity reductions from every selected split.

Can I test new observations?

Yes. Prediction inputs highlight every branch taken through the tree.

Which file formats are supported?

CSV input is supported, with PNG, SVG, PDF, CSV, JSON, and text exports.

Related Calculators

Tree Depth-versus-Accuracy PlotNode Impurity PlotRandom Forest Feature Importance PlotNumber of Trees-versus-Error PlotOut-of-Bag Error CurveBoosting Loss CurveBoosting Feature Importance PlotTree SHAP PlotIndividual Tree Comparison Plot

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.