Beispiel #1
0
        public NeuroModel CreateNeuroModel(int[] areaLevels, long[,] colDims, int numCells)
        {
            NeuroModel model = new NeuroModel();

            model.Areas          = new List <Area>(areaLevels.Length);
            model.CellsPerColumn = numCells;

            for (int levelIndex = 0; levelIndex < areaLevels.Length; levelIndex++)//levelIndex == AreaID
            {
                //Areas.Insert(levelIndex, new Area(levelIndex, colDims));
                model.Areas.Insert(levelIndex, CreateArea(model, levelIndex, colDims, numCells));

                for (int i = 0; i < 20; i++)//How to get the total number of synapses, for now 20
                {
                    SynapseData synap = new SynapseData
                    {
                        Permanence            = new Random().NextDouble(),                                      //for now generatin random permanences ranging 0 to 1
                        PreSynapticCellIndex  = model.Cells[new Random().Next(0, (model.Cells.Count()))].Index, //selecting random cell from already generated cells
                        PostSynapticCellIndex = model.Cells[new Random().Next(0, (model.Cells.Count()))].Index, //selecting random cell from already generated cells
                        // SourceCell = cell id
                        // destination Cell = cell id
                    };
                    model.Synapse.Insert(i, synap);
                }
            }


            return(model);
        }
        public NeuroModel CreateNeuroModel(int[] areaLevels, long[,] colDims, int numCells)
        {
            NeuroModel model = new NeuroModel();

            model.Areas          = new List <Area>(areaLevels.Length);
            model.CellsPerColumn = numCells;

            for (int levelIndex = 0; levelIndex < areaLevels.Length; levelIndex++)//levelIndex == AreaID
            {
                //Areas.Insert(levelIndex, new Area(levelIndex, colDims));
                model.Areas.Insert(levelIndex, CreateArea(model, levelIndex, colDims, numCells));
            }


            return(model);
        }
        private Area CreateArea(NeuroModel model, int areaID, long[,] colDims, int cellsPerColumn)
        {
            Area area = new Area(areaID, colDims);


            double overlap = 0; // Where do I get overlap values

            for (int colDim0 = 0; colDim0 < colDims.GetLength(0); colDim0++)
            {
                for (int colDim1 = 0; colDim1 < colDims.GetLength(1); colDim1++)
                {
                    area.MiniColumns[colDim0, colDim1] = new MiniColumn(areaID, overlap, colDim0, colDim1);
                    Cell[] cells = CreateCells(cellsPerColumn, areaID, colDim0, colDim1);
                    for (int i = 0; i < cells.Length; i++)
                    {
                        area.MiniColumns[colDim0, colDim1].Cells.Add(cells[i]);
                        model.Cells.Add(cells[i]);
                    }
                }
            }


            return(area);
        }