Showing posts with label Supervised Learning. Show all posts
Showing posts with label Supervised Learning. Show all posts

Thursday, 29 May 2014

Understanding Evaluation Metrices.



Confusion Matrix is a tabular layout that can be used to measure the performance of an algorithm. Each Column represents predicted value and each row represents actual value. 
Lets take an example of testing a person for cancer. 
If the person has cancer , the test will say it as positive and if not then negative.
There are can be 4 outcomes if we consider test as an experiment.

1) The patients were suffering from cancer and our test recognized them as suffering from Cancer : These are called TRUE POSITIVE.
2) The patients were suffering from cancer but tests showed negative : These are called TRUE NEGATIVE
3) Patients who were healthy but were diagnosed as suffering from Cancer : FALSE POSITIVE
4) Patients who were not suffering from cancer and test said the same : FALSE NEGATIVE.

Precision (Positive Predicted Value) : proportion of patients test showed as having cancer and they actually had cancer.

\mathit{PPV} = \mathit{TP} / (\mathit{TP} + \mathit{FP})
  
Recall(True Positive Rate)  : proportion of patients that actually had Cancer were diagnosed by test as having cancer. :
\mathit{TPR} = \mathit{TP} / P = \mathit{TP} / (\mathit{TP}+\mathit{FN})
 
Precision and Recall Inversely Related

Accuracy : 
Ratio of Correctly classified instances to total instances.
In layman terms : Number of times the test were right 
\mathit{ACC} = (\mathit{TP} + \mathit{TN}) / (P + N)

Where P and N are total number of tests.


F1 :  is a measure that combines the precision and recall rates by computing the harmonic mean between them. F-Measure does not consider True Negatives into account. 

\mathit{F1} = 2 \mathit{TP} / (2 \mathit{TP} + \mathit{FP} + \mathit{FN})


ROC Curve
Receiver Operating Curve(ROC)  is a plot to show change in performance of Binary Classifier with change in Threshold. The graphs are plotted as the fraction of true positive by total actual positive called the TRUE POSITIVE RATE and true negatives by total actual negatives also called the TRUE NEGATIVE RATE. Values range between 0 and 1.


 

Sunday, 12 January 2014

Supervised and Unsupervised Machine Learning

What is supervised Machine Learning ?
Take input as data  and generates model that predicts response to new data.

The data can be :
1)Classification : Samples belonging from different classes the algorithm learns from already labeled data to predict the class of unlabled data. It can have values 0 and 1 .An example of classification problem will be to predict weather tumor is Malignant or benign .
2)Regression :  If desired output has one or more contiues value the task is called regression.Miles per gallon for a car.


What is unsupervised Machine Learning ?
Input data consist of set of vectors with out any corresponding target value.Goal is to determine set of similar examples within set of data. Or to determine distribution of data.called density estimation or reducing the dimensionality of data.

* taken from http://bioinformatics.oxfordjournals.org/content/24/6/783/F1.expansion.html

Steps for Supervised machine Learning :
1.Prepare data
2.Choose ALgorithm
3.Fit Model.
4.Validation Model
5.Use it for predication

Various learning algorithm :
Classification Trees   
Regression Trees   
Discriminant Analysis (classification)
K-Nearest Neighbors (classification)   
Naive Bayes (classification)   
Classification or Regression Ensembles 
Classification or Regression Ensembles in Parallel