Wist je dat . . . [4]
Geledu, van harte man.....nog vele jaren toegewenst.............
Moderatorbericht:
Rens is overleden op 27 april 2010
http://www.refoforum.nl/forum/viewtopic ... 0&start=60
Rens is overleden op 27 april 2010
http://www.refoforum.nl/forum/viewtopic ... 0&start=60
Van harte Gefeliciteerd Geledu, en God's zegen toegewenst.
Alleen wie door de duisternis van de nacht is gegaan, kan het licht van de morgen naar waarde schatten !
He will wipe away every tear from their eyes. Death shall be no more, neither shall be mourning nor crying nor pain anymore, for the former things have passed away. Revelation 21:4
He will wipe away every tear from their eyes. Death shall be no more, neither shall be mourning nor crying nor pain anymore, for the former things have passed away. Revelation 21:4
- JolandaOudshoorn
- Berichten: 11271
- Lid geworden op: 15 mar 2006, 20:53
- Locatie: Groot Ammers
........ik de boosaardige neiging nauwelijks kan onderdrukken om een hele oude topic nieuw leven in te blazen?
........die oude topic heet: veel kijkers, weinigen reageren?
........die topic ongelofelijk veel postings heeft opgeleverd?
........ik er met plezier de boel weer zal opstarten?
........die oude topic heet: veel kijkers, weinigen reageren?
........die topic ongelofelijk veel postings heeft opgeleverd?
........ik er met plezier de boel weer zal opstarten?
Moderatorbericht:
Rens is overleden op 27 april 2010
http://www.refoforum.nl/forum/viewtopic ... 0&start=60
Rens is overleden op 27 april 2010
http://www.refoforum.nl/forum/viewtopic ... 0&start=60
- jakobmarin
- Berichten: 3523
- Lid geworden op: 04 aug 2004, 13:42
welk topic rens? 8)Rens schreef:........ik de boosaardige neiging nauwelijks kan onderdrukken om een hele oude topic nieuw leven in te blazen?
........die oude topic heet: veel kijkers, weinigen reageren?
........die topic ongelofelijk veel postings heeft opgeleverd?
........ik er met plezier de boel weer zal opstarten?
Wie zegt 'er is geen waarheid' heeft groot gelijk, want die bestaat wél.
Code: Selecteer alles
struct NeuralConst
{
public static float learningRate = 0.2f;
}
class Perceptron
{
float weight;
Neuron child;
Neuron parent;
public Perceptron(Neuron child, Neuron parent)
{
this.child = child;
this.parent = parent;
child.addPerceptron(this);
parent.addPerceptron(this);
weight = 1;
}
public float think()
{
child.think();
return child.value * weight;
}
public void learn()
{
weight += NeuralConst.learningRate * parent.getError() * child.value;
child.learn();
}
public float getError()
{
return weight * parent.getError();
}
public bool youAreTheParent(Neuron you)
{
return parent.Equals(you);
}
public static float F(float x)
{
return (1 / (1 + (float)Math.Exp(-x)));
}
}
class Neuron
{
Perceptron[] childs;
Perceptron[] parents;
public float target = 0;
public float value;
public float delta = 0;
public bool functionsAsInput;
public bool functionsAsOutput;
public bool functionsAsBias;
public Neuron(bool functionsAsInput, bool functionsAsOutput, bool functionsAsBias)
{
childs = new Perceptron[0];
parents = new Perceptron[0];
this.functionsAsInput = functionsAsInput;
this.functionsAsOutput = functionsAsOutput;
this.functionsAsBias = functionsAsBias;
value = 1;
}
public void think()
{
if ((!functionsAsBias)&&(!functionsAsInput))
{
if (childs.Length > 0)
{
float sum = 0;
foreach (Perceptron child in childs)
sum += child.think();
value = Perceptron.F(sum);
}
}
}
public void learn()
{
if ((!functionsAsOutput) && (!functionsAsBias) && (!functionsAsInput))
{
float error = 0.0f;
foreach (Perceptron parent in parents)
{
error += parent.getError();
}
delta = value * (1.0f - value) * error;
}
if (functionsAsOutput)
delta = value * (1.0f - value) * (target - value);
if ((!functionsAsBias) && (!functionsAsInput))
{
foreach (Perceptron child in childs)
{
child.learn();
}
}
}
public float getError()
{
return delta;
}
public void addPerceptron(Perceptron perceptron)
{
if (perceptron.youAreTheParent(this))
{
Array.Resize(ref childs, childs.Length + 1);
childs[childs.Length - 1] = perceptron;
}
else
{
Array.Resize(ref parents, parents.Length + 1);
parents[parents.Length - 1] = perceptron;
}
}
}