Memuat
Memuat
Decision Tree for Medicine and Clinical Data
0 views
Classify sepsis risk with a decision tree based on body temperature and respiratory rate and examine its splitting rules. A decision tree recursively splits the data with if-then rules that are easy to read and visualise. It suits classification whose results must be explained as rules to non-technical readers.

Classify sepsis risk with a decision tree based on body temperature and respiratory rate and examine its splitting rules.
| Role | Variable | Unit |
|---|---|---|
| Main | Sepsis risk | - |
| Supporting 1 | Body temperature | °C |
| Supporting 2 | Respiratory rate | kali/menit |
The decision tree model classifies Sepsis risk (low/high) from Body temperature and Respiratory rate with test accuracy 0.762, F1 0.787 and AUC 0.764. Tree depth is 3 with 7 leaves.
Computed from illustrative synthetic data, not from a real study.
A decision tree recursively splits the data with if-then rules that are easy to read and visualise. It suits classification whose results must be explained as rules to non-technical readers.
Show the tree diagram and translate its main branches into meaningful rules, together with test accuracy. Mention that a single tree is less stable than ensembles.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeClassifier, plot_tree, export_text
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, f1_score
rng = np.random.default_rng(21)
n = 300
body_temperature = rng.normal(0, 1, n)
respiratory_rate = rng.normal(0, 1, n)
sepsis_risk = ((body_temperature > 0.2) & (respiratory_rate < 0.5)).astype(int)
flip = rng.random(n) < 0.05
sepsis_risk[flip] = 1 - sepsis_risk[flip]
X = np.column_stack([body_temperature, respiratory_rate])
X_tr, X_te, y_tr, y_te = train_test_split(X, sepsis_risk, test_size=0.3, stratify=sepsis_risk, random_state=21)
tree = DecisionTreeClassifier(max_depth=3, min_samples_leaf=5, random_state=21)
tree.fit(X_tr, y_tr)
pred = tree.predict(X_te)
print("Accuracy:", round(accuracy_score(y_te, pred), 3))
print("F1:", round(f1_score(y_te, pred), 3))
print("Importance:", tree.feature_importances_.round(3))
print(export_text(tree, feature_names=["x1", "x2"]))
plt.figure(figsize=(9, 5))
plot_tree(tree, feature_names=["x1", "x2"], class_names=["0", "1"], filled=True)
plt.show()Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$16
excl. 11% VAT
Duration: 3 working days
Output: Python files + result figures
Deliverables
Package 2 · most chosen
US$47
excl. 11% VAT
Duration: 7 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$103
excl. 11% VAT
Duration: 12-15 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. Decision Tree is commonly used at this level in Medicine and Clinical Data. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output Python gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$16, Package 2 (your data analysis and interpretation) US$47 and Package 3 (full guidance) US$103, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. Python is a trademark of the Python Software Foundation.
Back to Python portfolio