function [U,w,MU] = findptsep0(M) alf = M.ALF; %X = getptsample(M); [X,Y] = reglang_posneg_dense(0,6,M); X = lensort(X); U = {}; MU = {}; w = []; w(1) = b2y(run_dfsa(M,'')); U{1} = ''; MU{1} = shuf2dfsa('',alf); X = X(2:end); nx = length(X); PROGstart(nx,'findptsep: processing features'); for i=1:nx x = X{i}; [U,w,MU,b] = add_feature(U,w,MU,M,x); PROGupdate(i); end PROGend; return function X1 = lensort(X) LL = zeros(size(X)); for i=1:length(X) LL(i) = length(X{i}); end X1 = []; for l=0:max(LL) ii = find(LL==l); Xii = sort(X(ii)); X1 = [X1; Xii(:)]; end return function [U,w,MU,b] = add_feature(U,w,MU,M,x) xi = embedX(x,MU); yh = sign(xi*w); yt = b2y(run_dfsa(M,x)); b = (yh == yt); if ~b % signs disagree N = length(U)+1; U{N,1} = x; %fprintf('processing x = %s \n',x); %MU{N,1} = bool2fsa_pt(['(' x ')'],M.ALF); MU{N,1} = shuf2dfsa(x,M.ALF); w(N,1) = yt * (1+abs(xi*w)); end return function xi = embedX(x,MU) xi = zeros(1,length(MU)); for i=1:length(xi) xi(1,i) = run_dfsa(MU{i},x); end return function M = str2M(M0,s,s00) A = selfloops(M0,M0.q0); R = ''; if ~isempty(A) R = [R setstar(A)]; end if ~isempty(s) q = M0.q0; for i=1:length(s) s1 = s(i); if s1~='@' R = [R s1]; q = dfsa_delta(M0,q,s1); else q = dfsa_delta(M0,q,s00(i)); end A = selfloops(M0,q); if ~isempty(A) R = [R setstar(A)]; end end end M = gregexp2dfsa_fast(R,M0.ALF); return