public SelfOrganizingMapTrainer(SelfOrganizingMap network, double[][] trainingSet, LearningMethod learningMethod, double learningRate)
        {
            ReductionFactor = 0.99;
            TotalError      = 1.0;

            Network        = network;
            TrainingSet    = trainingSet;
            LearningMethod = learningMethod;
            LearningRate   = learningRate;

            TotalError = 1.0;

            _outputNeuronCount = network.OutputNeuronCount;
            _inputNeuronCount  = network.InputNeuronCount;

            for (int i = 0; i < trainingSet.Length; i++)
            {
                if (Matrix.CreateColumnMatrix(trainingSet[i]).VectorLength() < MinValue)
                {
                    throw new Exception("Multiplicative normalization has null training case");
                }
            }

            BestNetwork = new SelfOrganizingMap(_inputNeuronCount, _outputNeuronCount, network.NormalizationType);

            _neuronWinCounts  = new int[_outputNeuronCount];
            _correctionMatrix = new Matrix(_outputNeuronCount, _inputNeuronCount + 1);

            _workMatrix = LearningMethod == LearningMethod.Additive ? new Matrix(1, _inputNeuronCount + 1) : null;

            Initialize();
            BestError = Double.MaxValue;
        }
		public SelfOrganizingMapTrainer(SelfOrganizingMap network, double[][] trainingSet, LearningMethod learningMethod, double learningRate)
        {
	        ReductionFactor = 0.99;
			TotalError = 1.0;

            Network = network;
            TrainingSet = trainingSet;
			LearningMethod = learningMethod;
			LearningRate = learningRate;

            TotalError = 1.0;

			outputNeuronCount = network.OutputNeuronCount;
			inputNeuronCount = network.InputNeuronCount;

            for (int i = 0; i < trainingSet.Length; i++)
            {
                if (Matrix.CreateColumnMatrix(trainingSet[i]).VectorLength() < MinValue)
                    throw new Exception("Multiplicative normalization has null training case");
            }

			BestNetwork = new SelfOrganizingMap(inputNeuronCount, outputNeuronCount, network.NormalizationType);

            neuronWinCounts = new int[outputNeuronCount];
            correctionMatrix = new Matrix(outputNeuronCount, inputNeuronCount + 1);

            workMatrix = LearningMethod == LearningMethod.Additive ? new Matrix(1, inputNeuronCount + 1) : null;

            Initialize();
            BestError = Double.MaxValue;
        }