At its core, machine learning often involves finding patterns and making predictions based on data. To do this mathematically, we need a way to describe relationships between different quantities. This is where functions come in. Think of a function as a precise rule or a mechanism that takes an input and produces exactly one output.
Imagine a simple vending machine: you put in money (input) and select an item code (another input), and it gives you a specific snack (output). A mathematical function works similarly, but with numbers or other mathematical objects.
The values we feed into a function are called inputs or arguments. The value the function produces based on the input is called the output. We often use letters like x to represent the input and y or f(x) to represent the output. The notation f(x) is read as "f of x" and signifies the output of the function f when the input is x. The letter f itself represents the function, the rule that transforms the input into the output.
For example, consider a function that doubles any number you give it and then adds 1. We can write this rule using function notation as:
f(x)=2x+1
Here:
If we provide the input x=3, the function applies the rule: f(3)=2(3)+1=6+1=7. So, for the input 3, the output is 7.
If the input is x=−5, the output is: f(−5)=2(−5)+1=−10+1=−9.
While there are many types of functions, a few are particularly relevant as we start our exploration into calculus for machine learning:
Linear Functions: These produce a straight line when graphed. They have the general form: f(x)=mx+b Here, m represents the slope (how steep the line is) and b is the y-intercept (where the line crosses the vertical axis). The function f(x)=2x+1 we just saw is a linear function with m=2 and b=1. Linear functions are fundamental in machine learning, forming the basis of models like linear regression.
Polynomial Functions: These involve terms with non-negative integer powers of the input variable, like f(x)=x2 (a parabola) or g(x)=3x3−5x+2. They can represent more complex, curved relationships in data.
Other Functions: As you progress, you'll encounter functions like exponential functions (ex), logarithmic functions (log(x)), and trigonometric functions (sin(x),cos(x)), which appear in various machine learning contexts, such as activation functions in neural networks or modeling growth patterns.
For now, let's focus on understanding the basic input-output relationship. Consider the linear function f(x)=0.5x−1.
Each input (4,0,−2) maps to exactly one output (1,−1,−2).
Functions are the mathematical language used to describe the models we build.
Understanding functions as mappings from inputs to outputs is the first step. It gives us a framework for representing models and their performance, setting the stage for using calculus to analyze and improve them. In the next sections, we'll look at how to visualize these relationships graphically and introduce the concept of limits, which builds directly on the idea of function behavior.
© 2025 ApX Machine Learning