Package model.MARK_II

Examples of model.MARK_II.Region


                MINIMAL_CONNECTED_PERMANENCE, INITIAL_PERMANENCE,
                PERCENT_ACTIVE_SYNAPSES_THRESHOLD,
                EXPONENTIAL_MOVING_AVERAGE_AlPHA, MINIMUM_COLUMN_FIRING_RATE);

        Retina retina = new Retina(66, 66);
        Region region = new Region("Region", 8, 8, 4,
                percentMinimumOverlapScore, (int) desiredLocalActivity);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);
View Full Code Here


    public static double printToFileSDRScoreFor1RetinaTo1RegionModelFor1Digit(
            double percentMinimumOverlapScore, double desiredLocalActivity,
            double desiredPercentageOfActiveColumns,
            String locationOfFileWithFileNameToSaveScore) throws IOException {
        Retina retina = new Retina(66, 66);
        Region region = new Region("Region", 8, 8, 1,
                percentMinimumOverlapScore, (int) desiredLocalActivity);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);

        retina.seeBMPImage("2.bmp");

        spatialPooler.performPooling(); // 11 active columns
        Set<ColumnPosition> columnActivityAfterSeeingImage2 = spatialPooler
                .getActiveColumnPositions();
        // = (6,5)(6, 3)(6, 2)(5, 3)(3, 5)(2, 2)(1, 3)(1, 2)(2, 5)(1, 5)(4, 4)

        // -----------------------compute SDR score----------------------------
        int totalNumberOfColumnsInRegion = region.getNumberOfRowsAlongRegionYAxis()
                * region.getNumberOfColumnsAlongRegionXAxis();
        SDRScoreCalculator sdrScoreCalculator = new SDRScoreCalculator(
                columnActivityAfterSeeingImage2,
                desiredPercentageOfActiveColumns, totalNumberOfColumnsInRegion);

        double SDRScore = sdrScoreCalculator.computeSDRScore();
View Full Code Here

                "./images/digits/MNIST/t10k-images.idx3-ubyte",
                "./images/digits/MNIST/t10k-labels.idx1-ubyte");

        // all images in MNIST dataset are 28 x 28 pixels
        Retina retina = new Retina(28, 28);
        Region region = new Region("Region", 8, 8, 1,
                percentMinimumOverlapScore, (int) desiredLocalActivity);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
        spatialPooler.setLearningState(true);

        int numberOfImagesToSee = 1000;
        double totalSDRScore = 0.0;
        for (int i = 1; i < (numberOfImagesToSee + 1); i++) {
            mnistManager.setCurrent(i);
            int[][] image = mnistManager.readImage();

            retina.see2DIntArray(image);
            spatialPooler.performPooling();
            Set<ColumnPosition> columnActivityAfterSeeingCurrentMNISTImage = spatialPooler
                    .getActiveColumnPositions();

            // compute SDR score
            int totalNumberOfColumnsInRegion = region.getNumberOfRowsAlongRegionYAxis()
                    * region.getNumberOfColumnsAlongRegionXAxis();
            SDRScoreCalculator sdrScoreCalculator = new SDRScoreCalculator(
                    columnActivityAfterSeeingCurrentMNISTImage,
                    desiredPercentageOfActiveColumns,
                    totalNumberOfColumnsInRegion);

View Full Code Here

                totalNumberOfColumnsInRegion);
    }

    private void setUpColumnActivityAfterSeeingImage2() throws IOException {
        Retina retina = new Retina(66, 66);
        Region region = new Region("Region", 8, 8, 1, 50, 3);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(retina.getVisionCells(), region, 0, 0);

        SpatialPooler spatialPooler = new SpatialPooler(region);
View Full Code Here

        final int LAYER_4_CELLS_PER_COLUMN = 4;
        final int LAYER_3_CELLS_PER_COLUMN = 1;
        double percentMinimumOverlap = 20;
        int desiredLocalActivity = 3;

        Neocortex neocortex = new Neocortex(new Region("root", 60, 60, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), new RegionToRegionRectangleConnect());
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(29, 60)), new Region("A", 125, 125, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);
        neocortex.addToCurrentRegion(new Rectangle(new Point(30, 0), new Point(60, 60)), new Region("B", 125, 125, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);

        neocortex.changeCurrentRegionTo("A");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), new Region("C", 125, 125, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);

        neocortex.changeCurrentRegionTo("B");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), new Region("D", 125, 125, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);

        neocortex.changeCurrentRegionTo("C");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(62, 125)), new Region("E", 125, 125, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);
        neocortex.addToCurrentRegion(new Rectangle(new Point(63, 0), new Point(125, 125)), new Region("F", 125, 125, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);

        neocortex.changeCurrentRegionTo("D");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(62, 125)), new Region("G", 125, 125, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);
        neocortex.addToCurrentRegion(new Rectangle(new Point(63, 0), new Point(125, 125)), new Region("H", 125, 125, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity), 0, 0);

        Region I = new Region("I", 250, 250, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity);
        Layer5Region M = new Layer5Region("M", 250, 250, LAYER_4_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity);
        neocortex.changeCurrentRegionTo("E");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), I, 0, 0);
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), M, 0, 0);

        Region J = new Region("J", 250, 250, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity);
        neocortex.changeCurrentRegionTo("F");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), J, 0, 0);

        Region K = new Region("K", 250, 250, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity);
        neocortex.changeCurrentRegionTo("G");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), K, 0, 0);

        Region L = new Region("L", 250, 250, LAYER_3_CELLS_PER_COLUMN, percentMinimumOverlap, desiredLocalActivity);
        neocortex.changeCurrentRegionTo("H");
        neocortex.addToCurrentRegion(new Rectangle(new Point(0, 0), new Point(125, 125)), L, 0, 0);

        // NOTE: I, J, K, & L are connected to different parts of the same Retina
        Retina retina = new Retina(1000, 1000);
