Properties of the sample regions

MNIST - handwritten digits/Properties of the sample regions

Sections

Square regions

Centred square regions

Row and column regions

Square regions

The image pixels have neighbours in two dimensions. We can add this problem domain knowledge by considering square regions of 10x10 pixels chosen randomly from the sample images,

:l NISTDev

(uu,hrtr) <- nistTrainBucketedRegionRandomIO 256 10 17

let digit = VarStr "digit"
let vv = uvars uu
let vvl = sgl digit
let vvk = vv `minus` vvl

card vv
101

rp vv
"{digit,<1,1>,<1,2>,<1,3>,<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,9>,<1,10>,<2,1>,<2,2>,<2,3>,<2,4>,<2,5>,<2,6>,<2,7>,<2,8>,<2,9>,<2,10>,<3,1>,<3,2>,<3,3>,<3,4>,<3,5>,<3,6>,<3,7>,<3,8>,<3,9>,<3,10>,<4,1>,<4,2>,<4,3>,<4,4>,<4,5>,<4,6>,<4,7>,<4,8>,<4,9>,<4,10>,<5,1>,<5,2>,<5,3>,<5,4>,<5,5>,<5,6>,<5,7>,<5,8>,<5,9>,<5,10>,<6,1>,<6,2>,<6,3>,<6,4>,<6,5>,<6,6>,<6,7>,<6,8>,<6,9>,<6,10>,<7,1>,<7,2>,<7,3>,<7,4>,<7,5>,<7,6>,<7,7>,<7,8>,<7,9>,<7,10>,<8,1>,<8,2>,<8,3>,<8,4>,<8,5>,<8,6>,<8,7>,<8,8>,<8,9>,<8,10>,<9,1>,<9,2>,<9,3>,<9,4>,<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,1>,<10,2>,<10,3>,<10,4>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>,<10,10>}"

hrsize hrtr
60000

Now take a subset of 7,500 events,

let hr = hrev [i | i <- [0 .. hrsize hrtr - 1], i `mod` 8 == 0] hrtr 

hrsize hr
7500

The query variable valency is 256, $\{|U_w| : w \in V_{\mathrm{k}}\} = \{256\}$,

rp $ llqq [u | w <- qqll vvk, let u = vol uu (sgl w)]
"{256}"

The first 25 events placed in a row:

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 10 3 256) $ [hrev [i] hr' | let hr' = hr `hrhrred` vvk, i <- [0..24]]

first 25

Again, the pixel variables can be bucketed to reduce the valency from 256 to 2, by partitioning at 128,

(uu,hrtr) <- nistTrainBucketedRegionRandomIO 2 10 17

let digit = VarStr "digit"
let vv = uvars uu
let vvl = sgl digit
let vvk = vv `minus` vvl

card vv
101

hrsize hrtr
60000

let hr = hrev [i | i <- [0 .. hrsize hrtr - 1], i `mod` 8 == 0] hrtr 

hrsize hr
7500

The query variable valency is 2, $\{|U_w| : w \in V_{\mathrm{k}}\} = \{2\}$,

rp $ llqq [u | w <- qqll vvk, let u = vol uu (sgl w)]
"{2}"

The first 25 events placed in a row now look slightly coarser,

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 10 3 2) $ [hrev [i] hr' | let hr' = hr `hrhrred` vvk, i <- [0..24]]

first 25, bucketed

Again, the entire history can be averaged together, $\hat{A}\%V_{\mathrm{k}}$,

let hrbmav = hrbm 10 3 2 $ hr `hrhrred` vvk

bmwrite file $ bmborder 1 $ hrbmav

average

Now consider how highly aligned variables might be grouped together. We will again use the tupler to group together highly aligned variables in the substrate, $V$.

Create a shuffled sample, $A_{\mathrm{r}}$,

let hrr = historyRepasShuffle_u hr 1

hrsize hrr
7500

Now optimise the shuffle content alignment with the tuple set builder, $I_{P,U,\mathrm{B,ns,me}}$, \[ \{(\mathrm{algn}(A\%K)-\mathrm{algn}(A_{\mathrm{r}}\%K),~K) : ((K,\cdot,\cdot),\cdot) \in I_{P,U,\mathrm{B,ns,me}}^{ * }((V,~\emptyset,~A,~A_{\mathrm{r}}))\} \]

