AI Glossary / AI and machine learning / Intermediate
Function transformation
Definition
A function transformation is applying a mathematical function to a field's values, such as taking the logarithm of income, so the model meets the data on better terms.
What it means
Raw values often arrive in the wrong shape for modeling: income spans a thousand to a million, where the difference between ten and twenty thousand matters more than between nine hundred thousand and a million.
A transformation reshapes the scale. The logarithm compresses big values, making ratios behave like differences; squaring or rooting stretches or shrinks; standardizing re-expresses everything in units of its own spread.
Transformations serve two masters: the mathematics, since many models assume bell-shaped, evenly scaled inputs, and the meaning, since a log of income honestly reflects how money's impact tapers.
They are reversible bookkeeping: transform for the model, inverse-transform for the audience, and always report in the units people think in.
For a business, transformation is the cheapest accuracy available: a log on a skewed money field can beat a week of algorithm tuning, and it costs one line of code and one line of documentation.
There is a statistical bonus too: many methods assume bell-shaped errors, and transforming the target often makes the errors behave, so one log can satisfy the mathematics and the meaning at once.
How it works
Plot each numeric field's distribution and look for skew: long right tails on money, counts and times are the classic candidates.
Choose the transformation to match the shape: log for multiplicative skew, roots for milder cases, standardization for comparability across fields.
Handle the edge cases first: logs need positive values, so zeros and negatives get shifted or signed variants.
Apply the same transformation in training and serving, with the parameters recorded in the feature dictionary.
Inverse-transform predictions for reporting, because a forecast of 11.2 log-dollars persuades nobody in a board meeting.
Three practical examples
- Pricing: modeling log-income so proportional differences count equally across rich and poor applicants.
- Demand: logging sales so a doubling from ten to twenty weighs like a doubling from a thousand to two thousand.
- Operations: standardizing fields so no single large-scale field dominates distance-based models.
Think of it this way
Think of the difference between a ruler and a ratio scale for judging wealth. On a ruler, a billionaire is a thousand times further from a millionaire than a millionaire from a thousandaire; in logs, each doubling is one equal step. Transformation is choosing the ruler the question deserves.
The limit: the transformed units are nobody's native language. Every audience conversation needs the translation back, or accuracy is bought at the price of comprehension.
Worked example
logging a skewed income field
Suppose a lender's default model treats income linearly, so the top one per cent of applicants stretch the scale and compress everyone else into insignificance. The figures are illustrative.
The team replaces income with log-income, and the model now distinguishes a 20,000 applicant from a 40,000 one as sharply as a 200,000 from a 400,000 one.
Held-out performance improves modestly overall and substantially in the mass-market band where most decisions actually happen.
All reports convert back to currency, and the log lives only inside the machinery.
Illustrative case study
A fictional retailer standardized its fields before clustering but forgot to apply the same scaling at prediction time, so every new customer was scored on the raw scale against a model trained on standardized values.
The clusters produced plausible nonsense for a month before anyone checked the units.
The invented lesson: a transformation is a contract between training and serving. Honor it in both places or it honors neither.
The invented follow-up: the retailer added a units-and-transformations line to its scoring runbook, and the next upstream change was caught by the check in hours rather than a month.
Common misconceptions and mistakes
- Transformation changes the data's meaning. It changes the scale's shape; inverse-transformed, every value maps back to itself.
- It is only for statisticians. A log in a spreadsheet is the whole technique for the commonest case, and the payoff is immediate.
- One transformation fits all fields. Each field's shape and each model's assumptions call for their own choice, made by plotting, not habit.
Business use
Plot before transforming: the histogram tells you which fields need help, and the fix is usually obvious from the picture.
Record transformation parameters in the feature dictionary and apply them identically in training and serving.
Always inverse-transform for presentation; decisions and budgets live in original units, not in log space.
When reviewing forecasts or scores, always ask what scale they are on; a model error of 0.3 is meaningless until you know whether the units are dollars, log-dollars or standard deviations.
Add the transformation to the pre-training checklist: skew plotted, edge cases handled, parameters recorded.
People also ask
Why log money?
Because financial impact scales multiplicatively, and the log turns ratios into equal steps, matching how money actually matters.
What is standardization?
Re-expressing a field as deviations from its average in units of its spread, so fields with different units compare fairly.
Do tree models need transformations?
Much less; their splits are scale-insensitive. Transformations matter most for linear and distance-based models.
Check your understanding
Why does taking the logarithm of a skewed money field usually help a model?
Answer: Because it converts multiplicative differences into equal additive steps, matching how money's impact actually tapers and letting the model treat all bands of the range comparably.
Related terms
- Feature engineering
- Logarithm
- Standardization
- Normalization
- skew
- feature scaling
Learn next
AI for Business Owners explains the small data decisions, like choosing the right scale, that quietly decide model quality: https://aiforbusinessandlife.com/academy/ai-for-business-owners. [C2]
More in AI and machine learning
- Force control - Force control regulates the force or torque a machine applies while interacting with an object or its environment.
- Forget gate - A forget gate is the mechanism inside an LSTM network that decides what to erase from its memory: how much of each remembered thing to keep at every step.
- Formal concept analysis - Formal concept analysis is a mathematical method for organizing objects and their attributes into a concept hierarchy.
- Fuzzy agent - A fuzzy agent is a software agent that uses fuzzy logic in its reasoning or decision rules.
- Gabbay's separation theorem - Gabbay's separation theorem is a result in temporal logic concerning the separation of past, present and future reasoning.
- Gaussian Process Classification - Gaussian process classification is a method that predicts category probabilities while also saying how uncertain it is, by placing a flexible, smooth prior...
Sources
[S2] Google, Machine Learning Glossary. Full URLs are in the source ledger. Verified 11 October 2026.
Previous: Function Calling with LLMs Next: Function word