示例#1
0
        public OneDimDataTester(KernelRegression machine = null)
        {
            _dataGnr = new OneDimDataGenerator();
            _rnd     = new Random();

            _trainDataX = new double[_trainDataSize][];
            _trainDataY = new double[_trainDataSize];

            for (int i = 0; i < _trainDataSize; i++)
            {
                _trainDataX[i]    = new double[1];
                _trainDataX[i][0] = 2 * _rnd.NextDouble() - 1.0;
            }

            _trainDataY = _dataGnr.Calc(_trainDataX);

            if (machine == null)
            {
                _regressionMachine = new KernelRegression();
            }
            else
            {
                _regressionMachine = machine;
            }
        }
示例#2
0
        public DistributedOneDimDataTrainer()
        {
            _agentNum = _trainDataSize;

            _adjacency = new int[_agentNum, _agentNum];
            _dataGnr   = new OneDimDataGenerator();
            _rnd       = new Random();

            _trainDataX = new double[_trainDataSize][];
            _trainDataY = new double[_trainDataSize];

            _agents = new List <KernelAgent>();

            _centerMachine = new KernelRegression();

            for (int i = 0; i < _agentNum; i++)
            {
                _trainDataX[i]    = new double[1];
                _trainDataX[i][0] = 2 * _rnd.NextDouble() - 1.0;

                _agents.Add(new KernelAgent(_trainDataX[i]));
            }

            _trainDataY = _dataGnr.Calc(_trainDataX);

            Init();
        }