let buildtup xmax omax bmax uu vv xx xxrr = reverse $ sort $ map (\((kk,_),_) -> (algn (araa uu (xx `hrred` kk)) - algn (araa uu (xxrr `hrred` kk)), kk)) $ parametersSystemsBuilderTupleNoSumlayerMultiEffectiveRepa_u xmax omax bmax 1 uu vv fudEmpty xx (hrhx xx) xxrr (hrhx xxrr)

rpln $ buildtup (2^2) 10 10 uu vvk hr hrr 
"(1740.0648169399356,{<5,9>,<6,9>})"
"(1723.023464296064,{<6,9>,<7,9>})"
"(1720.655349792527,{<9,7>,<10,7>})"
"(1711.5816322810351,{<5,10>,<6,10>})"
"(1710.7326402468825,{<3,6>,<4,6>})"
"(1709.9566174680876,{<6,8>,<7,8>})"
"(1709.902382320768,{<8,8>,<9,8>})"
"(1706.986942515141,{<3,8>,<4,8>})"
"(1706.983191487161,{<3,5>,<4,5>})"
"(1705.2849917804197,{<5,8>,<6,8>})"

let ll = buildtup (2^12) 10 10 uu vvk hr hrr 

rpln ll
"(22011.411512236802,{<5,8>,<5,9>,<5,10>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>})"
"(22008.78204886245,{<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>,<9,8>,<9,9>,<9,10>})"
"(21968.077933102177,{<5,9>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>,<9,8>,<9,9>})"
"(21872.93279676693,{<5,9>,<5,10>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>,<9,9>})"
"(21830.286637854366,{<4,8>,<4,9>,<4,10>,<5,8>,<5,9>,<5,10>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>})"
"(21796.971783499295,{<5,10>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>,<9,8>,<9,9>})"
"(21784.662146470113,{<5,8>,<5,9>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>,<9,9>})"
"(21771.789439006032,{<5,9>,<5,10>,<6,8>,<6,9>,<6,10>,<7,8>,<7,9>,<7,10>,<8,8>,<8,9>,<8,10>,<9,8>})"
"(21771.656257872237,{<5,7>,<5,8>,<5,9>,<5,10>,<6,7>,<6,8>,<6,9>,<6,10>,<7,7>,<7,8>,<7,9>,<7,10>})"
"(21754.455047547784,{<5,7>,<5,8>,<5,9>,<6,7>,<6,8>,<6,9>,<7,7>,<7,8>,<7,9>,<8,7>,<8,8>,<8,9>})"

Let us image the most highly aligned tuple,

let qq1 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq1

12-tuple

The first tuple is off-centre because of the prepondence on the right-hand side of the average image of the whole 28x28 substrate. If we examine the first 100 events,

bmwrite file $ bmborder 1 $ hrbm 10 3 2 $ hrev [0..99] $ hr `hrhrred` vvk

we can see the asymmetry,

100 region average

Now let’s image the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_1)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq1

map numerator $ fst $ unzip pp
[3692,139,131,94,90,87,85,83,76,65,60,55,54,54,49,45,43,43,43,42]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 10 3 2) $ [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq1 states

The first state is the largest slice. In this case all of the pixels of the tuple are background, so it includes all images where this region is blank. The second state is the next largest slice. In this case all of the pixels of the tuple are foreground, so it includes all images where this region is set.

Now optimise again having removed the top tuple from the substrate,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1) hr hrr 

rpln ll
"(21693.81445003244,{<4,2>,<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>,<7,4>})"
"(21512.732242767917,{<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,1>,<6,2>,<6,3>,<6,4>,<7,1>,<7,2>,<7,3>})"
"(21486.880087904763,{<4,2>,<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,1>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>})"
"(21427.985818979694,{<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,1>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>,<7,4>})"
"(21410.258072835408,{<4,3>,<4,4>,<5,1>,<5,2>,<5,3>,<5,4>,<6,1>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>})"
"(21408.411820555277,{<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>,<7,4>,<8,3>})"
"(21393.19657778045,{<4,3>,<4,4>,<4,5>,<5,3>,<5,4>,<5,5>,<6,3>,<6,4>,<6,5>,<7,3>,<7,4>,<7,5>})"
"(21389.231095763964,{<3,3>,<4,2>,<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>})"
"(21383.847628180145,{<4,3>,<4,4>,<5,2>,<5,3>,<5,4>,<6,2>,<6,3>,<6,4>,<7,2>,<7,3>,<7,4>,<8,2>})"
"(21373.437214102174,{<5,5>,<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>})"

