Learning outcomes

After this lesson, you will be able to:

1. When a linear relationship is not enough

Imagine estimating industrial pump failure risk from vibration. Within the normal range, a small increase in vibration may barely change the risk. Beyond a threshold, risk may rise much faster. A straight line with one constant slope cannot represent this pattern well.

Nonlinearity occurs when a feature's effect changes across ranges, has a threshold or saturation pattern, or depends on another feature. This does not make the relationship causal: the model describes statistical associations in the data.

Nonlinear relationshipA relationship that cannot be adequately represented by one linear function of the features across the full range under consideration.

2. Different representations of nonlinearity

The representation determines what a person can inspect. Some approaches retain explicit thresholds and rules; others add flexibility through feature transformations.

RepresentationHow it captures nonlinearityWhat can be inspectedLimitation
Shallow treeSequential threshold splitsPath from root to leafStepwise boundaries; possible instability
Rule setIf–then conditionsConditions, order, and exceptionsMany or overlapping rules are hard to review
Transformed featuresSquares, logarithms, piecewise-linear basesCoefficients and contributions of constructed featuresInterpretation depends on the chosen basis
Constrained modelNonlinear form under constraints such as monotonicityWhether specified behaviour is respectedConstraints need a domain justification

3. Decision trees: thresholds instead of one line

A tree divides the feature space into regions. Each region ends in a leaf that provides a prediction. A tree can therefore represent threshold effects and combinations of conditions without relying on one global slope.

For example, a model may first check vibration and, if vibration is elevated, check temperature. For an individual pump, the local explanation is the path from root to leaf: “vibration is above the threshold; temperature is above its threshold; predicted risk is high.”

Decision pathThe sequence of tests and branches an observation follows from the root node to a prediction leaf.

A deep tree can represent complex combinations, but a long path becomes difficult to inspect. Limits on depth, minimum leaf size, and leaf count help control complexity, although they do not guarantee stability.

4. Reading a nonlinear shape

The diagram shows an illustrative relationship between vibration and estimated risk. The increase is modest before a threshold and steeper afterwards. This is a shape illustration, not measured evidence. In a real task, the shape must be checked against data and domain knowledge.

A threshold-shaped nonlinear relationship Conceptual comparison of linear and nonlinear relationships between vibration and risk. Risk rises gradually before an illustrative threshold and more rapidly after it. Smaller and larger local slopes are shown. The threshold is illustrative, not a measured limit. Illustrative model comparison Linear model Nonlinear model Gradual change Faster increase Illustrative threshold Smaller slope Steeper slope Vibration level (illustrative scale) Estimated risk
Conceptual diagram, not measured results. The gray dashed line shows a linear relationship with a constant slope; the blue curve shows one possible nonlinear pattern in which the local slope becomes larger after an illustrative threshold. This does not mean every nonlinear model has a threshold or acceleration. The relationship must be checked against data and domain knowledge.

Feature transformations can add curvature or segments with different slopes. But the more basis functions and interactions we add, the more carefully we must explain what each component means.

5. Rules and feature interactions

A rule combines conditions into an inspectable statement. For example: “if vibration is above its threshold and temperature is elevated, assign the pump to the higher-risk group.” Such rules are useful when specialists need to see exactly when a condition fires.

A rule is not reliable merely because it is written in plain language. We need to know how many observations support it, how often it is wrong, whether it overlaps with other rules, and what happens to observations that match none of the conditions.

Rule checkWhy it matters
SupportHow many observations satisfy the rule
PrecisionShare of correct positive predictions among rule activations
CoverageShare of observations covered by a rule or rule set
Conflicts and orderWhether rules overlap or produce incompatible conclusions

An interaction means that the effect of one feature depends on another. For example, high temperature may be especially informative when vibration is also high. If interactions matter, the model must represent them and the analyst must check that the result is not an artefact of rare combinations.

6. Practical analysis: from data to an inspectable model

