Memuat
Memuat
Decision Tree for Informatics and Information Systems
0 views
Classify email class (spam or legitimate) from link count and message length with Decision Tree, then assess performance using accuracy and the confusion matrix. 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 email class (spam or legitimate) from link count and message length with Decision Tree, then assess performance using accuracy and the confusion matrix.
| Role | Variable | Unit |
|---|---|---|
| Main | Email class (spam or legitimate) | - |
| Supporting 1 | Link count | - |
| Supporting 2 | Message length | kata |
The decision tree model classifies Email class (spam or legitima… (low/high) from Link count and Message length with test accuracy 0.689, F1 0.708 and AUC 0.788. Tree depth is 4 with 10 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
link_count = rng.normal(0, 1, n)
message_length = rng.normal(0, 1, n)
email_class_spam_or_legitima = ((link_count > 0.2) & (message_length < 0.5)).astype(int)
flip = rng.random(n) < 0.05
email_class_spam_or_legitima[flip] = 1 - email_class_spam_or_legitima[flip]
X = np.column_stack([link_count, message_length])
X_tr, X_te, y_tr, y_te = train_test_split(X, email_class_spam_or_legitima, test_size=0.3, stratify=email_class_spam_or_legitima, 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$19
excl. 11% VAT
Duration: 3 working days
Output: Python files + result figures
Deliverables
Package 2 · most chosen
US$56
excl. 11% VAT
Duration: 7 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$125
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 Informatics and Information Systems. 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$19, Package 2 (your data analysis and interpretation) US$56 and Package 3 (full guidance) US$125, 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