Zum Hauptinhalt springen
LIVE
CVSS 6.9CVE-2026-137684 | A security flaw has been discovered in eosphoros-ai DB-GPT up to 0.8.3. This affects the function editor_sql_run of the file packages/dbgpt-app/src/dbgpt_app/openapi/api_v1/editor/api_editor_v1.py of the component Editor SQL Run API. Performing a manipulation of the argument db_name results in authorization bypass. It is possible to initiate the attack remotely. The exploit has been released to the public and may be used for attacks. The pull request to fixCVSS 8.7CVE-2026-137992 | libexpat through 2.11.0 contains a denial of service vulnerability in defineAttribute() of lib/xmlparse.c that fails to detect duplicate non-ID #IMPLIED or #REQUIRED attribute declarations. Attackers can supply a crafted XML document with repeated ATTLIST declarations in an internal DTD subset to cause quadratic CPU consumption in storeAtts() during parsing.CVSS 8.5CVE-2026-137994 | Leo through 6.8.10 contains an insecure deserialization vulnerability that allows attackers to execute code by embedding pickled data in unknown XML attributes of .leo outlines. Attackers can place a pickle __reduce__ gadget in a or element attribute that resolveUa passes to pickle.loads, executing code with user privileges when the outline is opened.CVSS 7.0CVE-2026-137995 | FOG Project before 1.6.0.119 contains an information disclosure vulnerability that allows unauthenticated attackers to obtain host tokens from status/hostgetkey.php by supplying a host MAC address. Attackers can present the token to service/hostinfo.php to retrieve decrypted Active Directory join credentials and Windows product keys during deployment windows.CVSS 6.8CVE-2026-137996 | Zettlr before 4.11.0 fails to validate URI schemes in Markdown link targets, allowing attackers to launch arbitrary registered protocol handlers via Electron shell.openExternal without confirmation. Attackers can craft documents whose Ctrl/Cmd-clicked links use smb:// to leak NTLM credential hashes on Windows or invoke custom protocol handlers with attacker-controlled parameters.CVSS 8.5CVE-2026-137997 | HCIPy through 0.7.1 contains an insecure deserialization vulnerability that allows attackers to execute code by supplying crafted .pkl files to read_field, read_grid or read_mode_basis. Because hcipy/util/io.py selects pickle by file extension and calls pickle.load, a __reduce__ gadget in a pupil, apodizer, PSF or mode-basis file runs code with the user's privileges.CVSS 8.5CVE-2026-137998 | Detoxify 0.5.3 through 0.5.4 contains an insecure deserialization vulnerability in load_checkpoint that allows attackers to execute code by supplying a crafted checkpoint file. Attackers can embed a pickle __reduce__ gadget in a .ckpt file loaded via torch.load with weights_only=False to run code with the user's privileges.CVSS 8.5CVE-2026-137999 | JSONSchema2PoPo2 through 3.0.3 contains a code injection vulnerability that allows attackers to inject Python code by supplying JSON Schema default or format values that are written unescaped. Attackers can place a single quote in a string property default to break out of the literal in the generated __init__ signature, executing injected code when the generated module is imported.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

Decision Trees (Supervised Learning)

1. The Problem It Solves Many real-world problems don't follow a straight-line relationship. People don't make decisions by gradually increasing or decreasing…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Quelle & Fakten · 6 Min. Lesezeit
Quelle: dev.to
Rubrik: Programación segura




1. The Problem It Solves



Many real-world problems don't follow a straight-line relationship.



People don't make decisions by gradually increasing or decreasing something. Instead, they often make decisions based on conditions.



For example:




  • Will this customer upgrade?

  • Is this transaction fraudulent?

  • Should this loan be approved?

  • Will this machine fail?

  • Is this email spam?



The answer usually depends on a series of if-else rules, not a mathematical equation.



For example:




  • If monthly spending is greater than $500 and

  • Login frequency is less than twice a week and

  • Support tickets are increasing



then the customer is likely to churn.



Decision Trees are designed to discover these kinds of rules automatically.



Instead of fitting a line like Linear or Logistic Regression, they keep asking questions that split the data into smaller and more similar groups.









2. Core Intuition



Imagine you're playing 20 Questions.



You're trying to guess whether a customer will upgrade their subscription.



Instead of making one big guess, you ask simple Yes/No questions.



For example:




Does the customer have more than 20 seats?




If yes...



Ask another question.




Are API calls greater than 500 per day?




If yes...



Ask another question.




Has the account been active in the last week?




Eventually, you reach a point where almost every customer in that group behaves the same way.



That final group becomes a Leaf Node.



Whenever a new customer arrives, you simply walk them through the same set of questions until they reach a leaf.



The prediction is based on the majority of training examples that ended up there.









3. How the Algorithm Works



Decision Trees are built one split at a time.



At every node, the algorithm asks:




"Which question separates the data the best?"




It tries every feature.



Then every possible split point.



The split that creates the cleanest separation is chosen.



This process repeats until the stopping criteria are met.









4. Measuring Node Purity



To decide whether a split is good, the algorithm measures how "mixed" the classes are inside each node.



One of the most common metrics is Gini Impurity.



Where:





  • pᵢ = probability of class i


  • C = total number of classes



Interpretation:





  • Gini = 0 → Every sample belongs to one class (perfectly pure)

  • Higher values → Classes are mixed together



The goal is to make every leaf node as pure as possible.









5. Information Gain



Every possible split is evaluated.



The algorithm calculates how much impurity decreases after making that split.



This decrease is called Information Gain.



The split with the highest Information Gain becomes the next branch in the tree.



Then the entire process repeats recursively for each child node.









