?? neuron.cs
字號(hào):
using System;
namespace AI_Life
{
public class Neuron
{
//=========================================================//
int numInputs; // number of inputs
double[] weights; // array of weights
public Neuron(int initNumInputs)
{
numInputs = initNumInputs + 1; // + 1 for bias
weights = new double[numInputs];
for (int i=0; i<numInputs; i++)
weights[i] = ((float)(Cosmos.randomR.NextDouble()) * 2) - 1;
}
public double NumInputs
{
get
{
return numInputs;
}
}
public void SetWeight(int index, double newVal)
{
weights[index] = newVal;
}
public double GetWeight(int index)
{
return weights[index];
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -