private void UpdateResults() { _resultsAvailable = true; _outputVector = _examinedNetwork.Response(_inputVector); int lastRow = uiSignalGrid.RowCount - 1; for (int i = 1; i < uiSignalGrid.ColumnCount - 1; i++) { uiSignalGrid.Rows[lastRow].Cells[i].Style = null; uiSignalGrid.UpdateCellValue(i, lastRow); } if (uiShowWinner.Checked) { int winner = LinearNetwork.Winner(_outputVector, (double)uiThreshold.Value); for (int i = 1; i < uiSignalGrid.ColumnCount - 1; i++) { uiSignalGrid.Rows[lastRow].Cells[i].Style = null; } if (winner != -1) { DataGridViewCellStyle winnerStyle = new DataGridViewCellStyle(); winnerStyle.BackColor = Color.Red; uiSignalGrid.Rows[lastRow].Cells[winner + 1].Style = winnerStyle; uiWinnerNumber.Text = String.Format("Neuron {0}", winner + 1); uiResult.Text = String.Format("This is a {0}.", _classNames[winner]); } else { uiWinnerNumber.Text = "(There is no winner.)"; uiResult.Text = "This is something strange!"; } } }
internal void LoadTeachingSet(int netSizeX, int netSizeY, double initialWeights) { _netSizeX = netSizeX; _netSizeY = netSizeY; _initialWeights = initialWeights; _min = _netSizeX; if (_netSizeY < _netSizeX) { _min = _netSizeY; } _max = _netSizeX; if (_netSizeY > _netSizeX) { _max = _netSizeY; } _alpha0 = 0.1; _alpha1 = 0.02; _neighbour = Convert.ToInt16(_min + _max) / 4.0 + 1; _espAlpha = 0.9997; _espNeighbour = 0.999; _distribution = 1; _iteractions = 0; _numberOfNeurons = _netSizeX * _netSizeY; _examinedNetwork = new LinearNetwork(_numberOfInputs, _netSizeX * _netSizeY); InitializeTeaching(); }
private void BuildGrids() { LinearNetwork network = _programLogic.ExaminedNetwork; BuildGridColumns(uiInputData, network.InputCount + 1); uiInputData.Rows.Add(2); uiInputData.Rows[0].Cells[0].Value = "Input number (i)"; uiInputData.Rows[1].Cells[0].Value = "Original inputs (u(i))"; uiInputData.Rows[2].Cells[0].Value = "Normalized inputs (x(i))"; BuildGridColumns(uiTeachingProgress, network.Neurons.Length + 1); uiTeachingProgress.Rows.Add(5); uiTeachingProgress.Rows[0].Cells[0].Value = "Output number (j)"; uiTeachingProgress.Rows[1].Cells[0].Value = "Value before teaching (y(j))"; uiTeachingProgress.Rows[2].Cells[0].Value = "Value expected (z(j))"; uiTeachingProgress.Rows[3].Cells[0].Value = "Error before teaching (e(j))"; uiTeachingProgress.Rows[4].Cells[0].Value = "Value after teaching (y'(j))"; uiTeachingProgress.Rows[5].Cells[0].Value = "Error after teaching (e'(j))"; for (int i = 1; i < uiTeachingProgress.ColumnCount; i++) { DataGridViewCellStyle style = uiTeachingProgress.Rows[2].Cells[i].Style; style.BackColor = style.SelectionBackColor = Color.LightGreen; style = uiTeachingProgress.Rows[3].Cells[i].Style; style.BackColor = style.SelectionBackColor = Color.Pink; style = uiTeachingProgress.Rows[5].Cells[i].Style; style.BackColor = style.SelectionBackColor = Color.Pink; } }
internal void LoadTeachingSet(int numberOfNeurons, double ethaFactor) { _ethaFactor = ethaFactor; _numberOfNeurons = numberOfNeurons; InitializeRandom(); _randomGenerator.RewindTable(); _randomGenerator.Randomize(_randomize); _examinedNetwork = new LinearNetwork(_numberOfInputs, numberOfNeurons); InitializeTeaching(); }
public MainForm() { InitializeComponent(); double[,] weights = { { 4, 0.01, 0.01, -1, -1.5 }, { 2, -1, 2, 2.5, 2 }, { -1, 3.5, 0.01, -2, 1.5 } }; _examinedNetwork = new LinearNetwork(weights); _inputVector = new double[weights.GetLength(1)]; BuildSignalGrid(); DiscardResults(); }
internal void LoadTeachingSet(string fileName) { TeachingSet tset = NeuralNetworks.TeachingSet.FromFile(fileName); if (tset == null || tset.Count == 0) { throw new ApplicationException("The file does not contain any data."); } _teachingSetFileName = fileName; _teachingSet = tset; _normalizedTeachingSet = new TeachingSet(tset); _normalizedTeachingSet.Normalize(); _examinedNetwork = new LinearNetwork(tset.InputCount, tset.OutputCount); InitializeTeaching(); }