/// <summary> /// Determines a score for a RBF network. /// </summary> /// <param name="net">RBF network to determine a score for.</param> /// <returns>Double that represents the score.</returns> public double Score(Network net) { _errCalc.Clear(); // clear the error calculator foreach(var data in _trainingData) { double[] output = net.ComputeRegression(data.Input); // send input through RBFs in network _errCalc.UpdateError(output, data.Ideals); // updates error based on new outputs } return _errCalc.Calculate(); // calculates MSE error }
/// <summary> /// Goes through each record in the training set and displays the ideal output and the actual output. /// </summary> /// <param name="net">RBF network.</param> /// <param name="trainingData">Training data.</param> /// <param name="specieNames">Specie names.</param> private void QueryOneOfN(Network net, List<Record> trainingData, Dictionary<string, int> species) { // invert the specie list Dictionary<int, string> invSpecies = new Dictionary<int, string>(); foreach(string key in species.Keys) { int value = species[key]; invSpecies[value] = key; } // for each training record foreach(Record rec in trainingData) { double[] output = net.ComputeRegression(rec.Input); // run the input through the RBF network int idealIdx = GetMax(rec.Ideals); // find the index of the ideal name int actualIdx = GetMax(output); // find the index of the actual name Console.WriteLine("Guess: " + invSpecies[actualIdx] + " Actual: " + invSpecies[idealIdx]); } }