public void TestToString() { double[] ps = { 5, 0, 0, 0 }; var funct = new GaussianFunction(3, ps, 0); double[] x = { -1, 0, 1 }; funct.Evaluate(x); Assert.AreEqual("[GaussianFunction:width=5.00,center=0.00,0.00,0.00]", funct.ToString()); }
public void TestEvaluate() { double[] ps = { 5, 0, 0, 0 }; var funct = new GaussianFunction(3, ps, 0); double[] x = { -1, 0, 1 }; double y = funct.Evaluate(x); Assert.AreEqual(0.9607894391523232, y, AIFH.DefaultPrecision); }
public void TestOther() { double[] ps = { 5, 0, 0, 0 }; var funct = new GaussianFunction(3, ps, 0); Assert.AreEqual(3, funct.Dimensions); funct.SetCenter(0, 100); Assert.AreEqual(100, funct.GetCenter(0), AIFH.DefaultPrecision); funct.Width = 5; Assert.AreEqual(5, funct.Width, AIFH.DefaultPrecision); }
/// <summary> /// Construct the RBF network. /// </summary> /// <param name="theInputCount">The input count.</param> /// <param name="rbfCount">The number of RBF functions.</param> /// <param name="theOutputCount">The output count.</param> public RBFNetwork(int theInputCount, int rbfCount, int theOutputCount) { _inputCount = theInputCount; _outputCount = theOutputCount; // calculate input and output weight counts // add 1 to output to account for an extra bias node int inputWeightCount = _inputCount*rbfCount; int outputWeightCount = (rbfCount + 1)*_outputCount; int rbfParams = (_inputCount + 1)*rbfCount; _longTermMemory = new double[ inputWeightCount + outputWeightCount + rbfParams]; _indexInputWeights = 0; _indexOutputWeights = inputWeightCount + rbfParams; _rbf = new IFnRBF[rbfCount]; for (int i = 0; i < rbfCount; i++) { int rbfIndex = inputWeightCount + ((_inputCount + 1)*i); _rbf[i] = new GaussianFunction(_inputCount, _longTermMemory, rbfIndex); } }