Exemplo n.º 1
0
 public HTMCellsViewer(HTMRegionAgent region, int indexInColumn, int width, int height)
 {
     InitializeComponent();
     _region = region;
     _indexInColumn = indexInColumn;
     layerLabel.Text = "Cells with index: " + indexInColumn.ToString();
     _predictiveCellBrush = new SolidBrush(Color.Yellow);
     _learningCellBrush = new SolidBrush(Color.Green);
     _backgroundColor = Color.White;
     this.Width = width;
     this.Height = height + layerLabel.Height + layerLabel.Top;
     _bitmap = new Bitmap(width, height);
     _g = Graphics.FromImage(_bitmap);
     _g1 = this.CreateGraphics();
     _cellViewers = new List<HTMCellViewer>();
 }
Exemplo n.º 2
0
 public HTMColumnsViewer(HTMRegionAgent region, HTMRegionViewerPropertyShowed propertyShowed, int width, int height)
 {
     InitializeComponent();
     _region = region;
     _activeColumnBrush = new SolidBrush(Color.Blue);
     _inactiveColumnBrush = new SolidBrush(Color.White);
     _backgroundColor = Color.White;
     this.Width = width;
     this.Height = height + statLabel.Height + statLabel.Top;
     _bitmap = new Bitmap(width, height);
     _g = Graphics.FromImage(_bitmap);
     _g1 = this.CreateGraphics();
     _lastMouseClick = new Point();
     _propertyShowed = propertyShowed;
     statLabel.Text = propertyShowed.ToString();
 }
Exemplo n.º 3
0
 public HTMCellsViewer(HTMRegionAgent region, int indexInColumn, int width, int height)
 {
     InitializeComponent();
     _region              = region;
     _indexInColumn       = indexInColumn;
     layerLabel.Text      = "Cells with index: " + indexInColumn.ToString();
     _predictiveCellBrush = new SolidBrush(Color.Yellow);
     _learningCellBrush   = new SolidBrush(Color.Green);
     _backgroundColor     = Color.White;
     this.Width           = width;
     this.Height          = height + layerLabel.Height + layerLabel.Top;
     _bitmap              = new Bitmap(width, height);
     _g           = Graphics.FromImage(_bitmap);
     _g1          = this.CreateGraphics();
     _cellViewers = new List <HTMCellViewer>();
 }
Exemplo n.º 4
0
 public HTMColumnsViewer(HTMRegionAgent region, HTMRegionViewerPropertyShowed propertyShowed, int width, int height)
 {
     InitializeComponent();
     _region              = region;
     _activeColumnBrush   = new SolidBrush(Color.Blue);
     _inactiveColumnBrush = new SolidBrush(Color.White);
     _backgroundColor     = Color.White;
     this.Width           = width;
     this.Height          = height + statLabel.Height + statLabel.Top;
     _bitmap              = new Bitmap(width, height);
     _g              = Graphics.FromImage(_bitmap);
     _g1             = this.CreateGraphics();
     _lastMouseClick = new Point();
     _propertyShowed = propertyShowed;
     statLabel.Text  = propertyShowed.ToString();
 }
Exemplo n.º 5
0
        public bool Initialize()
        {
            // Network param
            int    cellsPerColumn;
            int    minimumOverlap;
            int    desiredLocalActiviy;
            int    segmentActivationThreshold;
            int    minSegmentActivityForLearning;
            double proximalSegmentCoverage;

            try
            {
                _regionWidth                  = int.Parse(regionWidthTextBox.Text);
                _regionHeight                 = int.Parse(regionHeightTextBox.Text);
                cellsPerColumn                = int.Parse(networkSizeComboBox.Text.Substring(networkSizeComboBox.Text.Length - 1, 1));
                minimumOverlap                = int.Parse(minimumOverlapTextBox.Text);
                desiredLocalActiviy           = int.Parse(desiredLocalActivityTextBox.Text);
                segmentActivationThreshold    = int.Parse(segmentActivationThresholdTextBox.Text);
                minSegmentActivityForLearning = int.Parse(segmentActivationThresholdTextBox.Text);
                proximalSegmentCoverage       = double.Parse(proximalSegmentCoverageTextBox.Text) / 100;
            }
            catch (Exception exch)
            {
                _director.Log(exch.ToString());
                return(false);
            }
            if (proximalSegmentCoverage < 0 && proximalSegmentCoverage > 1)
            {
                _director.Log("Proximal segment coverage out of range.");
                return(false);
            }

            // Create the network.
            _regionAgent            = new HTMRegionAgent(_director, _regionWidth, _regionHeight, cellsPerColumn, minimumOverlap, desiredLocalActiviy, segmentActivationThreshold, minSegmentActivityForLearning, proximalSegmentCoverage);
            _regionAgent.InputAgent = _inputAgent;
            _regionAgent.Initialize();

            // Create the viewer
            _regionViewer           = new HTMRegionViewer(_regionAgent);
            _regionViewer.MdiParent = this.MdiParent;
            _regionViewer.Location  = new Point(this.Left + this.Width, 20);
            _regionViewer.Show();

            _isInitialized            = true;
            structureGroupBox.Enabled = false;  // disable the structural parameters
            return(true);
        }