6. When Does the Tree Stop Growing?



If left alone, a Decision Tree keeps splitting until every training example has its own leaf.



That almost always leads to overfitting.



To prevent this, we usually limit tree growth using parameters like:




  • max_depth

  • min_samples_split

  • min_samples_leaf

  • max_leaf_nodes



These regularization settings help the tree generalize to unseen data instead of memorizing the training set.









7. When Should You Use Decision Trees?



Decision Trees work well when:




  • Relationships are non-linear.

  • Data contains many conditional rules.

  • Features are a mix of numerical and categorical values.

  • Interpretability is important.

  • You don't want extensive preprocessing.



Typical applications include:




  • Customer churn prediction

  • Credit approval

  • Fraud detection

  • Medical diagnosis

  • Product recommendation

  • Customer segmentation

  • Risk assessment









8. Advantages



Decision Trees have several practical benefits.




  • No feature scaling required.

  • Handles numerical and categorical data.

  • Learns non-linear relationships automatically.

  • Easy to visualize and explain.

  • Captures feature interactions naturally.

  • Works well even with missing values (depending on implementation).









9. When It Starts Breaking Down



Decision Trees are powerful, but they have some important weaknesses.






Overfitting



The biggest problem.



If the tree grows without limits, it starts memorizing the training data instead of learning real patterns.



This usually results in poor performance on new data.









High Variance



Decision Trees are unstable.



A small change in the training data can completely change the structure of the tree.



Two trees trained on almost identical datasets may look very different.









Greedy Decisions



The algorithm always chooses the best split right now.



It never looks ahead.



That means an early decision can prevent the tree from finding a better overall structure later.









Bias Toward Features with Many Split Points



Continuous numerical features often have many possible split locations.



Without proper controls, the algorithm may favor these features even when they aren't the most meaningful.









10. Python Implementation






import numpy as np
import pandas as pd

from sklearn.tree import DecisionTreeClassifier
from sklearn.tree import export_text

from sklearn.metrics import accuracy_score

# Generate sample data
np.random.seed(42)

seat_count = np.random.uniform(1, 100, 100)
api_calls = np.random.uniform(10, 1000, 100)

# Business rule
upgraded = (
(seat_count > 20) &
(api_calls > 500)
).astype(int)

df = pd.DataFrame({
"Seat_Count": seat_count,
"API_Calls": api_calls,
"Upgraded": upgraded
})

X = df[["Seat_Count", "API_Calls"]]
y = df["Upgraded"]

# Train Decision Tree
model = DecisionTreeClassifier(
max_depth=3,
random_state=42
)

model.fit(X, y)

# Predictions
predictions = model.predict(X)

print(
"Accuracy:",
accuracy_score(y, predictions)
)

print("\nDecision Rules\n")

print(
export_text(
model,
feature_names=[
"Seat_Count",
"API_Calls"
]
)
)












11. How to Evaluate the Model






Accuracy



Measures the percentage of correct predictions.



Useful when classes are balanced.









Precision



How many predicted positives were actually positive.









Recall



How many actual positive cases were correctly identified.









F1 Score



Balances Precision and Recall.



Useful for imbalanced datasets.









Tree Depth



A deeper tree isn't always better.



Very deep trees usually indicate overfitting.









Feature Importance



Decision Trees automatically estimate how useful each feature was during training.



This helps explain which variables influenced predictions the most.









12. Real-World Engineering Notes



Here are a few things you'll notice in production:




  • Decision Trees are one of the easiest ML models to explain to non-technical teams.

  • They require very little preprocessing.

  • Always limit tree growth using max_depth or min_samples_leaf.

  • A single Decision Tree rarely gives the best performance.

  • Most production systems use ensembles like Random Forest or Gradient Boosting because they reduce overfitting and improve accuracy.

  • Think of a Decision Tree as the building block for many of today's strongest machine learning algorithms.









13. Key Takeaways




  • Decision Trees solve classification and regression problems using a series of if-else rules.

  • They automatically discover non-linear relationships in data.

  • The algorithm chooses splits that maximize Information Gain and reduce impurity.

  • Easy to understand, visualize, and explain.

  • Requires little preprocessing and no feature scaling.

  • Can overfit easily if not regularized.

  • Forms the foundation of Random Forests, Extra Trees, XGBoost, LightGBM, and many other ensemble methods.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Debate de la comunidad y comentarios

🌐 Unirse al chat principal

Inicia el debate en el stream de difusión del Social Chat o envía arriba una contribución experta mediante el formulario de ampliación.

Valoración de la comunidad & prueba social
⭐ Valoración de los lectores
–
Ø / 5.0
Aún no hay valoraciones de lectores
¿Le ha resultado útil este artículo?
0
Dejar una valoración ahora
Valoración detallada (opcional)
Contenido & calidad
Fuente & credibilidad
Actualidad
Briefing de seguridad Gratis · baja en 1 clic

Intelligence Digest — gratis

Cada día las noticias de seguridad más importantes · baja en cualquier momento

Clústeres de historias relacionados & fuentes (IA vectorial)

2 Cluster
2 fuentes
Barclays’ US banking arm confirms data breach
IT Security News hace 6 h
1 fuente más
Artículos similares
🔍 Verwandte News

Auch interessante Nachrichten Decision Trees (Supervised Learning)

Thematisch verwandte Begriffe: Decision, Trees, Supervised, Learning · 6 Treffer

Laden...

Cargando vídeos ...

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

Laden...

Cargando artículos ...

Laden...

Cargando vídeos ...

💬 Cargando comentarios…
Desliza para actualizar
Widgets & Topics
Loading widgets…
Nächster Beitrag