예제 #1
0
        /// <summary>
        /// Generate a list based on any three pivot axis. Allows us to sweep the current data set and generate whatever we think
        /// is a reasonable list of data.
        /// </summary>
        /// <param name="axisX">The axis x.</param>
        /// <param name="axisY">The axis y.</param>
        /// <param name="tolleranceAmount">Careful with this, the precision here is what decides the detail of our graph.
        /// By default it is 100X100</param>
        /// <returns>The data list, represents a 3 dimensional array for storing all the delta information.</returns>
        /// <remarks>
        /// VectorN should be a 3 dimensinoal array. Don't goof it up!
        /// In order to store 5 dimensional data,
        /// I'm designing this so that 3 of the first axies illustrate the entire
        /// 3d graph. Depending on each location on the of the second graph X2,Z2 plane the Y2 represents the first graph's local max
        /// which is the max of X1,Y1,Z1.
        ///
        /// The Z is the normalized result? Just experimenting ways to display graph.
        /// </remarks>
        public List <VectorN> GenerateTopologyData(int axisX, int axisY, double toleranceAmount = 0.01)
        {
            _logger.Debug("Beginning topology generation...");
            List <VectorN> tempDataArray = new List <VectorN>();

            // Copy array.
            double[] inputLocal = new double[_inputData.Length];
            for (int i = 0; i < inputLocal.Length; i++)
            {
                inputLocal[i] = _inputData[i];
            }

            int playerInputLength = inputLocal.Length / 2;

            VectorN variableDataVector = new VectorN(2);

            variableDataVector[0] = 0;
            variableDataVector[1] = 0;

            inputLocal[playerInputLength + axisX] = 0;
            inputLocal[playerInputLength + axisY] = 0;

            int iterations = (int)(1.0 / toleranceAmount);

            _logger.Trace(string.Format("Running for {0} iterations.", iterations));

            for (int i = 0; i < iterations; i++)
            {
                for (int j = 0; j < iterations; j++)
                {
                    double localOutNormalized = (new VectorN(_nueralNetwork.Run(inputLocal))).Length;

                    // I'm following unity's coordinate system. It's the easiest thing I can remember.
                    tempDataArray.Add(new VectorN(new double[3] {
                        i, localOutNormalized, j
                    }));

                    inputLocal[playerInputLength + axisX] = i * toleranceAmount;
                    inputLocal[playerInputLength + axisY] = j * toleranceAmount;
                }
            }

            // Create new plot set entry.
            StreamUtilities.CreateNewPlot(axisX, axisY, toleranceAmount);
            _logger.Debug("Topology generation completed, data visualization can now be executed.");
            return(tempDataArray);
        }