Пример #1
0
        public string Task3RightWrong()
        {
            nn.rightOrWrong(_validationData, "valResult.txt");
            _rightWrongData = nn.GetRightOrWrongMatrix(_validationData);
            MatrixData trainWrongData = nn.GetRightOrWrongMatrix(_trainingData);
            int        rows           = _rightWrongData.CountIf(3, MatrixDataExtension.StringEquals, "N") + trainWrongData.CountIf(3, MatrixDataExtension.StringEquals, "N");

            _wrongData = new MatrixData(rows, trainWrongData.NumberOfColumns);

            int wrongDataCounter = 0;

            for (int r = 0; r < _rightWrongData.NumberOfRows; r++)
            {
                if (_rightWrongData[r, 3] == "N")
                {
                    _wrongData.SetValue(wrongDataCounter, 0, _rightWrongData[r, 0]);
                    _wrongData.SetValue(wrongDataCounter, 1, _rightWrongData[r, 1]);
                    _wrongData.SetValue(wrongDataCounter, 2, _rightWrongData[r, 2]);
                    _wrongData.SetValue(wrongDataCounter, 3, _rightWrongData[r, 3]);
                    wrongDataCounter++;
                }
            }

            for (int r = 0; r < trainWrongData.NumberOfRows; r++)
            {
                if (trainWrongData[r, 3] == "N")
                {
                    _wrongData.SetValue(wrongDataCounter, 0, trainWrongData[r, 0]);
                    _wrongData.SetValue(wrongDataCounter, 1, trainWrongData[r, 1]);
                    _wrongData.SetValue(wrongDataCounter, 2, trainWrongData[r, 2]);
                    _wrongData.SetValue(wrongDataCounter, 3, trainWrongData[r, 3]);
                    wrongDataCounter++;
                }
            }
            _wrongData.ChangeHeader(0, "Row Num");
            _wrongData.ChangeHeader(1, "Actual");
            _wrongData.ChangeHeader(2, "Predict");
            _wrongData.ChangeHeader(3, "Correct?");
            _wrongData.WriteCSV(DateTime.Now.Ticks + ".csv");


            return("Saved valResult.txt");
        }