let qq2 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq2

12-tuple over average

This second substrate tuple is nearly as highly aligned as the first.

Again, let’s image the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_2)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq2

map numerator $ fst $ unzip pp
[3791,134,132,91,91,89,74,70,67,66,59,58,55,50,49,48,42,41,41,40]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 10 3 2) $ [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq2 states

The first state is the largest slice. In this case also, all of the pixels of the tuple are background, so it includes all images where this region is blank.

Continuing on,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2) hr hrr 

rpln ll
"(21373.437214102174,{<5,5>,<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>})"
"(21329.28407835261,{<4,5>,<4,6>,<4,7>,<5,5>,<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>})"
"(21226.86741272534,{<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>,<9,5>,<9,6>,<9,7>})"
"(21215.302243975362,{<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>,<9,6>})"
"(21126.43411164035,{<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>,<9,5>,<9,6>,<9,7>,<10,6>})"
"(21111.15815101465,{<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>,<9,5>})"
"(21087.670538253682,{<4,6>,<5,5>,<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>})"
"(21085.839657823723,{<4,6>,<4,7>,<5,5>,<5,6>,<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,6>})"
"(21074.86333345563,{<5,6>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>,<9,5>,<9,6>})"
"(21042.394124463004,{<5,7>,<6,5>,<6,6>,<6,7>,<7,5>,<7,6>,<7,7>,<8,5>,<8,6>,<8,7>,<9,5>,<9,6>})"

let qq3 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq3

12-tuple over average

Again, the third substrate tuple is as highly aligned as the first two.

Imaging the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_3)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq3

map numerator $ fst $ unzip pp
[3433,138,125,123,89,84,75,74,72,70,65,62,62,61,59,49,47,45,43,41]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 10 3 2) $ [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq3 states

We can continue in this way,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2 `minus` qq3) hr hrr

rpln ll

let qq4 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq4


let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2 `minus` qq3 `minus` qq4) hr hrr

rpln ll

let qq5 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq5


let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2 `minus` qq3 `minus` qq4 `minus` qq5) hr hrr

rpln ll

let qq6 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq6


let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2 `minus` qq3 `minus` qq4 `minus` qq5 `minus` qq6) hr hrr

rpln ll

let qq7 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq7



let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2 `minus` qq3 `minus` qq4 `minus` qq5 `minus` qq6 `minus` qq7) hr hrr

rpln ll
"(19733.7650629689,{<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>,<10,10>})"
"(18244.756388970694,{<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>})"
"(18183.052495235035,{<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>,<10,10>})"
"(18018.1773644956,{<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,6>,<10,7>,<10,8>,<10,9>,<10,10>})"
"(17941.813511495293,{<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>,<10,10>})"
"(17721.473538718707,{<4,1>,<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>})"
"(17718.92489249057,{<5,1>,<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>})"
"(17699.892097261152,{<7,1>,<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>})"
"(17697.239187244202,{<6,1>,<9,5>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>})"
"(17676.153862699728,{<4,1>,<9,6>,<9,7>,<9,8>,<9,9>,<9,10>,<10,5>,<10,6>,<10,7>,<10,8>,<10,9>,<10,10>})"

let qq8 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq8

12-tuple over average

Now the alignment has decreased significantly and there are two clusters.

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2 `minus` qq3 `minus` qq4 `minus` qq5 `minus` qq6 `minus` qq7 `minus` qq8) hr hrr

