In[]:=
points=RandomReal[{-1,1},{3,2}];nf=Nearest[points->"Index"];
In[]:=
data=Normal@AssociationMap[First@*nf,RandomReal[{-1,1},{100,2}]];
In[]:=
net=NetChain[{LinearLayer[Length[points],"Input"->2],SoftmaxLayer["Output"NetDecoder["Class"]]}];layerCount=Information[net,"LayersCount"];
In[]:=
colors={Red,Green,Blue};
In[]:=
makePlot[f_]:=DensityPlot[f[{x,y}],{x,-2,2},{y,-2,2},ColorFunction->(Blend[colors,#]&),Epilog->{{FaceForm[colors[[#[[2]]]]],EdgeForm[Black],Disk[#[[1]],0.015]}&/@data,MapThread[{FaceForm[#1],EdgeForm[Black],Disk[#2,.05]}&,{colors,points}]}]
In[]:=
plot=makePlot[NetInitialize@NetTake[net,layerCount,"Output"->None]];Dynamic[plot]
Out[]=
plot
In[]:=
net=NetTrain[net,data,TrainingProgressFunction->Function[If[Divisible[#Round,100],plot=makePlot[NetTake[#Net,layerCount,"Output"->None]]]]]
Out[]=
NetChain