Suppose we need to rank pumps by their risk of failure in the next seven days. Available features include vibration, temperature, pressure, operating time, and maintenance history. The goal is a useful prediction whose basis can still be reviewed.

  1. Define the task and prediction time. Fix the seven-day horizon and exclude features only known after failure.
  2. Build a baseline. Start with logistic regression or a simple linear model for comparison.
  3. Add controlled nonlinearity. Compare a shallow tree with a model using pre-defined feature transformations.
  4. Constrain complexity. Record maximum depth, leaf count, rule count, or permitted interactions.
  5. Evaluate on identical splits. Use time-based train/validation/test splits; tune only on training and validation data.
  6. Check stability. Compare rules and thresholds across time windows and pump subgroups.
  7. Document boundaries. State where the model has not been tested, which rules have little support, and when expert review is required.

Do not select a nonlinear model merely because it fits the training sample better. Any improvement should persist on independent data and justify the additional complexity.

7. Evaluating clarity and performance together

Evaluation should not collapse into one score. Use task-appropriate performance metrics and record measurable structural properties. Include people who will use or audit the model in the clarity review.

AspectWhat to inspectExample question
Predictive performanceHeld-out metrics and calibrationDoes performance persist in later periods?
Structural sizeDepth, leaves, rules, interactionsCan the full logic be reviewed?
StabilityChanges in thresholds and rules across samplesDoes a small data shift change the explanation?
User understandingTasks that require reading and applying rulesCan a specialist correctly explain the prediction?
Limits and safetySubgroup errors, exceptions, out-of-range casesIs it clear when the model should not be trusted?

Clarity depends on the audience and task. Ten rules may be manageable for an engineering analyst but too many for an operator who must decide within seconds.

8. Limitations and common mistakes

  • “A nonlinear model must be a black box.” No: thresholds, trees, and explicit rules can be inspected.
  • “An understandable rule must be correct.” Clarity does not replace checks of quality, support, and stability.
  • “The smaller the tree, the better.” An overly simple structure may miss important patterns; the balance needs justification.
  • “A model-found threshold is physically meaningful.” It may reflect the sample, measurement process, or training procedure.
  • “A monotonic constraint is always right.” Use it only with a domain rationale and check the relevant ranges.
  • “High rule precision proves causality.” A rule describes a predictive association, not a causal mechanism.

9. Lesson summary

  • Nonlinearity can represent thresholds, saturation, curvature, and feature interactions.
  • Trees and rules express nonlinearity through explicit conditions; feature transformations express it through model components.
  • Greater depth, rule count, and interaction count increase flexibility but may reduce readability and stability.
  • Check not only predictive metrics but also structural stability, rule support, and clarity for the intended audience.
  • An interpretable structure does not guarantee correctness, causality, or safe deployment.
Key question: Can a specialist understand, inspect, and challenge the basis of a prediction—and recognize when the model is outside its validated scope?

What comes next

The next lesson introduces GAMs and EBM: models that represent nonlinear relationships through feature-specific functions and make their contributions available for inspection.

Open knowledge map ↗

Sources and further reading

  1. scikit-learn: Decision Trees — Documentation on decision trees, complexity parameters, and limitations.
  2. Interpretable Machine Learning: Decision Rules — An overview of decision rules and ways to evaluate them.
  3. scikit-learn: Polynomial and spline features — Feature transformations for representing nonlinear relationships.
  4. Molnar et al.: Interpretable Machine Learning — A Brief History, State-of-the-Art and Challenges — A review of approaches and challenges in interpretable machine learning.

Lesson glossary

01Nonlinear relationshipНелинейная зависимость

A relationship that one linear function cannot adequately represent across the full range.

02Threshold ruleПороговое правило

A condition that divides feature values at a specified threshold.

03Decision pathПуть решения

The sequence of conditions followed from a tree root to a leaf.

04Rule supportПоддержка правила

The number or share of observations satisfying a rule.

05Feature interactionВзаимодействие признаков

A situation in which the effect of one feature depends on another.

06Structural stabilityУстойчивость структуры

The extent to which main rules and thresholds persist under reasonable data changes.

Self-check

Choose one answer for each question and select “Check answer”. The feedback explains the key principle.

1. Why might a straight-line model describe pump failure risk poorly?

2. What is a local explanation of a shallow tree prediction?

3. Why does a simple if–then rule not guarantee reliability?

4. What should be checked when comparing nonlinear models?

5. What does a high level of interpretability mean?