SPIDER The Spider Objects

RANK_PERCEPTRON Ranking Perceptron object


   a=rank_perceptron(hyperParam,Yset) 
   
   Generates a Ranking Perceptron object with given hyperparameters.
  
   The rank perceptron uses a joint kernel on the inputs and outputs.
   Labeled data are given of the form (x_i,y_i) which specify a map from
   x_i -> y_i. Essentially, the data (x_i y_i) are considered positive examples
   given to a classifier and every other output y \in Yset is considered as 
   a negative example. Training consists of finding tuning the parameters alpha
   such that  y_i = argmax_y ( f(x_i,y))  for all i, i.e. the correct map is learnt
   for the training data. Here, f(x,y) = \sum \alpha_i J((x_i,x_i,),(x,y))
   is a measure of match between input x and output y.
  
   One thus must give as input the set Yset, and the choice of joint kernel,
   can currently be a product of 'linear', 'poly' or 'rbf' between inputs 
   and outputs.
   Outputs y_i are given in the form of indices into the set Yset.
  
  
     Hyperparameters (with defaults)
     kertype='linear'     -- the kernel type, either 'linear','poly' or 'rbf' on the inputs.
                             kernel is always linear on the outputs (enables fast pre-images) 
     kerparam=1;          -- kernel parameter (for 'poly' or 'rbf' kernel)
     loops=100            -- number of iterations of training
     Yset=[];             -- set of possible outputs to choose from
     output_preimage=0    -- whether to output y given x  or index into Yset (default)
   
  
     Model 
      alpha               -- the weights
      svs                 -- the support vectors
      dat                 -- the original data
      dbase               -- the set of possible Ys (outputs) 
  
   Methods:
    train, test
  
   Example:
     d=gen(toy); d.Y(d.Y==1,:)=1; d.Y(d.Y==-1,:)=2;
     a=rank_perceptron([1 0 0; 0 1 0  ;0 0 1]);
     [r a]=train(a,d);
  

Reference : New Ranking Algorithms for Parsing and Tagging: Kernels over Discrete Structures and the Voted Perceptron
Author : Michael Collins and Nigel Duffy
Link : http://www.ai.mit.edu/people/mcollins/papers/finalacl2002.ps