WOLFRAM NOTEBOOK

stringstring after a fixed number of steps

Case 1: Recurrent, i.e. single rule

Case 2: Feed forward, i.e. rules at each site

Given a particular trained setup, look at the results of perturbations

Recurrent Case

In[]:=
ListConvolve[{1,1,1},{0,1,1,1,0,0,0,0,0,0,0,0}]
Out[]=
{2,3,2,1,0,0,0,0,0,0}
CrossEntropyLossLayer
In[]:=
Module{max=10000,ru,result,evo,data,tot},SeedRandom[426778];evo=NestListCompoundExpressionru=
[]
RandomRuleMutation
[First[#]],result=First[CellularAutomaton[ru,CenterArray[{1,1,1},80],{{40}}]];If[(tot=Total[Abs[result-CenterArray[{1,1,1,1,1,1},80]]])<=Last[#],{ru,tot},#]&,{{0,2,2},Infinity},max;evo=Rest[First/@SplitBy[evo,Last]]
Out[]=
{{{131072,2,2},6},{{1529220744,2,2},5},{{2066517512,2,2},3},{{3143404136,2,2},2},{{1002351176,2,2},1}}
In[]:=
ArrayPlot[CellularAutomaton[First[#],CenterArray[{1,1,1},80],40]]&/@%
Out[]=
,
,
,
,
In[]:=
Module{max=10000,ru,result,evo,data,tot},SeedRandom[426778];evo=NestListCompoundExpressionru=
[]
RandomRuleMutation
[First[#]],result=First[CellularAutomaton[ru,CenterArray[{1,1,1},80],{{40}}]];If[(tot=Total[Abs[result-CenterArray[{1,1,1,1,1,1},80]]])<=Last[#],{ru,tot},#]&,{{0,2,3},Infinity},max;evo=Rest[First/@SplitBy[evo,Last]]
Out[]=
{{{2361183241434822606848,2,3},6},{{296462620854774250045117911655238365568,2,3},5},{{275194563463740672602738967868108600192,2,3},2},{{89786524574026381947524402598688422272,2,3},1},{{120956887216384549599024234279368552368,2,3},0}}
In[]:=
ArrayPlot[CellularAutomaton[First[#],CenterArray[{1,1,1},30],40]]&/@%151
Out[]=
,
,
,
,

Unary primes

In[]:=
primetab=Table[Table[1,i]->{Boole[PrimeQ[i]]},{i,5,20}]
Out[]=
{{1,1,1,1,1}{1},{1,1,1,1,1,1}{0},{1,1,1,1,1,1,1}{1},{1,1,1,1,1,1,1,1}{0},{1,1,1,1,1,1,1,1,1}{0},{1,1,1,1,1,1,1,1,1,1}{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}{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}{0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}{0},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}{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}{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}{0}}
In[]:=
CALearn[tolearn_,initrule_,wid_:20,steps_:10,iterations_:1000,seed_:4242]:=Module{max=steps,ru,result,evo,data,tot,test},SeedRandom[seed];evo=NestListru=
[]
RandomRuleMutation
[First[#]];result=First[CellularAutomaton[ru,CenterArray[First[#],wid],{{steps}}]]&/@tolearn;test=CenterArray[Last[#],wid]&/@tolearn;If[(tot=Total[Abs[Flatten[result-test]]])<=Last[#],{ru,tot},#]&,{initrule,Infinity},max;evo=Rest[First/@SplitBy[evo,Last]]
In[]:=
CALearn[primetab,{0,2,3},20,10,10000]
Out[]=
{{{288230376151711744,2,3},6}}
In[]:=
CALearn[Table[Table[1,i]->{Boole[PrimeQ[i]]},{i,3,6}],{0,2,3},20,10,100000]
Out[]=
{{{288230376151711744,2,3},2}}
In[]:=
CALearn[tolearn_,initrule_,wid_:20,steps_:10,iterations_:1000,seed_:4242]:=Module{max=steps,ru,result,evo,data,tot,test},SeedRandom[seed];evo=NestListru=Echo@
[]
RandomRuleMutation
[First[#]];result=Echo[First[CellularAutomaton[ru,CenterArray[First[#],wid],{{steps}}]]&/@tolearn];test=CenterArray[Last[#],wid]&/@tolearn;If[(tot=Total[Abs[Flatten[result-test]]])<=Last[#],{ru,tot},#]&,{initrule,Infinity},max;Echo[evo];evo=Rest[First/@SplitBy[evo,Last]]
In[]:=
CALearn[Table[Table[1,i]->{Boole[PrimeQ[i]]},{i,3,6}],{0,2,3},20,10,100]
»
{288230376151711744,2,3}
»
{{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}}
»
{37181718523570814976,2,3}
»
{{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}}
»
{37181718557930553344,2,3}
»
{{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}}
»
{37181859295418908672,2,3}
»
{{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}}
»
{37325974483494764544,2,3}
»
{{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}}
»
{10633823966279327020556430965737521152,2,3}
»
{{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}}
»
{10633823966279327020556430965737529344,2,3}
»
{{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}}
»
{15950735949418990512171659206858907648,2,3}
»
{{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}}

Doubling

Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.