Search in sources :

Example 21 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class EllipsisTest method testVarArg0.

@Disabled
@Test
public void testVarArg0() throws Narsese.NarseseException {
    // String rule = "(%S --> %M), ((|, %S, %A..+ ) --> %M) |- ((|, %A, ..) --> %M), (Belief:DecomposePositiveNegativeNegative)";
    String rule = "(%S ==> %M), ((&&,%S,%A..+) ==> %M) |- ((&&,%A..+) ==> %M), (Belief:DecomposeNegativePositivePositive, Order:ForAllSame, SequenceIntervals:FromBelief)";
    Compound _x = $.$('<' + rule + '>');
    assertTrue(_x instanceof DeriveRuleSource, _x.toString());
    DeriveRuleSource x = (DeriveRuleSource) _x;
    // System.out.println(x);
    x = new DeriveRuleProto(x, new PatternIndex());
    // System.out.println(x);
    assertEquals("(((%1==>%2),((%1&&%3..+)==>%2)),(((&&,%3..+)==>%2),((DecomposeNegativePositivePositive-->Belief),(ForAllSame-->Order),(FromBelief-->SequenceIntervals))))", x.toString());
}
Also used : Compound(nars.term.Compound) DeriveRuleSource(nars.derive.rule.DeriveRuleSource) DeriveRuleProto(nars.derive.rule.DeriveRuleProto) PatternIndex(nars.index.term.PatternIndex) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 22 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class MatrixOpTest method timeScalarMultNist.

@Disabled
@Test
public void timeScalarMultNist() {
    double[][] matrix1 = MatrixUtils.simpleRead2DMatrix(new File("src/test/resources/datasets/mnist2500_X.txt"), " ");
    double[][] matrix2 = MatrixUtils.simpleRead2DMatrix(new File("src/test/resources/datasets/mnist2500_X.txt"), " ");
    int rows = matrix1.length;
    int cols = matrix1[0].length;
    int noLaps = 50;
    long trtime = 0;
    long partrtime = 0;
    long time = 0;
    System.out.println("Size is " + rows + " x " + cols + "...");
    for (int laps = 0; laps < noLaps; laps++) {
        if ((laps % 10) == 0)
            System.out.println("Iter " + laps + "...");
        time = System.currentTimeMillis();
        double[][] tr1 = scalarMultiply(matrix1, matrix2);
        trtime += (System.currentTimeMillis() - time);
        time = System.currentTimeMillis();
        double[][] tr2 = parScalarMultiply(matrix1, matrix2);
        partrtime += (System.currentTimeMillis() - time);
        for (int i = 0; i < tr1.length; i++) {
            assertArrayEquals(tr1[i], tr2[i], 0.0000001);
        // int tl = tr1[0].length;
        // for (int j = 0; j < tl; j++) {
        // assertEquals(//"I: " + i + " J:" + j,
        // tr1[i][j],tr2[i][j],0.0000001);
        // }
        }
    }
    System.out.println("    Tr time: " + trtime);
    System.out.println("Par Tr time: " + partrtime);
}
Also used : File(java.io.File) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 23 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class MatrixOpTest method timeTransposesNist.

@Disabled
@Test
public void timeTransposesNist() {
    double[][] matrix = MatrixUtils.simpleRead2DMatrix(new File("src/test/resources/datasets/mnist2500_X.txt"), " ");
    int rows = matrix.length;
    int cols = matrix[0].length;
    double[][] trmatrix = new double[cols][rows];
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            trmatrix[j][i] = matrix[i][j];
        }
    }
    int noLaps = 50;
    long trtime = 0;
    long partrtime = 0;
    long time = 0;
    System.out.println("Size is: " + rows + " x" + cols + "...");
    for (int laps = 0; laps < noLaps; laps++) {
        if ((laps % 10) == 0)
            System.out.println("Iter " + laps + "...");
        time = System.currentTimeMillis();
        double[][] tr1 = MatrixOps.transposeSerial(matrix);
        trtime += (System.currentTimeMillis() - time);
        assertEquals(tr1.length, cols);
        assertEquals(tr1[0].length, rows);
        time = System.currentTimeMillis();
        double[][] tr2 = MatrixOps.transpose(matrix, 20);
        partrtime += (System.currentTimeMillis() - time);
        assertEquals(tr2.length, cols);
        assertEquals(tr2[0].length, rows);
        for (int i = 0; i < tr1.length; i++) {
            assertArrayEquals(trmatrix[i], tr1[i], 0.0000001);
            assertArrayEquals(trmatrix[i], tr2[i], 0.0000001);
        // for (int j = 0; j < tr1[0].length; j++) {
        // assertEquals(trmatrix[i][j],tr1[i][j],0.0000001);
        // //assertEquals("I: " + i + " J:" + j, trmatrix[i][j],tr2[i][j],0.0000001);
        // }
        }
    }
    System.out.println("    Tr time: " + trtime);
    System.out.println("Par Tr time: " + partrtime);
}
Also used : File(java.io.File) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 24 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class TsneTest method test1.

