In[]:=
$MachineName
Out[]=
threadripper2
In[]:=
rhmr=Module[​​{ru={299459058088077823758143088095350287424,4,1},​​init={{1},0},txspec={200,{-110,110}},aps,pca,ca},​​SeedRandom[444666];​​ParallelMap[#->HealCA[ru,init,txspec,#,1,#==101&,"Order"->"Random"]&,allperts[CellularAutomaton[ru,init,txspec]]]];
In[]:=
alltrainr=With[{ru={299459058088077823758143088095350287424,4,1},​​init={{1},0},txspec={200,{-110,110}}},(If[#=={},0,#[[2]]-#[[1]]+1]&[nonzeroRange[#]]&/@First[PerturbedCellularAutomaton[ru,init,{Keys[First[#]][[1,1]],{-110,110}}]])->If[Last[#]==={},{},Keys[Last[#][[1]]][[1]]]]&/@rhmr
Out[]=
{{1}{},{1}{},{1}{71,115},{1,0}{},
⋯4376⋯
,{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,8,9,9,11,12,12,13,11,8,9,8,8,9,10,10,11,13,13,14,15,14,15,10,10,11,12,12,13,14,13,14,13,13,14,15,15,16,17,16,14,14,15,16,15,14,13,12,11,10,9,8,7,6,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}{},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}{101,108},{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,8,9,9,10,11,11,12,13,12,11,10,9,8,7,6,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}{}}
Full expression not available
(
original memory size:
7.3 MB)
In[]:=
alltrain2r=Discard[alltrainr,Last[#]==={}&];
In[]:=
alltrain2=
;
In[]:=
alltrain2=
;
In[]:=
alltrain2[[;;3]]
Out[]=
{{1}{52,122}0,{1,0}{92,115}0,{1,3,2}{3,112}1}
In[]:=
goals=#[[1]]->First[KeyValueMap[Append,#[[2]]]]&/@alltrain2;
In[]:=
Take[goals,5]
Out[]=
{{1}{52,122,0},{1,0}{92,115,0},{1,3,2}{3,112,1},{1,1,0}{3,110,2},{1,1,3}{3,112,0}}
In[]:=
SeedRandom[24234];data=RandomSample[goals,2000]
Out[]=
{{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,11,12,13,12,14,13,10,9,7,7,5,6,6,7,8,8,9,10,9,8,7,6,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}{80,126,2},{1,1,3,3,5,6,7}{69,126,3},{1,1,3,2,3,4,2,3,3,4,3,4,5,4,5,4,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}{78,129,0},{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,7,8,9,9,10,9,8,9,8}{64,114,1},
⋯1993⋯
,{1,1,3,1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,8,9,9,11,12,12,13,11,8,9,8,8,9,10,10}{72,125,3},{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,8,9,9,11,12,12,13,11,8,9,8,8,9,10,10,11,13,12,13,14,13,10,9,9,10,12,12,14,15,15,14,15,16,18,18,20,21,21,20,20,19,20,21,22,22,23,24,24}{85,133,2},{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11}{53,107,3}}
Full expression not available
(
original memory size:
1.7 MB)
In[]:=
SeedRandom[224];tdgoals=goals[[#]]&/@TakeDrop[RandomSample[Range[Length[goals]]],2000];
In[]:=
Iconize[SeedRandom[224];TakeDrop[RandomSample[Range[Length[goals]]],2000]]
Out[]=
[[ moved to 24a as casemap ]]
In[]:=
Length[tdgoals]
Out[]=
2
In[]:=
traingoals=tdgoals[[1]];
In[]:=
testgoals=tdgoals[[2]];
In[]:=
length=Max[Length@*First/@goals]
Out[]=
101
In[]:=
padtrain=MapAt[PadRight[#,length,-1]&,traingoals,{All,1}]
Out[]=
{{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,8,9,9,11,12,12,13,11,8,7,5,6,7,6,5,6,6,6,7,8,8,9,10,9,9,10,11,10,10,12,13,13,14,10,10,11,13,12,12,12,13,14,14,15,16,15,16,15,16,15,13,14,13,14,4,3,1,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}{81,122,2},
⋯1998⋯
,{1,1,3,2,3,4,5,4,6,7,8,9,10,9,9,10,11,10,8,9,9,11,12,12,13,11,8,9,8,8,9,10,10,11,13,13,14,15,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}{47,122,0}}
Full expression not available
(
original memory size:
5.4 MB)
In[]:=
padtest=MapAt[PadRight[#,length,-1]&,testgoals,{All,1}]
Out[]=
{{1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}{86,111,3},
⋯2016⋯
,{1,1,3,2,3,4,3,4,4,4,6,7,8,9,10,9,9,10,11,10,8,9,9,11,12,12,13,14,13,14,13,13,14,15,15,16,17,17,18,19,18,17,16,15,14,13,12,10,8,7,6,5,4,3,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}{62,120,2}}
Full expression not available
(
original memory size:
5.5 MB)
In[]:=
net=NetInitialize@NetChain[{32,Tanh,16,Tanh,3},"Input"->length]
Out[]=
NetChain
Inputport:
vector(size: 101)
Outputport:
vector(size: 3)

In[]:=
netTrained=NetTrain[net,padtrain,TargetDevice->"GPU"];
In[]:=
netTrained=NetTrain[netTrained,padtrain,TargetDevice->"GPU"];
​
In[]:=
ListPointPlot3D[{netTrained[padtest[[All,1]]],padtest[[All,2]]}]
Out[]=
In[]:=
predictions=Thread[{netTrained[padtest[[All,1]]][[All,#]],padtest[[All,2,#]]}]&/@{1,2,3}
Out[]=
{{{23.2487,86},{85.5059,83},{66.9411,72},{43.2276,61},{79.8321,77},{75.766,44},{76.9259,69},{75.3251,72},{90.1358,91},{45.5853,18},{30.6954,45},{25.5398,60},{91.78,93},{91.78,88},{39.9222,48},{89.1281,89},
⋯1986⋯
,{89.8136,88},{81.2782,79},{81.2782,76},{77.8576,85},{32.8945,30},{87.7095,85},{81.2778,86},{92.7536,97},{23.746,56},{66.5667,101},{91.78,90},{85.5059,85},{77.2365,89},{42.4831,42},{81.2782,79},{64.4308,62}},{
⋯1⋯
},{
⋯1⋯
}}
Full expression not available
(
original memory size:
0.6 MB)
In[]:=
ListPlot[predictions,AspectRatio->1,PlotRange->Full,Epilog->InfiniteLine[{{0,0},{1,1}}]]
Out[]=