rpln ll
"(4824.896083384745,{<4,1>,<5,1>,<6,1>,<7,1>})"
"(3215.28473788016,{<5,1>,<6,1>,<7,1>})"
"(3166.2986895331996,{<4,1>,<5,1>,<6,1>})"
"(2157.1316451760285,{<4,1>,<6,1>,<7,1>})"
"(2119.1540248846068,{<4,1>,<5,1>,<7,1>})"
"(1601.013410462765,{<6,1>,<7,1>})"
"(1553.0793192214187,{<5,1>,<6,1>})"
"(1547.8668714109153,{<4,1>,<5,1>})"
"(551.6962495806656,{<5,1>,<7,1>})"
"(536.7119390931111,{<4,1>,<6,1>})"

let qq9 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 10 3 2 $ qqhr 2 uu vvk qq9

12-tuple over average

Now the entire substrate is completely partitioned,

card $ vvk `minus` qq1 `minus` qq2 `minus` qq3 `minus` qq4 `minus` qq5 `minus` qq6 `minus` qq7 `minus` qq8 `minus` qq9
0

Centred square regions

We also know that the interesting features in the images are lines, junctions and loops. That is, the images are linear rather than patterned or periodic. So consider only those square regions of 11x11 pixels where the central pixel is always foreground,

:l NISTDev

(uu,hrtr) <- nistTrainBucketedRegionRandomIO 2 11 17

let digit = VarStr "digit"
let vv = uvars uu
let vvl = sgl digit
let vvk = vv `minus` vvl

card vv
122

let hrc = hrtr `hrhrsel` aahr uu (unit (sgl (llss [(stringsVariable "<6,6>", ValInt 1)])))

hrsize hrc
17408

let hr = hrev (take 7500 [i | i <- [0..], i `mod` 2 == 0]) hrc 

hrsize hr
7500

The first 25 events placed in a row,

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 11 3 2) $ [hrev [i] hr' | let hr' = hr `hrhrred` vvk, i <- [0..24]]

first 25, centred regions

Again, the entire history can be averaged together, $\hat{A}\%V_{\mathrm{k}}$,

let hrbmav = hrbm 11 3 2 $ hr `hrhrred` vvk

bmwrite file $ bmborder 1 $ hrbmav

average

Again, consider how highly aligned variables might be grouped together. Create a shuffled sample, $A_{\mathrm{r}}$,

let hrr = historyRepasShuffle_u hr 1

hrsize hrr
7500

Now optimise the shuffle content alignment,

let buildtup xmax omax bmax uu vv xx xxrr = reverse $ sort $ map (\((kk,_),_) -> (algn (araa uu (xx `hrred` kk)) - algn (araa uu (xxrr `hrred` kk)), kk)) $ parametersSystemsBuilderTupleNoSumlayerMultiEffectiveRepa_u xmax omax bmax 1 uu vv fudEmpty xx (hrhx xx) xxrr (hrhx xxrr)

rpln $ buildtup (2^2) 10 10 uu vvk hr hrr 
"(2240.1475498705695,{<6,9>,<6,10>})"
"(2201.8109207789967,{<7,2>,<7,3>})"
"(2173.4689951894034,{<7,1>,<7,2>})"
"(2172.923677114908,{<6,1>,<6,2>})"
"(2144.7314728347556,{<6,10>,<6,11>})"
"(2143.0965390893252,{<1,8>,<2,8>})"
"(2128.0588076228523,{<6,2>,<6,3>})"
"(2122.568073951079,{<5,10>,<5,11>})"
"(2090.1437421648516,{<5,2>,<5,3>})"
"(2086.9259612825917,{<2,7>,<3,7>})"

let ll = buildtup (2^12) 10 10 uu vvk hr hrr 

