2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00
This commit is contained in:
2023-01-28 15:33:49 +03:00
parent 01d53ea67c
commit 9e620a98ca
8 changed files with 347 additions and 0 deletions

View File

@ -0,0 +1,50 @@
using Esiur.Analysis.Algebra;
using Microsoft.CodeAnalysis;
using System;
using System.Collections.Generic;
using System.Text;
namespace Esiur.Analysis.Neural
{
internal class NeuralLayer
{
public Neuron[] Neurons { get; internal set; }
public MathFunction<RealFunction> Activation { get; internal set; }
public NeuralLayer? PreviousLayer { get; internal set; }
public double Bias { get; set; }
public NeuralLayer(int nodes, MathFunction<RealFunction> activation, NeuralLayer? previousLayer)
{
PreviousLayer = previousLayer;
Neurons = new Neuron[nodes];
Activation = activation;
for(var i = 0; i < nodes; i++)
{
var synapses = new List<Synapse>();
var neuron = new Neuron()
{
Layer = this,
};
if (previousLayer != null)
{
for(var j = 0; j < previousLayer.Neurons.Length; j++)
{
synapses.Add(new Synapse() { Source = previousLayer.Neurons[j] , Target = neuron, Weight = 0});
}
}
Neurons[i] = neuron;
}
}
}
}