Download presentation
Presentation is loading. Please wait.
1
FAUST Oblique Analytics Given a table, X(X1
FAUST Oblique Analytics Given a table, X(X1..Xn), |X|=N and vectors, D=(D1..Dn), FAUST Oblique uses the ScalarPTreeSets of the valueTrees, XoD k=1..nXkDk NextD is a sequence of D's, used when recursively partitioning X into a Clusters (constructing a Cluster Dendogram for X) e.g. a. recursively, take the diagonal maximizing Standard Deviation (STD(CoD)) [or maximizing STD(CoD)/Spread(CoD).] b. recursively, take the AM(CoD)Avg-to-Median; AFFA(CoD)Avg-FurthestFromAvg; FFAFFFFA(CoD)FFA-FurthFromFFA c. recursively cycle thru diagonals: e1,...,..en, e1e2.. or cycle thru AM, AFFA, FFAFFFFA or cycle through both sets Count Change clustering: Choose Density(DT), DensityUniformity(DUT) and PrecipitousCountChange(PCCT) thresholds. If DT (and DUT) are not exceeded at a cluster C, partition C by cutting at each gap and/or PCC in CoD using nextD. FGC (FAUST Gap-based Clusterer) cuts in the middle of CoD gaps only. (old version. Usually chokes on big data) FCC (FAUST Count-change-based Clusterer) cuts at PCCs (new version. Note, gap are PCCs). Outlier Mining: Find the top k objects dissimilarity from the rest of the objects. This might mean: 1.a Find {xh | h=1..k} such that xh maximizes distance(xh, X-{xj | jh}) 1.b Find the top set of k objects, Sk, that maximizes distance(X-Sk.Sk) 2. Given a Training Set, X, identify outliers in each class (correctly classified but noticeably dissimilar from classmates) or Fuzzy cluster X, i.e., assign a weight for each (object, cluster) pair. Then x isa outlier iff w(x,k) < OutlierThreshold k 3. Examine individual new samples for outlierhood, assuming they come in after normalcy has been established by 1 o 2. FCO (FAUST Count-change Outlier miner) identifies and removes large clusters using FCP, so outliers reveal themselves. FTKO (FAUST Top-K-Outliers miner) uses D2NN = SquareDistance(x, X-{x}) = rankN(x-X)o(x-X) D2NN provides an instantaneous k-slider for 1.a. Instantaneous? UDR on D2NN takes log2n time (and is a 1-time calculation), then a k-slider works instantaneously off that distribution - there is no need to sort D2NN) Dset is a set of Ds used to build a model for fast classification (1-class or k-class) by circumscribing each class with a hull. The larger the Dset the better (for accuracy). D, there is, however, the 1-time construction cost of LD,k and HD,k below. Dset should include DAvgi,jAvg(Ci)Avg(Cj) i>j=1..k [and also Median connectors?]. Should Dset include all DnextD? FPP (FAUST Polygon Predictor) k-class classification k1 Xn+1= Class. DDset, lD,kmnCkoD (1st PCI?); hD,k=hD,kmxCkoD (last PCD y is declared to be class=k iff yHullk where Hullk={z| lD,k Doz hD,k all D}. (If y is in multiple hulls, Hi1..Hih, y isa Ck for the k maximizing OneCount{PCk&PHi..&PHih} or fuzzy classify using those OneCounts as k-weights) (Note: The old version used Dset{DAvgi,j | i>j=1..k} only - i.e., the vectors connecting class the means)
2
Should we pre-compute all pk,i*pk,j p'k,i*p'k,j pk,i*p'k,j
Question: Which primitives are needed and how do we compute them? X(X1...Xn) D2NN yields a 1.a-type outlier detector (top k objects, x, dissimilarity from X-{x}). D2NN = each min[D2NN(x)] D2NN(x)= k=1..n(xk-Xk)(xk-Xk)=k=1..n(b=B..02bxk,b-2bpk,b)( (b=B..02bxk,b-2bpk,b) =k=1..n( b=B..02b(xk,b-pk,b) ) ( ----ak,b--- b=B..02b(xk,b-pk,b) ) ( 22Bak,Bak,B + 22B-1( ak,Bak,B-1 + ak,B-1ak,B ) + { 22Bak,Bak,B } 22B-2( ak,Bak,B-2 + ak,B-1ak,B-1 + ak,B-2ak,B ) + {2B-1ak,Bak,B B-2ak,B-12 22B-3( ak,Bak,B-3 + ak,B-1ak,B-2 + ak,B-2ak,B-1 + ak,B-3ak,B ) + { 22B-2( ak,Bak,B-3 + ak,B-1ak,B-2 ) } 22B-4(ak,Bak,B-4+ak,B-1ak,B-3+ak,B-2ak,B-2+ak,B-3ak,B-1+ak,B-4ak,B)... {22B-3( ak,Bak,B-4+ak,B-1ak,B-3)+22B-4ak,B-22} (2Bak,B+ 2B-1ak,B-1+..+ 21ak, 1+ 20ak, 0) =k D2NN=multi-op pTree adds? When xk,b=1, ak,b=p'k,b and when xk,b=0, ak,b= -pk.b So D2NN just multi-op pTree mults/adds/subtrs? Each D2NN row (each xX) is separate calc. =22B ( ak,B2 + ak,Bak,B-1 ) + 22B-1( ak,Bak,B-2 ) + 22B-2( ak,B-12 22B-3( ak,Bak,B-4+ak,B-1ak,B-3) + 22B-4ak,B + ak,Bak,B-3 + ak,B-1ak,B-2 ) + Should we pre-compute all pk,i*pk,j p'k,i*p'k,j pk,i*p'k,j ANOTHER TRY! X(X1...Xn) RKN (Rank K Nbr), K=|X|-1, yields1.a_outlier_detector (top y dissimilarity from X-{x}). Install in RKN, each RankK(D2NN(x)) (1-time construct but for. e.g., 1 trillion xs? |X|=N=1T, slow. Parallelization?) xX, the square distance from x to its neighbors (near and far) is the column of number (vTree or SPTS) d2(x,X)= (x-X)o(x-X)= k=1..n|xk-Xk|2= k=1..n(xk-Xk)(xk-Xk)= k=1..n(xk2-2xkXk+Xk2) = -2 kxkXk kxk kXk2 = xoX xox XoX 4. Add to 3, for each x 3. Calc this for each x i=B..0 i=B..0,j=B..02i+jpk,ipk,j 1. precompute pTree products within each k i,j 2i+j kpk,ipk,j 5. Add the constant in 2. for each x 2. Calculate this sum one time (independent of the x) -2xoX cost is linear in |X|=N. xox cost is ~zero XoX is 1-time -amortized over xX (i.e., =1/N) or precomputed The addition cost, -2xoX + xox + XoX, is linear in |X|=N So, overall, the cost is linear in |X|=n. Data parallelization? No! (Need all of X at each site.) Code parallelization? Yes! (After replicating X to all sites, Each site creates/saves D2NN for its partition of X, then sends requested number(s) (e.g., RKN(x) ) back.
3
& & & & & & & & & & & & & & & & &
In FAUST Oblique (clusterer, classifier, outlier detector) the central, reoccurring calculation is XoD = k=1..nXkDk 6 9 XoD 1 pXoD,1 ( = 22 + 21 (1 p1,0 + 1 p11 + 20 (1 p1,0 1 p1,1 + 1 p2,1 ) + 1 p2,0 + 1 p2,0 ) 1 3 3 D D1,1 D1,0 1 1 D2,1 D2,0 1 3 2 X X1 X2 p11 p10 p21 p20 /*Calc PXoD,i after PXoD,i-1 CarrySet=CARi-1,i RawSet=RSi */ INPUT: CARi-1,i, RSi ROUTINE: PXoD,i=RSiCARi-1,i CARi,i+1=RSi&CARi-1,i OUTPUT: PXoD,i, CARi,i+1 1 1 1 1 1 1 1 1 1 1 & 1 PXoD,3 CAR13,4 1 CAR12,3 & 1 CAR11,2 & 1 PXoD,0 CAR10,1 & 1 & CAR22,3 1 & CAR32,3 PXoD,2 & 1 CAR21,2 PXoD,1 & 1 CAR31,2 Different data. 3 3 D D1,1 D1,0 1 1 D2,1 D2,0 1 1 ( = 22 + 21 (1 p1,0 + 1 p11 + 20 (1 p1,0 1 p1,1 + 1 p2,1 ) + 1 p2,0 + 1 p2,0 ) 1 3 2 X pTrees 6 18 9 XoD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 & 1 CAR13,4 1 CAR12,3 & 1 CAR11,2 & 1 PXoD,0 CAR10,1 & 1 & CAR23,4 PXoD,3 1 & CAR22,3 1 & CAR32,3 1 & CAR42,3 PXoD,2 1 & CAR21,2 & 1 CAR31,2 PXoD,1 & 1 CAR41,2 1 PXoD,4 This implementation of XoD involves a series of XOR and AND operations on pTree pairs. It may be useful to note that we are extending to pTrees, the Galois field, GF(2)={0,1} which uses XOR as addition and AND as multiplication (both have hardware - i.e., FPGA - implementations). Checksums and ciphers use FG(2).
4
FAUST Oblique XoD is used in FGC, FCC, FCO, FPP) and (x-X)o(x-X)
= -2Xox+xox+XoX is used in FTKO. So in FAUST Oblique, we need to construct lots of SPTSs of the type, X dotted with a fixed vector, a costly pTree calculation (Note that XoX is a costly pTree calculation also, but it is a 1-time calculation (a pre-calculation?). xox is calculated for each individual x but it's a scalar calculation. Thus, we should optimize the living he__ out of the XoD calculation!!! The method on the previous slide seems efficient. Is there a better method? Then for FTKO we need to computer ranks: RankK: p is what's left of K yet to be counted, initially p=K V is the RankKvalue, initially 0. For i=bitwidth+1 to 0 if Count(P&Pi) p { KVal=KVal+2i; P=P&Pi }; else /* < p */ { p=p-Count(P&Pi); P=P&P'i }; RankN-1(XoD)=Rank2(XoD) 1 1 D=x1 D1,1 D1,0 0 1 D2,1 D2,0 1 P=P&p1 32 1*21+ P p1 n=1 p=2 1 P=p0&P 22 1*21+1*20=3 so -2x1oX = -6 P &p0 n=0 p=2 1 3 2 X X1 X2 p11 p10 p21 p20 2 3 XoD 1 p3 p2 p1 p,0 RankN-1(XoD)=Rank2(XoD) 3 0 D=x2 D1,1 D1,0 1 1 D2,1 D2,0 0 0 3 9 2 XoD 1 p3 p2 p1 p,0 1 P=P&p'3 1<2 2-1=1 0*23+ P p3 n=3 p=2 1 P=p'2&P 0<1 1-0=1 0*23+0*22 P &p2 n=2 p=1 1 P=p1&P 21 0*23+0*22+1*21+ P &p1 n=1 p=1 1 P=p0&P 11 0*23+0*22+1*21+1*20=3 so -2x2oX= -6 P &p0 n=0 p=1 RankN-1(XoD)=Rank2(XoD) 2 1 D=x3 D1,1 D1,0 1 0 D2,1 D2,0 0 1 3 6 5 XoD 1 p3 p2 p1 p,0 1 P=P&p2 22 1*22+ P p2 n=2 p=2 1 P=p'1&P 1<2 2-1=1 1*22+0*21 P &p1 n=1 p=2 1 P=p0&P 11 1*22+0*21+1*20=5 so -2x3oX= -10 P &p0 n=0 p=1
5
(n=3) c=Count(P&P4,3)= 3 < 6
APPENDIX RankN-1(XoD)=Rank2(XoD) 3 3 D D1,1 D1,0 0 1 D2,1 D2,0 n=3 p=2 n=2 p=2 n=1 p=2 n=0 p=2 1 3 2 X X1 X2 p11 p10 p21 p20 2 3 XoD 1 p3 p2 p1 p,0 P p3 P &p2 P &p1 P &p0 1 1 22 1*23+ 1 1 0<2 2-0=2 1*23+0*22+ 1 1 0<2 2-0=2 1*23+0*22+0*21+ 1 1 22 1*23+0*22+0*21+1*20=9 pTree Rank(K) computation: (Rank(N-1) gives 2nd smallest which is very useful in outlier analysis?) 1 1 1 1 P=P&p3 P=p'2&P P=p'1&P P=p0&P Cross out the 0-positions of P each step. (n=3) c=Count(P&P4,3)= < 6 p=6–3=3; P=P&P’4,3 masks off highest (val 8) {0} X P4, P4, P4, P4,0 10 5 6 7 11 9 3 1 1 1 1 (n=2) c=Count(P&P4,2)= >= 3 P=P&P4,2 masks off lowest (val 4) {1} (n=1) c=Count(P&P4,1)= < 3 p=3-2=1; P=P&P'4,1 masks off highest (val8-2=6 ) {0} (n=0) c=Count(P&P4,0 )= >= 1 P=P&P4,0 {1} RankKval=0; p=K; c=0; P=Pure1; /*Note: n=bitwidth-1. The RankK Points are returned as the resulting pTree, P*/ For i=n to 0 {c=Count(P&Pi); If (c>=p) {RankVal=RankVal+2i; P=P&Pi }; else {p=p-c; P=P&P'i }; return RankKval, P; /* Above K=7-1=6 (looking for the Rank6 or 6th highest vaue (which is also the 2nd lowest value) */ 23 * * * * = RankKval= P=MapRankKPts= ListRankKPts={2} 1 {0} {1} {0} {1}
6
pTree Rank(K) computation: (Rank(N-1) gives 2nd smallest which is very useful in outlier analysis?)
RankKval=0; p=K; c=0; P=Pure1; /*Note: n=bitwidth-1. The RankK Points are returned as the resulting pTree, P*/ For i=n to 0 {c=Count(P&Pi); If (c>=p) {RankVal=RankVal+2i; P=P&Pi }; else {p=p-c; P=P&P'i }; return RankKval, P; /* Below K=3*/ Cross out the 0-positions of P each step. (n=3) c=Count(P&P4,3)= >=3 P=P&P4,3 {0} X P4, P4, P4, P4,0 10 5 6 7 11 9 3 1 1 1 1 (n=2) c=Count(P&P4,2)= < 3 p=3-0= P=P&P'4,2 {1} (n=1) c=Count(P&P4,1)= < 3 p=3-2=1; P=P&P'4,1 masks off highest (val8-2=6 ) {0} {1} (n=0) c=Count(P&P4,0 )= >= 1 P=P&P4,0 23 * * * * = RankKval= P=MapRankKPts= ListRankKPts={2} 1 {0} {1} {0} {1}
7
P = P’4,3 masks off highest 3 (Val 8) p = 6 – 3 = 3 {0}
Suppose MinVal is duplicated (occurs at two points). What does the algorithm return? RankKval=0; p=K; c=0; P=Pure1; /*Also RankPts are returned as the resulting pTree, P*/ For i=n to 0 {c=Count(P&Pi); If (c>=p) {RankVal=RankVal+2i; P=P&Pi }; else {p=p-c; P=P&P'i }; ret RankKval, P; P4, P4, P4, P4,0 1. P = P4,3 Ct (P) = < 6 P = P’4,3 masks off highest (Val 8) p = 6 – 3 = 3 10 5 6 3 11 9 1 1 1 1 {0} 2. Ct(P&P4,2) = < 3 P = P&P'4,2 p=3-2=1 masks off highest 2 (val 4) {0} 3. Ct(P&P4,1 )= >= 1 P=P&P4,1 {1} 4. Ct (P&P4,0 )= >= 1 P=P&P4,0 {1} 23 * * * * = {0} {0} {1} {1} 3=MinVal=rank(n-1)Val Pmask MinPts=rank(n-1)Pts{#4,#7}
8
P = P’4,3 (masks off the highest 3 val 8) p = 6 – 3 = 3 {0}
Suppose MinVal is triplicated (occurs at three points). What does the algorithm return? RankKval=0; p=K; c=0; P=Pure1; /*Also RankPts are returned as the resulting pTree, P*/ For i=n to 0 {c=Count(P&Pi); If (c>=p) {RankVal=RankVal+2i; P=P&Pi }; else {p=p-c; P=P&P'i }; return RankKval, P; P4, P4, P4, P4,0 1. P = P4,3 Ct (P) = < 6 P = P’4,3 (masks off the highest 3 val 8) p = 6 – 3 = 3 10 3 6 11 9 1 1 1 1 {0} 2. Ct(P&P4,2) = < 3 P = P&P'4,2 p=3-1=2 (masks off highest 1 val 4) {0} 3. Ct(P&P4,1 )= >= 2 P=P&P4,1 {1} 4. Ct (P&P4,0 )= >= 2 P=P&P4,0 {1} 23 * * * * = {0} {0} {1} {1} 3=MinVal. Pc mask MinPts #4,#5,#7
9
UDR Univariate Distribution Revealer (on Spaeth:)
15 UDR Univariate Distribution Revealer (on Spaeth:) applied to S, a column of numbers in bistlice format (an SpTS), will produce the DistributionTree of S DT(S) depth=h=0 depth=h=1 Y y1 y2 y y y y y y y y y ya 13 4 pb 10 9 yc 11 10 yd 9 11 ye 11 11 yf 7 8 yofM 11 27 23 34 53 80 118 114 125 110 121 109 83 p6 1 p5 1 p4 1 p3 1 p2 1 p1 1 p0 1 p6' 1 p5' 1 p4' 1 p3' 1 p2' 1 p1' 1 p0' 1 node2,3 [96.128) f= depthDT(S)b≡BitWidth(S) h=depth of a node k=node offset Nodeh,k has a ptr to pTree{xS | F(x)[k2b-h+1, (k+1)2b-h+1)} and its 1count p6' 1 5/64 [0,64) p6 10/64 [64,128) p5' 1 3/32[0,32) 2/32[64,96) p5 2/32[32,64) ¼[96,128) p3' 1 0[0,8) p3 1[8,16) 1[16,24) 1[24,32) 1[32,40) 0[40,48) 1[48,56) 0[56,64) 2[80,88) 0[88,96) 0[96,104) 2[194,112) 3[112,120) 3[120,128) p4' 1 1/16[0,16) p4 2/16[16,32) 1[32,48) 1[48,64) 0[64,80) 2[80,96) 2[96,112) 6[112,128) Pre-compute and enter into the ToC, all DT(Yk) plus those for selected Linear Functionals (e.g., d=main diagonals, ModeVector . Suggestion: In our pTree-base, every pTree (basic, mask,...) should be referenced in ToC( pTree, pTreeLocationPointer, pTreeOneCount ).and these OneCts should be repeated everywhere (e.g., in every DT). The reason is that these OneCts help us in selecting the pertinent pTrees to access - and in fact are often all we need to know about the pTree to get the answers we are after.).
10
So let us look at ways of doing the work to calculate As we recall from the below, the task is to ADD bitslices giving a result bitslice and a set of carry bitslices to carry forward XoD = k=1..nXk*Dk X pTrees XoD 1 3 2 1 1 1 1 6 9 1 1 1 1 3 3 D D1,1 D1,0 1 1 D2,1 D2,0 1 1 ( = 22 + 21 1 p1,0 p11 + 20 1 p1,1 p2,1 ) p2,0 + 1 p2,1 ) p2,0 ) 1 1 1 1 1 1 1 1 1 I believe we add by successive XORs and the carry set is the raw set with one 1-bit turned off iff the sum at that bit is a 1-bit Or we can characterize the carry as the raw set minus the result (always carry forward a set of pTrees plus one negative one). We want a routine that constructs the result pTree from a positive set of pTrees plus a negative set always consisting of 1 pTree. The routine is: successive XORs across the positive set then XOR with the negative set pTree (because the successive pset XOR gives us the odd values and if you subtract one pTree, the 1-bits of it change odd to even and vice versa.): /*For PXoD,i (after PXoD,i-1). CarrySetPos=CSPi-1,i CarrySetNeg=CSNi-1,i RawSet=RSi CSP-1=CSN-1=*/ INPUT: CSPi-1, CSNi-1, RSi ROUTINE: PXoD,i=RSiCSPi-1,iCSNi-1,i CSNi,i+1=CSNi-1,iPXoD,i; CSPi,i+1=CSPi-1,iRSi-1; OUTPUT: PXoD,i, CSNi,i CSPi,i+1 ( = 22 + 21 1 p1,0 p11 + 20 1 p1,1 p2,1 ) p2,0 + 1 p2,1 ) p2,0 ) 1 1 1 1 1 1 RS1 CSN0,1= CSN-1.0PXoD,0 CSP0,1= CSP-1,0RS0 RS0 CSP-1,0=CSN-1,0= PXoD,0 PXoD,1 1 1 1 1 1 1 1 1 1 = = 1 1 1
11
XoD=k=1,2Xk*Dk with pTrees: qN..q0, N=22B+roof(log2n)+2B+1
FCC Clusterer If DT (and/or DUT) are not exceeded at C, partition C further by cutting at each gap and PCC in CoD For a table X(X1...Xn), the SPTS, Xk*Dk is the column of numbers, xk*Dk. XoD is the sum of those SPTSs, k=1..nXk*Dk Xk*Dk = Dkb2bpk,b = 2BDkpk,B Dkpk,0 = Dk(2Bpk,B +..+20pk,0) = (2Bpk,B +..+20pk,0) (2BDk,B+..+20Dk,0) + 22B-1(Dk,B-1pk,B +..+20Dk,0pk,0 = 22B( Dk,Bpk,B) +Dk,Bpk,B-1) XoD = k=1..nXk*Dk k=1..n ( = 22B + 22B-1 Dk,B pk,B-1 + Dk,B-1 pk,B + 22B-2 Dk,B pk,B-2 + Dk,B-1 pk,B-1 + Dk,B-2 pk,B + 22B-3 Dk,B pk,B-3 + Dk,B-1 pk,B-2 + Dk,B-2 pk,B-1 +Dk,B-3 pk,B + 23 Dk,B pk,0 + Dk,2 pk,1 + Dk,1 pk,2 +Dk,0 pk,3 + 22 Dk,2 pk,0 + Dk,1 pk,1 + Dk,0 pk,2 + 21 Dk,1 pk,0 + Dk,0 pk,1 + 20 Dk,0 pk,0 Dk,B pk,B . . . 1 3 2 X pTrees 1 2 D D1,1 D1,0 0 1 D2,1 D2,0 1 0 B=1 XoD=k=1,2Xk*Dk with pTrees: qN..q0, N=22B+roof(log2n)+2B+1 k=1..2 ( = 22 + 21 Dk,1 pk,0 + Dk,0 pk,1 + 20 Dk,0 pk,0 Dk,1 pk,1 q0 = p1,0 = no carry 1 q1= carry1= 1 ( = 22 + 21 D1,1 p1,0 + D1,0 p11 + 20 D1,0 p1,0 D1,1 p1,1 + D2,1 p2,1 ) + D2,1 p2,0 + D2,0 p2,1 ) + D2,0 p2,0 ) q2=carry1= no carry 1 ( = 22 + 21 D1,1 p1,0 + D1,0 p11 + 20 D1,0 p1,0 D1,1 p1,1 + D2,1 p2,1 ) + D2,1 p2,0 + D2,0 p2,1 ) + D2,0 p2,0 ) 1 So, DotProduct involves just multi-operand pTree addition. (no SPTSs and no multiplications) Engineering shortcut tricka would be huge!!! q0 = carry0= 1 3 3 D D1,1 D1,0 1 1 D2,1 D2,0 1 1 q1=carry0+raw1= carry1= 1 2 ( = 22 + 21 1 p1,0 p11 + 20 1 p1,1 p2,1 ) p2,0 + 1 p2,1 ) p2,0 ) 1 A carryTree is a valueTree or vTree, as is the rawTree at each level (rawTree = valueTree before carry is incl.). In what form is it best to carry the carryTree over? (for speediest of processing?) 1. multiple pTrees added at next level? (since the pTrees at the next level are in that form and need to be added) 2. carryTree as a SPTS, s1? (next level rawTree=SPTS, s2, then s10& s20 = qnext_level and carrynext_level ? q2=carry1+raw2= carry2= 1 q3=carry2 = carry3= 1
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.