rpln ll
"(23993.18626415799,{<1,8>,<1,9>,<1,10>,<2,8>,<2,9>,<2,10>,<3,8>,<3,9>,<3,10>,<4,8>,<4,9>,<4,10>})"
"(23962.11196860714,{<1,8>,<1,9>,<1,10>,<2,8>,<2,9>,<2,10>,<2,11>,<3,8>,<3,9>,<3,10>,<4,8>,<4,9>})"
"(23836.31008414086,{<1,8>,<1,9>,<1,10>,<2,7>,<2,8>,<2,9>,<2,10>,<3,7>,<3,8>,<3,9>,<4,7>,<4,8>})"
"(23831.60623369566,{<1,8>,<1,9>,<2,7>,<2,8>,<2,9>,<2,10>,<3,7>,<3,8>,<3,9>,<3,10>,<4,8>,<4,9>})"
"(23816.07487471366,{<1,8>,<1,9>,<1,10>,<1,11>,<2,8>,<2,9>,<2,10>,<3,8>,<3,9>,<3,10>,<4,8>,<4,9>})"
"(23789.873456702964,{<1,8>,<1,9>,<1,10>,<2,7>,<2,8>,<2,9>,<2,10>,<3,7>,<3,8>,<3,9>,<4,8>,<4,9>})"
"(23778.720393835894,{<1,7>,<1,8>,<1,9>,<1,10>,<2,7>,<2,8>,<2,9>,<2,10>,<3,7>,<3,8>,<3,9>,<3,10>})"
"(23748.03116022083,{<1,8>,<1,9>,<1,10>,<2,8>,<2,9>,<2,10>,<3,7>,<3,8>,<3,9>,<3,10>,<4,8>,<4,9>})"
"(23729.862225237048,{<1,8>,<1,9>,<2,7>,<2,8>,<2,9>,<2,10>,<3,7>,<3,8>,<3,9>,<4,7>,<4,8>,<4,9>})"
"(23664.072357540645,{<1,8>,<1,9>,<1,10>,<2,8>,<2,9>,<2,10>,<3,8>,<3,9>,<3,10>,<3,11>,<4,8>,<4,9>})"

Let us image the most highly aligned tuple,

let qq1 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 11 3 2 $ qqhr 2 uu vvk qq1

12-tuple centred regions

The first tuple is top-right because of the prepondence from bottom left to top right of the average centred image.

Now let’s image the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_1)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq1

map numerator $ fst $ unzip pp
[2830,232,224,165,148,123,116,114,111,105,103,101,100,81,81,80,78,77,77,75]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 11 3 2) $ [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq1 centred region states

The first state is the largest slice. In this case all of the pixels of the tuple are background, so it includes all images where this region is blank. The second state is the next largest slice. In this case all of the pixels of the tuple are foreground, so it includes all images where this region is set.

Now optimise again having removed the top tuple from the substrate,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1) hr hrr 

rpln ll
"(23522.991134228592,{<7,1>,<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<9,4>})"
"(23424.29696747913,{<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,2>,<9,3>,<9,4>,<10,2>,<10,3>})"
"(23422.25849620543,{<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<9,4>,<10,3>})"
"(23416.200338177903,{<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<10,1>,<10,2>})"
"(23390.766395708368,{<7,2>,<7,3>,<7,4>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<9,4>,<10,2>,<10,3>})"
"(23350.48005427051,{<7,1>,<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<10,2>})"
"(23339.832057530926,{<7,1>,<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,2>,<9,3>,<9,4>,<10,3>})"
"(23314.587268392785,{<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<10,2>,<10,3>})"
"(23307.143403728085,{<7,1>,<7,2>,<7,3>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<9,4>,<10,3>})"
"(23290.31025072122,{<7,1>,<7,2>,<7,3>,<7,4>,<8,1>,<8,2>,<8,3>,<8,4>,<9,1>,<9,2>,<9,3>,<10,1>})"

let qq2 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbm 11 3 2 $ qqhr 2 uu vvk qq2

12-tuple over average

This second substrate tuple is nearly as highly aligned as the first.

Again, let’s image the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_2)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq2

