Evaluating a Learning Algorithm!

Today i will be writing about "Machine learning Diagnostics" , how to evaluate your algorithm and select the best Model.

Lets says we found a Business Problem - Based on the size of a plot , one need to estimate the price .
We found a  suitable learning algorithm after the exploratory data analysis and these Algorithms becomes our "Hypothesis"

Now we need to test if our hypothesis is true on the data.

lets divide the data set into 3 parts
1. Training Set
2. Cross Validation Set and
3. Test Set.



Now lets try 10 different equations on the Training Data set .
Start with Linear Equation and up until 10th Order Polynomial Equation



Optimize the Parameters using the Training data-set . We optimize Parameters using Gradient Descent Optimization Algorithm.
https://en.wikipedia.org/wiki/Gradient_descent
Gradient descent is an optimization Algorithm which uses minimization principal to select Optimal parameters.

In-spite of Optimization for error , if error continues in the Training data-set  following steps can be taken.



Once you run the gradient descent optimization - you will  arrive at optimal parameters  that best fits the training data set , now this does not mean that you can generalize this model to test data .

Hence it is necessary to run the model in Cross Validation data set before applying them on Test Data.
To judge which model is the best , calculate errors for each Model with in Training and Cross Validation Set as seen below.
There are different types of mathematical cross validations which i will cover in the next few posts.

Formulae to calculate Error.



There are 2 types of mathematical situations BIAS AND VARIANCE - that can result in a difference between  Training Error  and Validation Error.




How to deal with Bias and Variance is something which we can do in the next post.

As seen below in the Cross Validation data-set equation with a polynomial degree of 4 , seems to have a Training error that is same as cross validation error .
Chose this Model to apply on the test set.



This is the math that goes behind the Machine Learning.
For a Classification problem - errors are nothing but miss classification

Reference borrowed from : Coursera


 

Comments