Exemplo n.º 6
0
        double _y; // The x-position of the column inside the matrix. Range from 0 to 1.

        #endregion Fields

        #region Constructors

        public HTMColumn(HTMRegionAgent region, int posX, int posY, double x, double y)
        {
            _region = region;
            _posX = posX;
            _posY = posY;
            _x = x;
            _y = y;

            _cells = new List<HTMCell>();
            for (int i = 0; i < region.CellsPerColumn; i++)
                _cells.Add(new HTMCell(this, i));
            _proximalSegment = new HTMSegment(null, _region.SegmentActivationThreshold);
            _isActive = false;
            _overlap = 0;
            _boost = 1.0;
            _activeDutyCycle = 1.0;
            _overlapDutyCycle = 1.0;
        }
Exemplo n.º 7
0
        public HTMColumn(HTMRegionAgent region, int posX, int posY, double x, double y)
        {
            _region = region;
            _posX   = posX;
            _posY   = posY;
            _x      = x;
            _y      = y;

            _cells = new List <HTMCell>();
            for (int i = 0; i < region.CellsPerColumn; i++)
            {
                _cells.Add(new HTMCell(this, i));
            }
            _proximalSegment  = new HTMSegment(null, _region.SegmentActivationThreshold);
            _isActive         = false;
            _overlap          = 0;
            _boost            = 1.0;
            _activeDutyCycle  = 1.0;
            _overlapDutyCycle = 1.0;
        }
Exemplo n.º 8
0
        public HTMRegionViewer(HTMRegionAgent region)
        {
            InitializeComponent();
            _region = region;

            int columnViewersWidth = 150;

            _columnsViewers             = new HTMColumnsViewer[4];
            _columnsViewers[0]          = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.ColumnActivation, columnViewersWidth, columnViewersWidth);
            _columnsViewers[0].Location = new Point(10, 80);
            this.Controls.Add(_columnsViewers[0]);
            _columnsViewers[1]          = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.DistalSegmentsCount, columnViewersWidth, columnViewersWidth);
            _columnsViewers[1].Location = new Point(10 + (columnViewersWidth + 10), 80);
            this.Controls.Add(_columnsViewers[1]);
            _columnsViewers[2]          = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.ColumnOverlap, columnViewersWidth, columnViewersWidth);
            _columnsViewers[2].Location = new Point(10 + (columnViewersWidth + 10) * 2, 80);
            this.Controls.Add(_columnsViewers[2]);
            _columnsViewers[3]          = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.ColumnPermanence, columnViewersWidth, columnViewersWidth);
            _columnsViewers[3].Location = new Point(10 + (columnViewersWidth + 10) * 3, 80);
            this.Controls.Add(_columnsViewers[3]);

            int cellsViewersWidth  = 250;
            int cellsViewersHeight = 250;

            _cellsViewers = new HTMCellsViewer[_region.CellsPerColumn];
            for (int i = 0; i < _region.CellsPerColumn; i++)
            {
                _cellsViewers[i]          = new HTMCellsViewer(_region, i, cellsViewersWidth, cellsViewersHeight);
                _cellsViewers[i].Location = new Point(10 + (cellsViewersWidth + 10) * i, 270);
                _cellsViewers[i].Visible  = true;
                this.Controls.Add(_cellsViewers[i]);
            }
            this.Width  = 10 + (Math.Max(_region.CellsPerColumn, 4) + 1) * columnViewersWidth;
            this.Height = 560;

            doSpatialLearningCheckBox.Checked  = _region.DoSpatialLearning;
            doTemporalLearningCheckBox.Checked = _region.DoTemporalLearning;
        }
