Basic Derivatives
Lesson Introduction
Welcome to our lesson on basic derivatives! In machine learning, understanding how things change is crucial. Derivatives help measure these changes, which is key for optimizing models. By the end, you'll understand derivatives, know how to calculate them, and see a practical example using Python.
What is a Derivative?
Let's understand the concept of a derivative. Imagine you're driving a car. Your speed indicates how your position changes over time. Similarly, a derivative measures how a function's output changes as its input changes. It's like the speed for functions. The derivative is calculated for every input of the original function. So, the derivative is also a function of the same input.
Calculating an Approximation for a Derivative: part 1
Let's try to approximate the derivative of the function at . In other words, we want to see the speed of the function's growth (or decay) at this point. Using a small change , we will find how much function changed when the x changed:
Here’s a graph to illustrate this:

In the picture, the green dashed line shows our slope approximation using . We see, that the function changed from 4 to 9, while x changed from 2 to 3. We can make a conclusion that the speed of the function at is roughly , which equal to 5.
Calculating an Approximation for a Derivative: part 2
We care about the derivative at point , but what we really calculate is the speed of the function on the interval. Let's improve the accuracy of our approximation by choosing a smaller . Here is a new graph:

Here, the . The derivative approximation is , which is equal to 4.5. This time, we calculated the function's growth speed on the interval, which gives us a better approximation quality. By shrinking this interval (in other words, by making lower), we can improve the approximation quality.
For example, making the same calculations on the interval will give you a value, which is very close to the actual derivative at point . However, it won't be exact.
