
This package contains code for "Noisy Label Detection" with Spannogram and Sequential Linearization Program. This also contains scripts for cross-validation method for tuning the parameter.


Path for CV scripts and data:
----------------------------

Let you are in folder for scripts then datafile and the parameter file for a particular dataset (for example "Fourclass_K_Ynoise1.mat" and "Fourclass_Parametres.mat" for dataset "Fourclass") should be in following relative path

"../Data/Fourclass/Fourclass_K_Ynoise1.mat " 


LIBSVM-3.14:
------------

This script need LIBSVM-3.14(Not advanced version). Hence please install it and put it in MATLAB path before running following scripts.


Usage of scripts:
----------------

====================
function runExample
===================

This script show an example of calling cross-validation scripts.


=======================================================================
function [M_svm,V_svm,M_pw,V_pw]=CV_LND_spanno(name,EN,ErrType,bias,nd)
=======================================================================
Run 5 fold cross validation and report test error of both the final classifier SVM and PW where labels are corrected by LND_spanno

Input : name = string containing folder name of data.
        EN= 10*percentage of induced label error in data set for most data set it is 1 only for Mushrooms,Svmguide1 and Covertype it can be 0.1,0.2,0.5,1 or 2.
        ErrType = Type of induced error 
               'M'=Boundary noise
               'WC'=Adversarial noise
               'H'=Biased annotator noise
        bias=  1 : Considering induced error in one class only
               2 : Considering induced error in both the classes
        nd= Level about approximation

Output: M_svm : Average (of 10 run) test error using SVM as final classifier
        V_svm : Variance (of 10 run) of  test error using SVM as final classifier
        M_knn : Average (of 10 run) test error using PW as final classifier
        V_knn : Variance (of 10 run) of  test error using PW as final classifier

=======================================================================
function [M_svm,V_svm,M_pw,V_pw]=CV_LND_SLP(name,EN,ErrType,bias,Ninit)
======================================================================
 Run 5 fold cross validation and report test error of both the final classifier SVM and PW where Labels are corrected using LND_SLP 

Input : name = string containing folder name of data.
        EN= 10*percentage of induced label error in data set for most data set it is 1 only for Mushrooms,Svmguide1 and Covertype it can be 0.1,0.2,0.5,1 or 2.
        ErrType = Type of induced error 
               'M'=Boundary noise
               'WC'=Adversarial noise
               'H'=Biased annotator noise
        bias=  1 : Considering induced error in one class only
               2 : Considering induced error in both the classes
        Ninit= Number of different run algorithm should go with different initial points to avoid local optimum.

Output: M_svm : Average (of 10 run) test error using SVM as final classifier
        V_svm : Variance (of 10 run) of  test error using SVM as final classifier
        M_knn : Average (of 10 run) test error using PW as final classifier
        V_knn : Variance (of 10 run) of  test error using PW as final classifier

==================================================================
function [M_svm,V_svm,M_pw,V_pw]=CV_LND_SLP1(name,EN,ErrType,bias)
==================================================================
 Run 5 fold cross validation and report test error of both the final classifier SVM and PW where Labels are corrected using LND_SLP1 

Input : name = string containing folder name of data.
        EN= 10*percentage of induced label error in data set for most data set it is 1 only for Mushrooms,Svmguide1 and Covertype it can be 0.1,0.2,0.5,1 or 2.
        ErrType = Type of induced error 
               'M'=Boundary noise
               'WC'=Adversarial noise
               'H'=Biased annotator noise
        bias=  1 : Considering induced error in one class only
               2 : Considering induced error in both the classes

Output: M_svm : Average (of 10 run) test error using SVM as final classifier
        V_svm : Variance (of 10 run) of  test error using SVM as final classifier
        M_knn : Average (of 10 run) test error using PW as final classifier
        V_knn : Variance (of 10 run) of  test error using PW as final classifier


========================================================
function [Yall,P,spT]=LND_spanno(K,kList,id_expert,Y,nd)
========================================================
 Label Noise Detection method with spannogram framework with level of approximation "nd"(for current version nd<=3)
 
Input :  K = Kernel matrix 
          KList = List of numbers of noisy points 
          kList(i,:) = Denote i th try of various noisy ratio 
          kList(i,1) = Number of positively annotated datapoint is noisy.
          kList(i,2) = Number of negatively annotated datapoint is noisy.
          id_expert = List of index corresponding to expert annotation.
          Y = Annotation
          nd= Level of approximation
 Output : Yall = Matrix of corrected labels. 
          Yall(:,i)=  Corrected labels considering number of noisy data points in kList(i,:)
          spT = time spent for noise detection

==================================================
 function [Yall,spT]=LND_SLP(K,kList,id_expert,Y)
==================================================
 Label Noise Detection method with Linear Sequentialization Algorithm  with random initial points.


 Input :  K = Kernel matrix 
          KList = List of numbers of noisy points 
          kList(i,:) = Denote i th try of various noisy ratio 
          kList(i,1) = Number of positively annotated datapoint is noisy.
          kList(i,2) = Number of negatively annotated datapoint is noisy.
          id_expert = List of index corresponding to expert annotation.
          Y = Annotation
          Num= Number of different initial points for avoiding local optimization  
 Output : Yall = Matrix of corrected labels. 
          Yall(:,i)=  Corrected labels considering number of noisy data points in kList(i,:)
          spT = time spent for noise detection


==================================================
 function [Yall,spT]=LND_SLP1(K,kList,id_expert,Y)
==================================================
 Label Noise Detection method with Linear Sequentialization Algorithm with initial point for iterative algorithm is taken from output of LDN_spanno with level of approximation =1.


 Input :  K = Kernel matrix 
          KList = List of numbers of noisy points 
          kList(i,:) = Denote i^th try of various noisy ratio 
          kList(i,1) = Number of positively annotated datapoint is noisy.
          kList(i,2) = Number of negatively annotated datapoint is noisy.
          id_expert = List of index corresponding to expert annotation.
          Y = Annotation
          Num= Number of different initial points for avoiding local optimization  
 Output : Yall = Matrix of corrected labels. 
          Yall(:,i)=  Corrected labels considering number of noisy data points in kList(i,:)
          spT = time spent for noise detection

