Successfully reported this slideshow.                                        Upcoming SlideShare
×

of                                        # Fundamental Math for data science - I

This is the slide deck to the first part of the "Fundamental math concepts" that one must understand before getting into Data Science in a honest to goodness way. This training covers fundamentals of calculus and linear algebra.
The second training covers probability and statistics and slightly advanced concepts in Linear Algebra and Calculus.

The third training covers math for various techniques like PCA / SVM, Neural Networks etc.

### Related Books

#### Free with a 30 day trial from Scribd

See all
• Be the first to like this

### Fundamental Math for data science - I

1. 1. Fundamental Math for Data Science Vishal Gokhale
2. 2. Intros and warm-up • How many lines pass through a single point? • How many lines pass through 2 distinct points? • How many points form a line? • What are Collinear points ? • What are non-collinear points? • To define a plane you need at least __ ______ points ? • How many planes pass through a line? • What is a line segment?
3. 3. Prove that 1. 𝑎 𝑚 . 𝑎 𝑛 = 𝑎 𝑚+𝑛 2. 𝑎 𝑚 ÷ 𝑎 𝑛 = 𝑎 𝑚−𝑛 3. 𝑎0 = 1 4. 𝑎−𝑚 = 1 𝑎 𝑚 5. (𝑎 𝑚 ) 𝑛 = 𝑎 𝑚𝑛 Intros and warm-up
4. 4. Prove that 1. 𝑙𝑜𝑔 𝑏 𝑥𝑦 = 𝑙𝑜𝑔 𝑏 𝑥 + 𝑙𝑜𝑔 𝑏 𝑦 2. 𝑙𝑜𝑔 𝑏( 𝑥 𝑦 ) = 𝑙𝑜𝑔 𝑏 𝑥 − 𝑙𝑜𝑔 𝑏 𝑦 3. 𝑙𝑜𝑔 𝑏 𝑏 = 1 4. 𝑙𝑜𝑔 𝑏 1 = 0 5. 𝑙𝑜𝑔 𝑎 𝑥 = 𝑙𝑜𝑔 𝑏 𝑥 𝑙𝑜𝑔 𝑏 𝑎 Intros and warm-up
5. 5. What is 1. 𝜋 ? 2. sin 𝜃 ? 3. cos 𝜃 ? 4. tan 𝜃 ? 5. ? for ex. 𝑖=0 𝑛 𝑥𝑖 6. ? for ex. 𝑖=0 𝑛 𝑥𝑖 Intros and warm-up
6. 6. • Measurements ! • 𝑦 = 𝑥 • 𝑦 = 3𝑥 • 𝑦 = 𝑥 + 5 Generic abstraction: • 𝑦 = 𝑓 𝑥 Functions as transformations
7. 7. Try plotting following:  𝑥  𝑥2  𝑥3  log(𝑥)  𝑎 𝑥 See the effect of shifting and scaling on each of these • 𝑥 − 1 2 , 𝑥 + 𝑎 2 , • 3𝑥2 , 𝑎𝑥2 Play with sliders for the parameter Plot Functions https://www.desmos.com/calcul ator
8. 8. General Equation of Line • 2 points define a line (Euclid) • Slope of a line : m • Intercept on y-axis : c 𝑦 = 𝑚𝑥 + 𝑐
9. 9. Combinations of functions Combining functions to make more functions • 𝑦 = 𝑓 𝑥 + 𝑔 𝑥 • 𝑦 = 𝑓 𝑥 . 𝑔 𝑥 • 𝑦 = 𝑓 𝑔 𝑥
10. 10. https://www.desmos.com/calcul ator Try plotting :  𝑥2 + 𝑥3  2𝑥. (𝑥 + 4)  log(𝑥2 ) Plot Functions
11. 11. What determines the shape of a function? The direction in which tracer moves as we move from one end of the x axis to the other. To get a sense of direction, we can choose any 2 points on the curve and compute the Shape of a Function
12. 12. Rate of Change • Slope indicates the rate of change • 2 close points on the function • Derivative = Slope of the tangent drawn to a function at a point • Formal definition lim ℎ→0 𝑓 𝑥 + ℎ − 𝑓(𝑥) ℎ
13. 13. Find the derivative of : 𝑓 𝑥 = 𝑥2 using the definition of derivatives 𝑓 𝑥 = 𝑥3
14. 14. Derivative of Sum 𝑦(𝑥) = 𝑓 𝑥 + 𝑔(𝑥) 𝑑𝑦 𝑑𝑥 = 𝑑𝑓 𝑑𝑥 + 𝑑𝑔 𝑑𝑥 Derivative of sum is equal to sum of derivatives
15. 15. Product Rule 𝑦(𝑥) = 𝑓 𝑥 . 𝑔 𝑥 𝑑𝑦 𝑑𝑥 = 𝑓 𝑑𝑔 𝑑𝑥 + 𝑔 𝑑𝑓 𝑑𝑥 Left-d-Right + Right-d-left
16. 16. Chain Rule 𝑦(𝑥) = 𝑓 𝑔 𝑥 𝑑𝑦 𝑑𝑥 = 𝑑𝑓 𝑑𝑔 x 𝑑𝑔 𝑑𝑥
17. 17. Examples
18. 18. Exponential functions •Lets say there’s mutual fund that doubles your investment every year. You start with an investment of 1\$. Value as a function of time is? 𝑣 = 2 𝑡 •What is the rate of growth at any given time? 𝑑𝑣 𝑑𝑡 = 𝑑 𝑑𝑡 2 𝑡
19. 19. Applications Regression • Hypothesize a relationship. • Define a cost function • find parameters that minimize the cost Revenue Optimization • Find the price for which revenue is optimal
20. 20. Integrals • Example 1: Area of the circle Sum of areas of the concentric strips • Example 2: Distance covered. • Area under the curve • Definite Integral - Concept • Definite Integral as the limit of the sum
21. 21. Linear Algebra
22. 22. What are vectors? •Vectors in physics: •Arrows floating in space ex. Force, Velocity, Displacement etc. •Computer Science idea: •List of numbers •Generalizing the concept •Arrows rooted at origin with the numbers representing the walk along each direction
23. 23. FundamentalVector Operations•Adding Vectors •Multiply by a constant number. •Or in other words scale a vector •Hence the multiplier is called scalar •In fact every vector in 2 dimensions is the result of an addition of 2 scaled unit vectors.
24. 24. Some terminology • Basis vectors • Span of the vectors • If third vector is a linear combination of the 2 vectors you are trapped into the same flat sheet •In other words, including scaled version of one / both the vectors as a third vector doesn’t give you access to any new vectors (or even when the third vector is got by scaling and adding the 2 vectors)
25. 25. Linearly Dependent VectorsWhenever you can remove a vector from the set of vectors, without reducing the span, we say they are linearly dependent vectors Technical definition of basis vectors for a given space – set of linearly independent vectors that span that space
26. 26. The single most important concept in linear algebra that was never taught !! •What is a matrix? •set of vectors defining where each unit vector lands
27. 27. The single most important concept in linear algebra that was never taught !! •What do we mean when we say that Matrices are Linear transformations? •Transformations: Stretching, squishing, rotation , flipping of space •Linear • Origin remains fixed in place • All lines remain lines In general keeping grid lines parallel and evenly spaced
28. 28. Examples
29. 29. Matrix multiplication ≡ function composition • If you apply M1 on A, then apply M2 on the result it is the same as applying M3 (=M1M2) on A • Matrix multiplication is not commutative M1M2 ≠ M2M1 • Matrix multiplication is associative (M1M2)M3 = M1(M2M3)
30. 30. Determinant •Determinant of a matrix corresponds to the area enclosed by the by the parallelogram (parallelepiped) formed by the vectors in the matrix •i-hat and j-hat form a square of area 1 Thus determinant is nothing but the amount by which the area scales when the space is transformed by the given matrix
31. 31. Determinant •Interpretation of the negative value of the determinant •In 3 dimensions? • the determinant of a transformation is the volume of the parallelepiped enclosed by the 3 vectors in the that space. •What happens in 1 dimension?
32. 32. System of linear equations •2𝑎 + 3𝑏 + 𝑐 = 5 •3𝑎 + 4𝑏 + 6𝑐 = 8 •5𝑎 + 3𝑏 + 9𝑐 = 3 Can these be represented as a matrix? 𝐴𝑥 = 𝑣
33. 33. Inverse of a Matrix A x = v •Which means we are looking for a vector x which was transformed by A into v •To find x we can apply another transformation B on Ax that reverses the effect of A on x. i.e. it transforms v to back to x. •Since B reverses the effect of A , it called A inverse, notation: A-1
34. 34. Rank of a matrix •Finding the transformation A-1 is possible when determinant is non-zero •When determinant is zero, the number of dimensions in the output vector is less than the number of dimensions in the input vector •Rank of a transformation is the number of dimensions in the output vector. •Thus if the rank of the matrix is less than the number of dimensions of the input vector it won’t be possible to find the inverse of the transformation
35. 35. What about non-square matrices? •3x2 matrix transforms a vector from 2 dimensions to 3 dimensions •2x3 matrix transforms a vector from 3 dimensions to 2 dimensions
36. 36. Dot Products •Numerically is just multiplying the respective coordinates and adding the result. •Geometrically it is equivalent to projecting one vector (v) onto the span of another vector (w) and multiplying the magnitude of the projection (of v on w) with the magnitude of w
37. 37. Cross Products •Numerically: • v x w | i-hat v1 w1 | • Det | j-hat v2 w2 | | k-hat v3 w3 | •Geometrically: •Cross-product is a vector with magnitude equal to the area of the parallelogram enclosed by v and w pointing in a direction perpendicular to v and w as suggested by the right-hand-rule.
38. 38. Eigen Values and Eigen Vectors •In case of some transformations, there exist some vectors which are not knocked off from their span, they are only scaled as a result of the transformation – •these are Eigen Vectors
39. 39. Eigen Values and Eigen Vectors •The amount by which each Eigen vector gets scaled (after transformation) is its Eigen Value •For a transformation A, if there exists a vector v and scalar λ such that 𝐴 𝑣 = 𝜆 𝑣 Then v is called the Eigen Vector and λ is the corresponding Eigen value
40. 40. ~THE END~ I’ll be back ;-) india.odsc.com

Total views

130

On Slideshare

0

From embeds

0

Number of embeds

0

8

Shares

0