WOLFRAM NOTEBOOK

In[]:=
fns=Range[0,255];
In[]:=
resz=Table[With[{fn=fns[[i]],raHeight=10,raWidth=10,rules={8,6},opts=Sequence["Radius"->1/2,"Orientation"->"Both"]},With[{loss=BooleanCircuitLeftAlignedLossFunction[BooleanFunction[fn,3],3]},With[{lossFn=loss[raHeight,raWidth,opts]},fn->Table[SeedRandom[5453435445+i*20+ii];AdaptRuleArray[ConstantArray[1,{raHeight,raWidth}],rules,10000,lossFn,opts],{ii,10}]]]],{i,1+{30,90,110}}];
In[]:=
resz
In[]:=
resz[[1,2,1,-1,1]]
Out[]=
{{2,1,2,1,2,1,2,1,2,1},{2,1,2,1,1,1,1,2,2,2},{2,2,1,2,1,2,1,1,2,1},{1,2,1,2,2,1,1,2,2,2},{2,2,1,2,1,2,2,2,2,2},{2,2,2,1,1,2,1,1,2,2},{2,1,2,2,1,1,2,2,1,2},{1,1,1,1,1,2,2,2,2,2},{1,1,2,1,1,1,1,1,2,1},{2,1,1,1,1,1,1,1,2,1}}
In[]:=
resz[[1,2,1,-1]]
Out[]=
{{{2,1,2,1,2,1,2,1,2,1},{2,1,2,1,1,1,1,2,2,2},{2,2,1,2,1,2,1,1,2,1},{1,2,1,2,2,1,1,2,2,2},{2,2,1,2,1,2,2,2,2,2},{2,2,2,1,1,2,1,1,2,2},{2,1,2,2,1,1,2,2,1,2},{1,1,1,1,1,2,2,2,2,2},{1,1,2,1,1,1,1,1,2,1},{2,1,1,1,1,1,1,1,2,1}},0}
{{2,2,2,1},{2,2,2,1},{2,2,1,2},{2,1,2,1},{1,2,1,2},{1,2,2,1},{1,2,2,2},{1,2,2,2}}
In[]:=
GraphicsRow[With[{ra=#},With[{raHeight=Length[ra],raWidth=Length[First[ra]],rules={8,6},opts=Sequence["Radius"->1/2,"Orientation"->"Both",Appearance->"Hexagonal",Mesh->True]},Flatten[Table[Show[ICAEvolutionPlot[raHeight,raWidth,ra,rules,PadRight[Boole[{a,b,c}],raWidth],opts,"InfluenceMask"->PadRight[{1},Length[First[ra]]],Epilog->{EdgeForm[Directive[Darker[Red,0.45],Thickness[1/60]]],FaceForm[None],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][1,1],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][1,2],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][1,3],EdgeForm[Directive[Darker[Red,0.45],Thickness[1/60]]],FaceForm[None],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][raHeight+1,1]}],ImageSize->{60,Automatic}],{a,{True,False}},{b,{True,False}},{c,{True,False}}],2]]],Frame->All,FrameStyle->Gray,ImageSize->350]&[resz[[1,2,1,-1,1]]]
Out[]=
In[]:=
qqres=First/@SplitBy[resz[[1,2,1]],Last];
In[]:=
Last[#]->(GraphicsRow[With[{ra=#},With[{raHeight=Length[ra],raWidth=Length[First[ra]],rules={8,6},opts=Sequence["Radius"->1/2,"Orientation"->"Both",Appearance->"Hexagonal",Mesh->True]},Flatten[Table[Show[ICAEvolutionPlot[raHeight,raWidth,ra,rules,PadRight[Boole[{a,b,c}],raWidth],opts,"InfluenceMask"->PadRight[{1},Length[First[ra]]],Epilog->{EdgeForm[Directive[Darker[Red,0.45],Thickness[1/60]]],FaceForm[None],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][1,1],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][1,2],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][1,3],EdgeForm[Directive[Darker[Red,0.45],Thickness[1/60]]],FaceForm[None],BricksPlotDrawCell[OptionValue[{opts},"Appearance"],raHeight+1][raHeight+1,1]}],ImageSize->{60,Automatic}],{a,{True,False}},{b,{True,False}},{c,{True,False}}],2]]],Frame->All,FrameStyle->Gray]&)[First[#]]&/@qqres
Out[]=
4
,3
,2
,1
,0
In[]:=
GraphicsColumn[%]
Out[]=

One-Layer Perceptron

In[]:=
reluParameters[data_]:=<|"InnerBiases"->-data[[1;;-2,1]],"OuterWeights"->With[{slopes=Differences[data[[All,2]]]/Differences[data[[All,1]]]},Differences[Prepend[slopes,0]]],"OuterBias"->data[[1,2]]|>
In[]:=
reluNN[data_]:=With[{params=reluParameters[data]},NetChain[{LinearLayer[Length[data]-1,"Weights"->1,"Biases"->params[["InnerBiases"]]],ElementwiseLayer["ReLU"],LinearLayer[1,"Weights"->{params[["OuterWeights"]]},"Biases"->{params[["OuterBias"]]}]},"Input"->"Real"]]
In[]:=
Plot[Piecewise[{{0,#<-2},{1,#<-1},{0,#<0},{1,#<2}}]&[x],{x,-3,3},Exclusions->None]
Out[]=

Mesh Nets

Boolean Rule Array Enumeration

Learnability

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.