map numerator $ fst $ unzip pp
[2195,320,252,238,221,208,179,164,155,152,141,140,116,107,104,101,99,84,83,83]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbm 11 3 2) $ [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq2 centred region states

The first state is the largest slice. In this case also, all of the pixels of the tuple are background, so it includes all images where this region is blank.

Row and column regions

We also know that the images are arranged in rows and columns. First consider only those rectangular regions of 1x28 pixels which form the rows,

:l NISTDev

(uu,hrtr) <- nistTrainBucketedRectangleRandomIO 2 1 28 17

let digit = VarStr "digit"
let vv = uvars uu
let vvl = sgl digit
let vvk = vv `minus` vvl

card vv
29

let hr = hrev (take 7500 [i | i <- [0..], i `mod` 8 == 0]) hrtr 

hrsize hr
7500

The first 25 events placed in a row,

bmwrite file $ bmhstack $ map (bmborder 1 . hrbmrow 28 4 2) $ [hrev [i] hr' | let hr' = hr `hrhrred` vvk, i <- [0..24]]

first 25, row regions

Again, the entire history can be averaged together, $\hat{A}\%V_{\mathrm{k}}$,

let hrbmav = hrbmrow 28 4 2 $ hr `hrhrred` vvk

bmwrite file $ bmborder 1 $ hrbmav

average row

Again, consider how highly aligned variables might be grouped together. Create a shuffled sample, $A_{\mathrm{r}}$,

let hrr = historyRepasShuffle_u hr 1

hrsize hrr
7500

Now optimise the shuffle content alignment,

let buildtup xmax omax bmax uu vv xx xxrr = reverse $ sort $ map (\((kk,_),_) -> (algn (araa uu (xx `hrred` kk)) - algn (araa uu (xxrr `hrred` kk)), kk)) $ parametersSystemsBuilderTupleNoSumlayerMultiEffectiveRepa_u xmax omax bmax 1 uu vv fudEmpty xx (hrhx xx) xxrr (hrhx xxrr)

let ll = buildtup (2^12) 10 10 uu vvk hr hrr 

rpln ll
"(16106.668593945578,{<1,9>,<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,20>})"
"(16101.86182450878,{<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,20>,<1,21>})"
"(16003.208167484972,{<1,8>,<1,9>,<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>})"
"(15596.925630694848,{<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,20>,<1,21>,<1,22>})"
"(15480.732808424465,{<1,9>,<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,21>})"
"(15462.368971619026,{<1,7>,<1,8>,<1,9>,<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>})"
"(15402.85272770772,{<1,7>,<1,9>,<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>})"
"(15397.679008731831,{<1,8>,<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,20>})"
"(15373.764751599805,{<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,20>})"
"(15372.540300264134,{<1,10>,<1,11>,<1,12>,<1,13>,<1,14>,<1,15>,<1,16>,<1,17>,<1,18>,<1,19>,<1,20>,<1,27>})"

Let us image the most highly aligned tuple,

let qq1 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbmrow 28 4 2 $ qqhr 2 uu vvk qq1

12-tuple row regions

The first tuple consists of exactly the set of centre variables.

Now let’s image the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_1)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq1

map numerator $ fst $ unzip pp
[2307,167,147,145,144,123,123,119,118,109,106,105,103,96,87,76,73,71,65,64]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbmrow 28 4 2) [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq1 row region states

The first state is the largest slice. In this case all of the pixels of the tuple are background, so it includes all images where this region is blank.

Now optimise again having removed the top tuple from the substrate,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1) hr hrr 

rpln ll
"(4526.084361946669,{<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>,<1,27>})"
"(4525.678896840465,{<1,3>,<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>})"
"(4510.663279339329,{<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>})"
"(4484.5013545133115,{<1,3>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>,<1,27>})"
"(4471.156579352384,{<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>,<1,27>})"
"(4469.077137810818,{<1,3>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>})"
"(4468.72238091383,{<1,3>,<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,27>})"
"(4455.731468095466,{<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,26>})"
"(4454.684458576856,{<1,3>,<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>})"
"(4453.703629317541,{<1,4>,<1,5>,<1,6>,<1,7>,<1,8>,<1,21>,<1,22>,<1,23>,<1,24>,<1,25>,<1,27>})"

let qq2 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbmrow 28 4 2 $ qqhr 2 uu vvk qq2

12-tuple over row average

This second substrate tuple is much less aligned than the first. It consists of two clusters on either side of the centre.

Now optimise again having removed the top two tuples from the substrate,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2) hr hrr 

rpln ll

There are no more row alignments to be found.

Now consider only those rectangular regions of 28x1 pixels which form the columns,

(uu,hrtr) <- nistTrainBucketedRectangleRandomIO 2 28 1 17

let digit = VarStr "digit"
let vv = uvars uu
let vvl = sgl digit
let vvk = vv `minus` vvl

card vv
29

let hr = hrev (take 7500 [i | i <- [0..], i `mod` 8 == 0]) hrtr 

hrsize hr
7500

