%------------------------------------------------------------------------------ % % %sharat@mit.edu %uses broadcast tag 70000 %----------------------------------------------------------------------------- function model = script_ftr_sel(X,y) MAX_ITER = 10; THRESH = 0.001; MIN_DIM = 100; SVM_OPTIONS = struct('verb',1,'bin_svm','smo','ker','linear','arg',[1],'C',[1],'num_folds',5); data = struct('X',X,'y',y); for i = 1:MAX_ITER %--------------------------------- %mpi stuff %--------------------------------- model = svm(data,SVM_OPTIONS); w = sum(abs(model.W),2); data.X= spdiag(w)*data.X; idx = find(abs(w)>THRESH); nfeat = length(idx); fprintf('Done with iteration:%d (active features:%d)\n',i,nfeat); if(nfeat < MIN_DIM) break; end; end; %----------------------------------------------------- %select the model for the selected features %----------------------------------------------------- data = struct('X',X(idx,:),'y',y); model = oaasvm(data,SVM_OPTIONS); model.idx = idx; %end function