How to do it...

  1. Let's assume we have a quadratic cost function and we find its minima:
  1. The cost function in statistical machine learning algorithms acts as a proxy for the level of difficulty, energy spent, or total error as we move around in our search space.

 

  1. The first thing we do is to graph the function and inspect it visually.
  1. Upon visual inspection, we see that   is a concave function with its minima at (2,1).
  1. Our next step would be to find the minima by optimizing the function. Some examples of presenting the cost or error function in machine learning could be squared error, Euclidian distance, MSSE, or any other similarity measure that can capture how far we are from an optimal numeric answer.
  1. The next step is to search for best parameter values that minimize errors (for example, cost) in our ML technique. For example, by optimizing a linear regression cost function (sum of squared errors), we arrive at best values for its parameter.
    • Derivative method: Set the first derivative to zero and solve
    • Vertex method: Use closed algebraic form
  2. First, we solve for minima using the derivative method by computing the first derivative, setting it to zero, and solving for x and y.

Given f(x) = 2x2 - 8x +9 as our cost/error function, the derivative can be computed as:

[Power rule: ]

[We set the derivative equal to 0 and solve for]

We now verify the minima using the vertex formula method. To compute the minima using the algebraic method please see the following steps.

  1. Given the function, , the vertex can be found at:
  1. Let's compute the minima using the vertex algebraic formula:
2(2)2 + (-8) (2) +9
  1. As the last step, we check the result of steps 4 and 5 to make sure that our answer using a closed algebraic form yielding the minimum of (2, 1), is consistent with the derivative method which also yields (2, 1).
  1. In the last step, we show a pictorial view of f(x) in the left panel along with its derivative on the right panel, so you can visually inspect the answer for yourself.
  1. As you can see, a casual inspection depicts that the minima vertex is at (2,1) on the left hand side { x=2, f(x)=1 } while the right hand side chart shows the derivative of the function with respect to X (only the parameter) with its minima at X=2. As seen in the previous steps, we set the derivative of the function to zero and solve for X which results in number 2. You can also visually inspect the two panels and equations to make sure X=2 is true and makes sense in both cases.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.50.185