liveBook · Manning

Nonlinear mapping

As explained in Statistics Every Programmer Needs

A nonlinear relationship is a relationship in which changes in one quantity are not represented by a linear function of another.

A nonlinear mapping relates changes in one quantity to another without a linear function. The relationship may bend, vary in sensitivity, or respond differently across ranges. section 7.2

Nonlinearity matters when a model must represent complex patterns rather than a constant-rate association. Stock prices, for example, reflect interacting economic, behavioral, and market factors; traditional ARIMA, exponential smoothing, or linear models may miss such dynamics. section 7.2 section 4.1.3

Common modeling responses include:

  • Transform variables with logarithmic, reciprocal, square-root, or power transformations, while interpreting the fitted relationship on the transformed scale. section 4.1.3
  • Use decision trees when feature-target relationships are nonlinear and preprocessing should not require normalization or scaling. section 6.3.7
  • Treat outlier removal cautiously: deleting one point can improve a regression fit, but transformation or another model may better represent the underlying pattern. section 4.1.3

Regression versus a decision tree

A linear regression can fit an association after transforming a skewed variable, but the transformation changes the modeled scale. A decision tree can capture nonlinear feature-target relationships directly, although an unpruned tree may overfit. section 4.1.3 section 6.3.7

df['x'] = np.log(df['x'])

A logarithmic transformation illustrates one way to reshape a variable before fitting a linear model. section 4.1.3

How Statistics Every Programmer Needs covers it

How deep it goes
Explains transformations, outlier effects, and decision-tree behavior, but stops short of deriving nonlinear functions or algorithms.
Examples
Uses stock-price forecasting, logarithmic and square-root transformations, and a decision-tree comparison as concrete examples.
What it assumes
Assumes familiarity with variables and regression, while introducing transformations and nonlinear model selection through practical examples.
What you can do after
Evaluate whether transformations or decision trees better capture nonlinear patterns while checking assumptions, outliers, and overfitting.
How it connects
Connects nonlinear mapping to linear regression, data transformation, outliers, decision trees, random forests, and time-series forecasting.

Also explained in

Compare how 7 books explain nonlinear mapping →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.