Beispiel #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;
            }
        }
Beispiel #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();
        }
Beispiel #3
0
 public KernelSimpleTester(KernelRegression machine = null)
 {
     if (null == machine)
     {
         _regressionMachine = new KernelRegression();
     }
     else
     {
         _regressionMachine = machine;
     }
 }
Beispiel #4
0
        public KernelRegressionTester(HouseDataMgr dataMgr, KernelRegression machine = null)
        {
            _dataMgr = dataMgr;

            _input  = new double[_dataMgr.count][];
            _output = new double[_dataMgr.count];

            for (int i = 0; i < _dataMgr.count; i++)
            {
                _input[i]  = _dataMgr.GetInputData(i);
                _output[i] = _dataMgr.GetLabelData(i);
            }

            if (null == machine)
            {
                _regressionMachine = new KernelRegression();
            }
            else
            {
                _regressionMachine = machine;
            }

            _rnd = new Random();
        }
Beispiel #5
0
 public KernelAgent(double[] pos)
 {
     _machine   = new KernelRegression();
     _pos       = pos;
     _neighbors = new List <KernelAgent>();
 }