@Disabled
@Test
public void test1() {
    // double[][] data = new double[][]{
    // {-21.30234718322754, 0.48, -16.0, 1.0, 1.0, 0.0, -912.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, -64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {21.30234718322754, 0.48, 16.0, 1.0, 1.0, 0.0, 912.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, 64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {21.30234718322754, 0.49, 16.0, 1.0, 1.0, 0.0, 812.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, 64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {21.30234718322754, 0.5, 16.0, 1.0, 1.0, 0.0, 712.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, 64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {21.30234718322754, 0.48, 16.0, 1.0, 1.0, 0.0, 512.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, 64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {21.30234718322754, 0.49, 16.0, 1.0, 1.0, 0.0, 512.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, 64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {21.30234718322754, 0.5, 16.0, 1.0, 1.0, 0.0, 512.0, 0.5, 2.0, 2.0, 15.0, 42.0, 30.0, 10.0, 28.0, 0.5, 0.20412415266036987, 0.0, 64.0, 64.0, 0.004999999888241291, 0.0, 0.5, 0.5, 0.5, 0.5, 0.8999999761581421, 0.8999999761581421, 0.0, 0.0},
    // {20.95846176147461, 0.4808186888694763, 22.0, 0.38132792711257935, 1.0, 0.0, 471.0, 0.43011003732681274, 4.0, 0.0, 18.0, 47.0, 51.0, 17.0, 17.0, 0.595743715763092, 0.22977818548679352, 0.3948138356208801, 64.0, 69.0, 0.26262563467025757, 0.0, 1.0, 0.4571904242038727, 0.7489378452301025, 0.3581550717353821, 0.7983626127243042, 0.9577770829200745, -0.15979236364364624, -0.05524653196334839},
    // {21.331466674804688, 0.5, 13.0, 1.7480535507202148, 0.0, 0.0, 371.0, 1.947072148323059, 2.0, 3.0, 0.0, 47.0, 43.0, 16.0, 48.0, 0.60486900806427, 0.15891163051128387, 2.2695131301879883, 57.0, 80.0, 0.1700606346130371, 0.0, 0.47173094749450684, 0.24554623663425446, 0.5809586644172668, 1.0, 0.9306663870811462, 0.9950000047683716, -0.4445379078388214, -0.18973657488822937},
    // {20.75196647644043, 0.5, 17.0, 0.6735842227935791, 0.0, 0.0, 730.0, 0.0, 2.0, 4.0, 31.0, 45.0, 23.0, 16.0, 26.0, 0.41474899649620056, 0.06916480511426926, 1.0010837316513062, 73.0, 62.0, 0.2565132677555084, 0.10401569306850433, 0.5961753129959106, 0.24852895736694336, 0.2871387004852295, 0.533154308795929, 0.9908100366592407, 0.7967885732650757, 0.13373760879039764, -0.2136838138103485},
    // {20.99671173095703, 0.5, 18.0, 0.27828070521354675, 0.0, 0.0, 522.0, 5.928876876831055, 5.0, 0.0, 12.0, 55.0, 35.0, 7.0, 22.0, 0.4373595714569092, 0.011883316561579704, 0.0, 76.0, 96.0, 0.12904536724090576, 0.05639180168509483, 0.5879765748977661, 0.5081198215484619, 0.16028539836406708, 0.4688444435596466, 0.8602891564369202, 0.8782417178153992, 0.2320031225681305, 0.2398255616426468},
    // {21.354524612426758, 0.35868242383003235, 22.0, 1.027350664138794, 0.0, 0.0, 128.0, 0.0, 1.0, 0.0, 24.0, 12.0, 14.0, 0.0, 31.0, 0.26928645372390747, 0.11535469442605972, 0.0, 90.0, 35.0, 0.14928138256072998, 0.4440792202949524, 0.444633424282074, 0.42132723331451416, 0.9632992148399353, 0.7085565328598022, 0.9950000047683716, 0.9950000047683716, 0.340460866689682, -0.0960044264793396},
    // {17.393003463745117, 0.5, 18.0, 0.9550491571426392, 0.0, 0.0, 422.0, 2.0188231468200684, 12.0, 18.0, 32.0, 42.0, 26.0, 8.0, 39.0, 0.27758824825286865, 0.3836873471736908, 0.0, 83.0, 91.0, 0.004999999888241291, 0.0, 0.7157235741615295, 0.4657387137413025, 0.5226057767868042, 0.433219850063324, 0.8557721376419067, 0.7977447509765625, -0.2824641168117523, -0.06786750257015228},
    // {21.325220108032227, 0.38710877299308777, 16.0, 0.3573422431945801, 0.0, 0.0, 352.0, 0.0, 4.0, 0.0, 5.0, 50.0, 32.0, 15.0, 34.0, 0.4063739478588104, 0.2373967319726944, 0.0, 10.0, 59.0, 0.14747190475463867, 0.4210653603076935, 0.30484676361083984, 0.13044172525405884, 0.035849615931510925, 0.7536658644676208, 0.8851500153541565, 0.9950000047683716, 0.2435918152332306, 0.03520814701914787},
    // {21.11952018737793, 0.4024233818054199, 5.0, 1.4047718048095703, 0.0, 0.0, 260.0, 0.0, 0.0, 14.0, 0.0, 59.0, 38.0, 0.0, 12.0, 0.6892735362052917, 0.0, 0.0, 92.0, 104.0, 0.004999999888241291, 0.08096777647733688, 0.3692743480205536, 0.539433479309082, 0.3484911620616913, 0.204197958111763, 0.7651103734970093, 0.9950000047683716, -0.4875887632369995, -0.3541417419910431},
    // {21.047746658325195, 0.42637497186660767, 19.0, 0.23525908589363098, 0.0, 0.0, 755.0, 1.892948031425476, 0.0, 15.0, 0.0, 41.0, 42.0, 16.0, 29.0, 0.6284916996955872, 0.026182837784290314, 0.0, 37.0, 48.0, 0.004999999888241291, 0.010293583385646343, 0.3633580505847931, 0.462786465883255, 0.7083271145820618, 0.5576268434524536, 0.9950000047683716, 0.9950000047683716, 0.19580957293510437, 0.1489206701517105},
    // {18.66234588623047, 0.42469656467437744, 1.0, 0.8662810921669006, 0.0, 1.0, 489.0, 1.4751911163330078, 2.0, 29.0, 20.0, 46.0, 35.0, 26.0, 29.0, 0.28958332538604736, 0.36895209550857544, 0.0, 72.0, 50.0, 0.004999999888241291, 0.01774885132908821, 0.5444626212120056, 0.3307981789112091, 0.6434126496315002, 0.5588428378105164, 0.8543636798858643, 0.8011282086372375, -0.1126488670706749, -0.0884719043970108},
    // {21.1657772064209, 0.5, 22.0, 0.4553397595882416, 1.0, 0.0, 340.0, 0.0, 0.0, 11.0, 3.0, 34.0, 15.0, 23.0, 15.0, 0.3557361960411072, 0.0, 0.7408908009529114, 38.0, 71.0, 0.004999999888241291, 0.36444559693336487, 0.13318665325641632, 0.449336439371109, 0.7942307591438293, 0.38276150822639465, 0.6336342096328735, 0.9950000047683716, -0.20416949689388275, -0.6312856078147888},
    // {20.192710876464844, 0.41596096754074097, 20.0, 1.1024030447006226, 0.0, 0.0, 444.0, 0.36758625507354736, 0.0, 16.0, 39.0, 26.0, 27.0, 12.0, 24.0, 0.3936900794506073, 0.16099324822425842, 0.7797319293022156, 99.0, 91.0, 0.004999999888241291, 0.15895120799541473, 0.38645583391189575, 0.9601192474365234, 0.5533197522163391, 0.4685037136077881, 0.7505260705947876, 0.9136349558830261, 0.09462402760982513, 0.18027643859386444},
    // {21.56418800354004, 0.5, 12.0, 1.00830078125, 0.0, 0.0, 646.0, 1.2616074085235596, 0.0, 6.0, 30.0, 50.0, 38.0, 12.0, 0.0, 0.4270869493484497, 0.33934077620506287, 0.0, 65.0, 53.0, 0.004999999888241291, 0.0, 0.4538559317588806, 0.5412663817405701, 0.6233492493629456, 0.3307473361492157, 0.9950000047683716, 0.5428341627120972, -0.30709201097488403, -0.06266357749700546},
    // };
    int DIM = 4;
    int N = 128;
    double[][] data = new double[N][DIM];
    int j = 0;
    for (int i = 0; i < N / 2; i++) {
        data[j++] = new double[] { 0, 0, 1 + Math.random() / 2f, 1 + Math.random() / 2f };
    }
    for (int i = 0; i < N / 2; i++) {
        data[j++] = new double[] { 1, 0, -1 + Math.random() / 2f, -1 + Math.random() / 2f };
    }
    SimpleTSne t = new SimpleTSne() {

        Surface plot = new Surface() {

            @Override
            protected void paint(GL2 gl, int dtMS) {
                Draw.bounds(gl, bounds, this::paint);
            }

            protected void paint(GL2 gl) {
                double[][] vv = Y;
                if (vv == null)
                    return;
                vv = vv.clone();
                // for (int i = 0, yLength = vv.length; i < yLength; i++) {
                // 
                // }
                float scale = 0.1f;
                float w, h;
                w = h = 1f / vv.length;
                for (int i = 0, yLength = vv.length; i < yLength; i++) {
                    double[] v = vv[i];
                    float x = (float) (v[0]);
                    float y = (float) (((v.length > 1) ? v[1] : 0));
                    x *= scale;
                    y *= scale;
                    Draw.colorHash(gl, i, 0.75f);
                    Draw.rect(gl, x, y, w, h);
                }
            }
        };

        {
            SpaceGraph.window(plot, 800, 800);
        }

        @Override
        protected void next(int iter) {
            super.next(iter);
            Util.sleep(50);
        }
    };
    double[][] y = t.tsne(new TSneConfig(data, 2, -1, 5f, 1000, false, 0.5, false, true));
    System.out.println(MatrixOps.doubleArrayToPrintString(y));
}
Also used : GL2(com.jogamp.opengl.GL2) Surface(spacegraph.space2d.Surface) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 25 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class ArrayBagTest method testInsertOrBoostDoesntCauseSort.

