コード例 #1
0
ファイル: NetworkRBF.cs プロジェクト: linagee/ga-csharp
        public void Init(ConfigScript script, string config)
        {
            _inputCount  = script.DetermineRawInputCount();
            _outputCount = script.DetermineRawOutputCount();

            // parse out name-value pairs
            Dictionary <string, string> pairs =
                config.Split(',')
                .Select(x => x.Split('='))
                .ToDictionary(y => y[0], y => y[1]);

            _rbfCount = int.Parse(pairs["rbf"]);

            // calculate input and output weight counts
            // add 1 to output to account for an extra bias node
            int inputWeightCount  = _inputCount * _rbfCount;
            int outputWeightCount = (_rbfCount + 1) * _outputCount;
            int rbfParams         = (_inputCount + 1) * _rbfCount;

            _genomeSize = inputWeightCount + outputWeightCount + rbfParams;

            _indexInputWeights  = 0;
            _indexRBFParams     = inputWeightCount;
            _indexOutputWeights = _indexRBFParams + rbfParams;

            _cutLength = _genomeSize / script.MaxParents;
            if (_cutLength < 1)
            {
                _cutLength = 1;
            }
        }
コード例 #2
0
ファイル: DataFile.cs プロジェクト: linagee/ga-csharp
        public double[][] GenerateInputData()
        {
            var result      = new double[_data.Count][];
            int rawColCount = _config.DetermineRawInputCount();
            int colCount    = _headers.Count;

            for (int row = 0; row < _data.Count; row++)
            {
                result[row] = new double[rawColCount];

                int targetIndex = 0;
                for (int col = 0; col < colCount; col++)
                {
                    string columnName = _headers[col];
                    if (string.Compare(columnName, _config.PredictField, true) != 0)
                    {
                        DataField df = _config.FieldMap[columnName];
                        targetIndex = df.Normalize(result[row], targetIndex, _data[row][col]);
                    }
                }
                Console.WriteLine(targetIndex);
            }

            return(result);
        }