private void uiKnownObjects_SelectionChanged(object sender, EventArgs e) { TeachingSet.Element elementSelected = _programLogic.TeachingSet[uiKnownObjects.CurrentRow.Index]; for (int i = 0; i < _programLogic.ExaminedNetwork.InputCount; i++) { double val = elementSelected.Inputs[i]; _inputSignals[i] = val; uiInputData.Rows[0].Cells[i].Value = val.ToString(); } }
private void PerformTeachingCycle() { MlpNetwork.LearningMethod method = uiMethodWidrowHoff.Checked ? MlpNetwork.LearningMethod.WidrowHoff : MlpNetwork.LearningMethod.Perceptron; int stepCount = (int)uiCycleLength.Value; for (int i = 0; i < stepCount; i++) { int teachingElementIndex = _randomGenerator.Next(_teachingSet.Count); TeachingSet.Element teachingElement = _teachingSet[teachingElementIndex]; double[] prevResp = null; double[] prevErr = null; _examinedNetwork.LearnSimple(teachingElement, 0.1, ref prevResp, ref prevErr, method); } StepNumber += stepCount; uiChartPlotter.Invalidate(); }
private void ShowResults() { TeachingSet.Element currentElement = _programLogic.CurrentElement; uiStepNumber.Text = String.Format("Step: {0}", _programLogic.TeachingStep); uiComment.Text = String.Format("Comment: {0}", currentElement.Comment); if (uiDataBefore.ColumnCount == 0) { BuildGrids(); } PutNumbers(currentElement.Inputs, uiDataBefore.Rows[1]); PutNumbers(_programLogic.CurrentNormalizedInputs, uiDataBefore.Rows[2]); PutNumbers(_programLogic.PreviousWeights, uiDataBefore.Rows[3]); uiOutputBefore.Text = _programLogic.PreviousResponse.ToString("g6"); uiCorrectBefore.Text = currentElement.ExpectedOutputs[0].ToString("g6"); uiErrorBefore.Text = _programLogic.PreviousError.ToString("g6"); PutNumbers(_programLogic.ExaminedNeuron.Weights, uiDataAfter.Rows[1]); uiOutputAfter.Text = _programLogic.CurrentResponse.ToString("g6"); uiCorrectAfter.Text = currentElement.ExpectedOutputs[0].ToString("g6"); uiErrorAfter.Text = _programLogic.CurrentError.ToString("g6"); }
private void ShowResults() { TeachingSet.Element currentElement = _programLogic.CurrentElement; TeachingSet.Element currentNormalizedElement = _programLogic.CurrentNormalizedElement; uiStepNumber.Text = String.Format("Step: {0}", _programLogic.TeachingStep); uiComment.Text = String.Format("Comment: {0}", currentElement.Comment); if (uiInputData.ColumnCount == 0) { BuildGrids(); } PutNumbers(currentElement.Inputs, uiInputData.Rows[1]); PutNumbers(currentNormalizedElement.Inputs, uiInputData.Rows[2]); PutNumbers(_programLogic.PreviousResponse, uiTeachingProgress.Rows[1]); PutNumbers(currentElement.ExpectedOutputs, uiTeachingProgress.Rows[2]); PutNumbers(_programLogic.PreviousError, uiTeachingProgress.Rows[3]); PutNumbers(_programLogic.CurrentResponse, uiTeachingProgress.Rows[4]); PutNumbers(_programLogic.CurrentError, uiTeachingProgress.Rows[5]); }
private void UseStandardTeachingSet() { /* We divide by 2, because each teaching set part takes half * of the gap size as its offset. */ double offset = GetGapSize(uiGapSize.Value) / 2.0; _teachingSet = new TeachingSet(2, 1); TeachingSet.Element elem = new TeachingSet.Element(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { // Careful! We shouldn't make anything 0; it will render // the element unuseful. elem.Inputs = new double[] { 0.2 + x * 0.2 + offset, -0.3 + y * 0.2 }; elem.ExpectedOutputs = new double[] { 1.0 }; _teachingSet.Add(elem); elem.Inputs = new double[] { -0.2 - x * 0.2 - offset, -0.3 + y * 0.2 }; elem.ExpectedOutputs = new double[] { -1.0 }; _teachingSet.Add(elem); } } elem.Inputs = new double[] { offset, 0.3 }; elem.ExpectedOutputs = new double[] { 1.0 }; _teachingSet.Add(elem); elem.Inputs = new double[] { -offset, 0.3 }; elem.ExpectedOutputs = new double[] { -1.0 }; _teachingSet.Add(elem); ShowTeachingSet(); RestartTeaching(); }