View Full Code Here

    private Region parentRegion;
    private Region childRegion;

    public void setUp() {
        this.connectType = new RegionToRegionRectangleConnect();
        this.parentRegion = new Region("parentRegion", 8, 8, 4, 20, 3);
        this.childRegion = new Region("childRegion", 66, 66, 4, 20, 3);
    }
View Full Code Here

    public void setUp() {
        this.connectType = new SensorCellsToRegionRectangleConnect();
    }

    public void test_connect() {
        Region leafRegion = new Region("leafRegion", 8, 8, 4, 20, 3);
        SensorCell[][] sensorCells = new VisionCell[66][66];
        for (int row = 0; row < sensorCells.length; row++) {
            for (int column = 0; column < sensorCells[0].length; column++) {
                sensorCells[row][column] = new VisionCell();
            }
        }

        this.connectType.connect(sensorCells, leafRegion, 2, 2);

        Column[][] columns = leafRegion.getColumns();
        for (int parentColumnRowPosition = 0; parentColumnRowPosition < leafRegion.getNumberOfRowsAlongRegionYAxis(); parentColumnRowPosition++) {
            for (int parentColumnColumnPosition = 0; parentColumnColumnPosition < leafRegion
                    .getNumberOfColumnsAlongRegionXAxis(); parentColumnColumnPosition++) {
                assertEquals(100, columns[parentColumnRowPosition][parentColumnColumnPosition]
                        .getProximalSegment().getSynapses().size());
            }
        }
View Full Code Here

    private Region parentRegion;
    private Region childRegion;

    public void setUp() {
        this.connectType = new RegionToRegionRandomConnect();
        this.parentRegion = new Region("parentRegion", 8, 8, 1, 20, 3);
        this.childRegion = new Region("childRegion", 66, 66, 1, 20, 3);
    }
View Full Code Here

    public void setUp() {
        this.connectType = new SensorCellsToRegionRandomConnect();
    }

    public void test_connect() {
        Region leafRegion = new Region("leafRegion", 8, 8, 4, 20, 3);
        SensorCell[][] sensorCells = new VisionCell[66][66];
        for (int row = 0; row < sensorCells.length; row++) {
            for (int column = 0; column < sensorCells[0].length; column++) {
                sensorCells[row][column] = new VisionCell();
            }
        }

        this.connectType.connect(sensorCells, leafRegion, 2, 2);
        Column[][] columns = leafRegion.getColumns();
        for (int parentColumnRowPosition = 0; parentColumnRowPosition < leafRegion.getNumberOfRowsAlongRegionYAxis(); parentColumnRowPosition++) {
            for (int parentColumnColumnPosition = 0; parentColumnColumnPosition < leafRegion
                    .getNumberOfColumnsAlongRegionXAxis(); parentColumnColumnPosition++) {
                assertEquals(72, columns[parentColumnRowPosition][parentColumnColumnPosition]
                        .getProximalSegment().getSynapses().size());
            }
        }
View Full Code Here

    public void setUp() {
        // images this oldRetina will see are all 66x66 pixels
        this.retina = new Retina(66, 66);

        this.region = new Region("Region name", 8, 8, 1, 77.8, 1);
        this.region.setInhibitionRadius(3);

        AbstractSensorCellsToRegionConnect retinaToRegion = new SensorCellsToRegionRectangleConnect();
        retinaToRegion.connect(this.retina.getVisionCells(), this.region, 0, 0);
View Full Code Here

TOP

Related Classes of model.MARK_II.Region

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.