private void Conv() { Random random = new Random(); Vector dat = GetSigXY(random).Item1; Vector nnwOut = networkMeneger.Forward(dat); GraphCPU graph = new GraphCPU(false); // Нейросеть для формирования эмбедингов NNW net = new NNW(); net.Layers.Add(nnw.Layers[0]); net.Layers.Add(nnw.Layers[1]); net.Layers.Add(nnw.Layers[2]); net.Layers.Add(nnw.Layers[3]); net.Layers.Add(nnw.Layers[4]); net.Layers.Add(nnw.Layers[5]); net.Layers.Add(nnw.Layers[6]); net.Layers.Add(nnw.Layers[7]); Vector hl = net.Activate(new NNValue(dat), graph).ToVector(); sigChart.PlotBlack(t, dat); hChart.BarBlack(hl); outChart.PlotBlack(t, nnwOut); }
private void ShDat() { Vector dat = random.NextDouble() > 0.5 ? GetSig(2) : GetSig(4); GraphCPU graph = new GraphCPU(false); Vector nnwOut = NNW.Activate(new NNValue(dat), graph).ToVector(); chartVisual1.PlotBlack(t, dat); chartVisual2.BarBlack(nnwOut); }
/// <summary> /// Сгенерировать действие на воздействие(состояние среды) /// </summary> /// <param name="state"></param> /// <param name="isRnd">вероятностный подход</param> /// <returns></returns> public Action GetAction(State state, bool isRnd = true) { if (!(model.Layers.Last() is FeedForwardLayer)) { throw new NotImplementedException(); } else { var input = state.Input; var output = model.Activate(input, graphForward); var vector = new Vector(output.DataInTensor); return(new Action(vector, random, isRnd)); } }