Created this repo to cover basics of Math behind ML. Math Topics that am gonna cover are:

  • Algebra (linear algebra and matrices).
  • Calculus (partial derivatives and integrals).
  • Probablity (with information theory).
  • Statistics.

Linear Algebra#

  • Data structures for algebra.
  • Some tensor operations.
  • Matrix properties.

Data Structures for algebra#

Algebra is basically an arithmetic expression that includes non-numerical entities like x|y|z|anything. eg: x+y=20|2x+3y=3|x^2+y=10 etcc, from this expression where we can derive values for those non-numerical entities or make the expression to minimize.

If an expression has exponential term or root, it won’t come under linear algebra. eg: x^2+y=10|√x+5=10|3√x+6y=20. Linear algebra is finding|solving unknowns in an equation(kinda statement problems). EG: - Sheriff has 180KM/hr car - Bank robber has 150KM/hr and five-minute head start - How long does it take the sheriff to catch the robber

```
    d = distance; t = time per minute
    d(robber) = 2.5t(150KM/hr / 60Min = 2.5)
    d(sherrif) = 3(t - 5)(180KM/hr / 60Min = 3)

    2.5t = 3t - 15
    2.5t - 3t = -15
    -0.5t = -15
    0.5t = 15
    t = 15/0.5
    t = 30Min
```

From the above example, the answer would be 30Min, if the robber and the sheriff are with the speed then there cannot be a solution, coz both will have the same(time), i.e a linear algebra solutions can only be of one, no or infinite solutions.

In any given system of equations. - It can contain many equations. - It can contain many unknowns in each equations. EG: y = a + bx + cz etcc (x, y, z are unknowns)


NOTE

Tensor - Tensors are basically which used to represent different dimensions of data, EG: 1 => scalar(tensor), [1, 2] => vector or 1d array(tensor), [[1, 2], [3, 4]] => 2darray(matrices, tensor), ND array tensor, all these are called tensors.

Weights - Weights are nothing but a number that given to any input to determine the weight of that particular input during the training. EG: Consider we are training a model to find whether a vehicle is bike or car.

x1 = has wheels, x2 = should wear helmet, x3 = park easily (inputs);
w1 = 0.8(can be both), w2 = -0.5(means it is not bike, can be car), w3 = 0.6(means it could be bike, since its easily parkable)

Exercise - Jil Designs solar panels as a hobby - On April 1st, jils M1 design begins generating power: 1Kj/day - On May 1st, jils M2 design begins generating power: 4Kj/day

1. What day is it when jils Mark2 design has generated as much total energy as Mark1 design?
M1 = (T + 30)1 => here T is the current day, so am adding 30 to match with may1st and 1 is the power
M2 = 4T => here T is the current day, 4 is the power

T + 30 = 4T
30 = 4T - T
3T = 30
T = 10
Now we found out the current day is 10.
M1 = T + 30
= 10 + 30
= 40
means 40th day from April 1st, which is May 10th.
1. How much total energy have both generated by that day?
Already we found out that it is May10th.
now 
(T + 30)1 = M1 
10 + 30 * 1 = M1
M1 = 40

M2 = 4T
M2 = 4 * 10
M2 = 40

total = M1 + M2 => 80

Tensors#

Tensors are nothing but any number of dimensions that represents matrices or vectors. EG above.
  • Scalar: Single number or no dimensions, can be of any type like int | float32