function [newX,idx] = feature_filt(X,y,thresh)
% -- filters the features (columns) of X
% based on a mutual information criteria

if nargin<3  thresh=0.005;  end;

mi = mutinf(X,y);

[vals,idx] = sort(1-mi);

newX = [];
for i=1:length(find(mi>thresh))
    newX = [newX X(:,idx(i))];
end;