
%
% run_fill - a main for testing filling of missing values
%
% This script is given as an example, modify it to apply on your
% own data: 
% 1. Current code use CPLEX as a QP solver. 
%    To use another QP solver, replace the call to svmtrain_cplex
%    in classify_with_absent.m
% 2. Data is loaded in this script.

  % Add path to interface with CPLEX
  cplex_interface_path = '/afs/cs.stanford.edu/u/gal/matlab/toolbox/Cplex/Cplex_From_ETHZ/';
  addpath(cplex_interface_path);


  % Init  
  fill_modes = {'geom' 'avgw', 'none' , 'mean', 'flag', 'blfl'};
  n_modes = length(fill_modes);
  parms.kertype = 'line';

  % Load data (Mnist)
  parms.n_trn = 1000;
  parms.n_tst =  200;
  parms.dig1 = 5;
  parms.dig2 = 6;
  parms.cs_list = 0.01;
  [trn_data, tst_data, trn_lbls, tst_lbls] = load_mnist(parms);
  trn_data = trn_data/256;
  tst_data = tst_data/256;

  outputs = cell(1,n_modes);
  for ii_mode = 1:n_modes
    parms.fill_mode = fill_modes{ii_mode};
    outputs{ii_mode} = classify_with_absent(trn_data, tst_data, ...
					    trn_lbls, tst_lbls, parms);
  end

  return