The first 25 events placed in a row,

bmwrite file $ bmhstack $ map (bmborder 1 . hrbmcol 28 4 2) $ [hrev [i] hr' | let hr' = hr `hrhrred` vvk, i <- [0..24]]

first 25, col regions

Again, the entire history can be averaged together, $\hat{A}\%V_{\mathrm{k}}$,

let hrbmav = hrbmcol 28 4 2 $ hr `hrhrred` vvk

bmwrite file $ bmborder 1 $ hrbmav

average col

Again, consider how highly aligned variables might be grouped together. Create a shuffled sample, $A_{\mathrm{r}}$,

let hrr = historyRepasShuffle_u hr 1

hrsize hrr
7500

Now optimise the shuffle content alignment,

let ll = buildtup (2^12) 10 10 uu vvk hr hrr 

rpln ll
"(18149.770989742457,{<9,1>,<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<20,1>})"
"(18126.60559965523,{<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<20,1>,<21,1>})"
"(18083.306635625522,{<8,1>,<9,1>,<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>})"
"(18057.37716051533,{<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<20,1>,<21,1>,<22,1>})"
"(18038.48561896387,{<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<20,1>,<21,1>,<22,1>,<23,1>})"
"(17917.070071043872,{<7,1>,<8,1>,<9,1>,<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>})"
"(17694.39455223499,{<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<20,1>,<21,1>,<22,1>,<23,1>,<24,1>})"
"(17550.112536594355,{<9,1>,<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<21,1>})"
"(17488.14994535464,{<9,1>,<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<20,1>,<21,1>})"
"(17471.95223941364,{<10,1>,<11,1>,<12,1>,<13,1>,<14,1>,<15,1>,<16,1>,<17,1>,<18,1>,<19,1>,<21,1>,<22,1>})"

Let us image the most highly aligned tuple,

let qq1 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbmcol 28 4 2 $ qqhr 2 uu vvk qq1

12-tuple col regions

The first tuple consists of the set of centre variables.

Now let’s image the first 20 states ordered by size descending, $\mathrm{top}(20)(A\%Q_1)$,

let pp = take 20 $ reverse $ sort $ map (\(a,b) -> (b,a)) $ aall $ araa uu $ hr `hrred` qq1

map numerator $ fst $ unzip pp
[4072,119,112,110,83,78,72,64,61,60,54,50,48,48,47,46,44,39,39,39]

bmwrite file $ bmhstack $ map (bmborder 1 . hrbmcol 28 4 2) [hr' `hrhrsel` hrs | let hr' = hr `hrhrred` vvk, (_,ss) <- pp, let hrs = aahr uu (single ss 1)]

qq1 col region states

The first state is the largest slice. In this case all of the pixels of the tuple are background, so it includes all images where this region is blank.

Now optimise again having removed the top tuple from the substrate,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1) hr hrr 

rpln ll
"(10022.398170704219,{<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>,<27,1>})"
"(9909.897130639649,{<3,1>,<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>})"
"(9868.308199644394,{<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>,<28,1>})"
"(9860.571346833174,{<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>})"
"(9803.949731116089,{<3,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>,<27,1>})"
"(9799.678279210006,{<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>,<27,1>,<28,1>})"
"(9785.514824321122,{<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<26,1>,<27,1>})"
"(9705.824881210676,{<3,1>,<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<27,1>})"
"(9668.992239395462,{<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<27,1>,<28,1>})"
"(9656.289357515278,{<4,1>,<5,1>,<6,1>,<7,1>,<8,1>,<21,1>,<22,1>,<23,1>,<24,1>,<25,1>,<27,1>})"

let qq2 = snd $ head ll

bmwrite file $ bmborder 1 $ bmmax hrbmav 0 0 $ hrbmcol 28 4 2 $ qqhr 2 uu vvk qq2

12-tuple over col average

This second substrate tuple is less aligned than the first. It consists of two clusters on either side of the centre.

Now optimise again having removed the top two tuples from the substrate,

let ll = buildtup (2^12) 10 10 uu (vvk `minus` qq1 `minus` qq2) hr hrr 

rpln ll
"(0.0,{<3,1>,<28,1>})"

There are no more column alignments to be found.


top