/// <summary>
        /// Tests the network.
        /// </summary>
        /// <param name="executor">Executor.</param>
        /// <param name="data">Data.</param>
        /// <param name="categoricalAttribute">Categorical attribute.</param>
        public void TestNetwork(StringBuilder execution, string[][] data, shared.Attribute[] listAttributes,
																				shared.Attribute categoricalAttribute)
        {
            int success = 0, failure = 0;

            // to each epoch (we are assuming that each training data line is an epoch)
            foreach (var line in data) {

                int index = 0;
                List<double> inputValues = new List<double> ();

                double[] targetValues = new double[1]
                { categoricalAttribute.Values.IndexOf (line [categoricalAttribute.Index]) };

                foreach (string value in line) {
                    if (index < listAttributes.Count ()) {
                        if (listAttributes [index].Values.Count () > 0)
                            inputValues.Add (listAttributes [index].Values.IndexOf (value));
                        else
                            inputValues.Add (double.Parse (value));
                        index++;
                    }
                }

                double[] hiddenOut;
                double[] outputOut = this.ComputeOutputs (inputValues.ToArray (), out hiddenOut);

                if (Math.Round (outputOut.First (), 0) == targetValues.First ())
                    success++;
                else
                    failure++;

            }

            execution.AppendLine();
            execution.AppendFormat("Successful: {0}\n", success);
            execution.AppendFormat("Failure: {0}\n", failure);
            execution.AppendFormat("Rate: {0}%\n", Math.Ceiling((double)success / (double)data.Length * 100));
        }
        /// <summary>
        /// Builds the network.
        /// </summary>
        /// <param name="data">Data.</param>
        /// <param name="listAttributes">List attributes.</param>
        /// <param name="categoricalAttribute">Categorical attribute.</param>
        public void BuildNetwork(string[][] data, shared.Attribute[] listAttributes,
																			shared.Attribute categoricalAttribute)
        {
            double error = 0;

            // to each epoch (we are assuming that each training data line is an epoch)
            foreach (var line in data) {

                int epoch = 0;
                int index = 0;
                List<double> inputValues = new List<double> ();

                double[] targetValues = new double[1]
                { categoricalAttribute.Values.IndexOf (line [categoricalAttribute.Index]) };

                foreach (string value in line) {
                    if (index < listAttributes.Count ()) {
                        if (listAttributes [index].Values.Count () > 0)
                            inputValues.Add (listAttributes [index].Values.IndexOf (value));
                        else
                            inputValues.Add (double.Parse (value));
                        index++;
                    }
                }

                while (epoch < 10000) {

                    double[] hiddenOut;
                    double[] outputOut = this.ComputeOutputs (inputValues.ToArray (), out hiddenOut);

                    // get the error
                    error = this.GetError (targetValues, outputOut);

                    // if current error is less the the defined error threshold
                    if (error < this.ErrorThreshold) {
                        break;
                    }

                    // update the weights
                    this.UpdateWeights (inputValues.ToArray (), hiddenOut, outputOut, targetValues);

                    epoch++;
                }

                // if current error is less the the defined error threshold
                if (error < this.ErrorThreshold) {
                    break;
                }
            }
        }