Перейти к содержимому

Mastering Piecewise Functions | Math for AI & Data Science

Keduka

0:00 / 0:00

Mastering Piecewise Functions | Math for AI & Data Science

54 просмотра · 8 дн. назад
Keduka
33 подписчика
54 просмотра · 8 дн. назад
A shipping price, a jump on a graph and the ReLU function inside neural networks have one thing in common: they are piecewise functions. Continue learning: https://keduka.com/ Watch the full playlist:    • Math for AI & Data Science: From Zero to Hero   Welcome to Keduka AI School’s Math for AI & Data Science: From Zero to Hero. This lesson is Mastering Piecewise Functions: Definition, Graphing, and Continuity: how one function can follow different rules on different intervals, how to evaluate it and graph it with open circles and closed dots, and how to check whether its pieces join. IN THIS LESSON • What a piecewise function is: different rules on different intervals, and every input uses exactly one rule • Who owns a boundary point: the piece whose condition says "less than or equal to" or "greater than or equal to" • Graphing in four steps: find the boundary points, draw each piece only over its own interval, mark each endpoint (closed dot: included, open circle: excluded), and compare the heights at every boundary • Continuity: equal heights join, different heights jump, and joined does not always mean smooth • Example 1: a shipping cost, C(1.5) = 5, C(2) = 5 and C(5) = 11 dollars • Example 2: f jumps from 2 down to −1 at x = 1 • Example 3: g jumps at x = −1 and joins in a sharp peak at x = 2 • Example 4: k = 0 makes p continuous • Example 5: a = −3 and b = 3 make h continuous everywhere • Checking every answer with Python: SymPy, a plain if, elif, else chain, and NumPy WHERE THIS SHOWS UP IN AI • ReLU, one of the most common activation functions in neural networks, is piecewise: 0 for a negative input, the input itself otherwise. Its two pieces join at 0, with a corner. • Early perceptrons used a step function, which jumps from 0 to 1. Its slope is 0 everywhere except at the jump, so training that follows slopes gets nothing from it. • Example 4's p(x) with k = 0 is 4 + 3·ReLU(x − 2): a weight of 3 and a bias of 4. • Each ReLU unit adds one corner, so a network of ReLU units computes a continuous piecewise linear function: Example 5's h(x) with a = −3 and b = 3 is 2x − 3 − ReLU(x + 2) − 4·ReLU(x − 2). CHAPTERS 00:00 Welcome 01:36 What is a piecewise function? 04:03 Graphing in four steps 07:13 Example 1: shipping costs 09:21 Example 2: a jump 12:07 Example 3: three pieces 14:44 Example 4: finding k 17:44 Example 5: finding a and b 20:35 Checking with Python 21:56 Where this shows up in AI 23:41 Your turn 24:32 Summary and next steps TRY IT Pause and work them out, then check: • What does a 3 kg package cost in Example 1, C(3)? • If k = 1 in Example 4's p(x), how big is the jump at x = 2? Answers: • C(3) = 5 + 2(3 − 2) = 7 dollars • with k = 1, the closed dot sits at 2(1) + 4 = 6 and the open circle at 4: a jump of 6 − 4 = 2 Study reminder: to evaluate a piecewise function, find the condition the input satisfies and use that rule only; for continuity, compare the heights of the two neighbouring pieces at every boundary. Subscribe to Keduka AI School for visual lessons that build your mathematical intuition, one idea at a time. #PiecewiseFunctions #Continuity #ReLU #ActivationFunctions #MathForAI #DataScience #KedukaAISchool #AI #MachineLearning #DeepLearning #NeuralNetworks #DeepLearningTutorial #AIEducation #ModelTraining #DataAnalysis #Precalculus