@Disabled
@Test
public void testInsertOrBoostDoesntCauseSort() {
    final int[] sorts = { 0 };
    @NotNull CurveBag<PLink<String>> x = new CurveBag(PriMerge.plus, new HashMap<>(), 4) {

        @Override
        protected void sort(int from, int to) {
            sorts[0]++;
            super.sort(from, to);
        }
    };
    x.put(new PLink("x", 0.2f));
    x.put(new PLink("y", 0.1f));
    x.put(new PLink("z", 0f));
    assertEquals(0, sorts[0]);
    x.commit();
    assertEquals(0, sorts[0]);
    assertSorted(x);
}
Also used : PLink(jcog.pri.PLink) CurveBag(jcog.bag.impl.CurveBag) NotNull(org.jetbrains.annotations.NotNull) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

Disabled (org.junit.jupiter.api.Disabled)358 Test (org.junit.jupiter.api.Test)343 URL (java.net.URL)67 ArrayList (java.util.ArrayList)23 File (java.io.File)20 List (java.util.List)15 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)13 CountDownLatch (java.util.concurrent.CountDownLatch)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 NoGood (at.ac.tuwien.kr.alpha.core.common.NoGood)10 Path (java.nio.file.Path)10 HashMap (java.util.HashMap)10 IOException (java.io.IOException)9 NAR (nars.NAR)9 BaseDataTest (org.apache.ibatis.BaseDataTest)8 Timeout (org.junit.jupiter.api.Timeout)8 Arrays (java.util.Arrays)7 ExecutorService (java.util.concurrent.ExecutorService)7 TestNAR (nars.test.TestNAR)7 URL (org.apache.dubbo.common.URL)7