Derivatives for Data Scientists in 120 seconds…

Arion Das
2 min readFeb 26, 2024

DERIVATIVES

Derivatives are an important concept for understanding deep learning.

At a high level, the derivative of a function at a point is the “rate of change” of the output of the function with respect to its input at that point.

MATH

We can describe the number—change in the output of a function f as we change its input at a particular value ‘a’ of the input—as a limit:

LIMIT

The limit can be approximated by setting a very small value for Δ, such as 0.001. Now, we can compute the derivative as:

APPROXIMATED LIMIT

This is only one part of a full mental model of derivatives.

GEOMETRY

We draw a tangent to the graphical representation of the function f; the derivative of f at a point ‘a’ is the slope of this line at a.

We can either use calculus to calculate the slope of the line at that point or take the slope of the line connecting f at a — 0.001 and a + 0.001.

DERIVATIVES AS SLOPES

DERIVATIVES FOR HACKERS

This is an approximation to the derivative and not an exhaustive piece of code.

from typing import Callable
def deriv(func: Callable[[ndarray], ndarray], input_: ndarray, delta: float = 0.001) -> ndarray:
'''
Evaluates the derivative of a function "func" at every element in the "input_" array.
'''

return (func(input_ + delta) - func(input_ - delta)) / (2 * delta)

Let’s connect and build a project together: 🐈‍⬛

The Rotation of the Earth really makes my day

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Arion Das
Arion Das

Written by Arion Das

AI Eng intern @CareerCafe || Ex NLP Research Intern @Oracle | Gen-AI Research | LLMs | NLP | Deep Learning | LinkedIn: https://www.linkedin.com/in/arion-das/

No responses yet

Write a response