Exemplo n.º 9
0
        public HTMRegionViewer(HTMRegionAgent region)
        {
            InitializeComponent();
            _region = region;

            int columnViewersWidth = 150;
            _columnsViewers = new HTMColumnsViewer[4];
            _columnsViewers[0] = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.ColumnActivation, columnViewersWidth, columnViewersWidth);
            _columnsViewers[0].Location = new Point(10, 80);
            this.Controls.Add(_columnsViewers[0]);
            _columnsViewers[1] = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.DistalSegmentsCount, columnViewersWidth, columnViewersWidth);
            _columnsViewers[1].Location = new Point(10 + (columnViewersWidth + 10), 80);
            this.Controls.Add(_columnsViewers[1]);
            _columnsViewers[2] = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.ColumnOverlap, columnViewersWidth, columnViewersWidth);
            _columnsViewers[2].Location = new Point(10 + (columnViewersWidth + 10) * 2, 80);
            this.Controls.Add(_columnsViewers[2]);
            _columnsViewers[3] = new HTMColumnsViewer(_region, HTMRegionViewerPropertyShowed.ColumnPermanence, columnViewersWidth, columnViewersWidth);
            _columnsViewers[3].Location = new Point(10 + (columnViewersWidth + 10) * 3, 80);
            this.Controls.Add(_columnsViewers[3]);

            int cellsViewersWidth = 250;
            int cellsViewersHeight = 250;
            _cellsViewers = new HTMCellsViewer[_region.CellsPerColumn];
            for (int i = 0; i < _region.CellsPerColumn; i++)
            {
                _cellsViewers[i] = new HTMCellsViewer(_region, i, cellsViewersWidth, cellsViewersHeight);
                _cellsViewers[i].Location = new Point(10 + (cellsViewersWidth + 10) * i, 270);
                _cellsViewers[i].Visible = true;
                this.Controls.Add(_cellsViewers[i]);
            }
            this.Width = 10 + (Math.Max(_region.CellsPerColumn, 4) + 1)* columnViewersWidth;
            this.Height = 560;

            doSpatialLearningCheckBox.Checked = _region.DoSpatialLearning;
            doTemporalLearningCheckBox.Checked = _region.DoTemporalLearning;
        }
Exemplo n.º 10
0
        public bool Initialize()
        {
            // Network param
            int cellsPerColumn;
            int minimumOverlap;
            int desiredLocalActiviy;
            int segmentActivationThreshold;
            int minSegmentActivityForLearning;
            double proximalSegmentCoverage;
            try
            {
                _regionWidth = int.Parse(regionWidthTextBox.Text);
                _regionHeight = int.Parse(regionHeightTextBox.Text);
                cellsPerColumn = int.Parse(networkSizeComboBox.Text.Substring(networkSizeComboBox.Text.Length - 1, 1));
                minimumOverlap = int.Parse(minimumOverlapTextBox.Text);
                desiredLocalActiviy = int.Parse(desiredLocalActivityTextBox.Text);
                segmentActivationThreshold = int.Parse(segmentActivationThresholdTextBox.Text);
                minSegmentActivityForLearning = int.Parse(segmentActivationThresholdTextBox.Text);
                proximalSegmentCoverage = double.Parse(proximalSegmentCoverageTextBox.Text) / 100;
            }
            catch (Exception exch)
            {
                _director.Log(exch.ToString());
                return false;
            }
            if (proximalSegmentCoverage < 0 && proximalSegmentCoverage > 1)
            {
                _director.Log("Proximal segment coverage out of range.");
                return false;
            }

            // Create the network.
            _regionAgent = new HTMRegionAgent(_director, _regionWidth, _regionHeight, cellsPerColumn, minimumOverlap, desiredLocalActiviy, segmentActivationThreshold, minSegmentActivityForLearning, proximalSegmentCoverage);
            _regionAgent.InputAgent = _inputAgent;
            _regionAgent.Initialize();

            // Create the viewer
            _regionViewer = new HTMRegionViewer(_regionAgent);
            _regionViewer.MdiParent = this.MdiParent;
            _regionViewer.Location = new Point(this.Left + this.Width, 20);
            _regionViewer.Show();

            _isInitialized = true;
            structureGroupBox.Enabled = false;  // disable the structural parameters
            return true;
        }