Demos Applications Components Optimizers Experiments Datasets

Basic

Basic Test


Project maintained by SimiaCryptus Java, CuDNN, and CUDA are others' trademarks. No endorsement is implied.
  1. Serialization
    1. Raw Json
  2. Example Input/Output Pair
  3. Batch Execution
  4. Differential Validation
    1. Feedback Validation

Target Description: The type Entropy layer.

Report Description: Basic Test

Serialization

This run will demonstrate the layer’s JSON serialization, and verify deserialization integrity.

Raw Json

Code from SerializationTest.java:84 executed in 0.00 seconds:

    final JsonObject json = layer.getJson();
    final NNLayer echo = NNLayer.fromJson(json);
    if (echo == null) throw new AssertionError("Failed to deserialize");
    if (layer == echo) throw new AssertionError("Serialization did not copy");
    if (!layer.equals(echo)) throw new AssertionError("Serialization not equal");
    return new GsonBuilder().setPrettyPrinting().create().toJson(json);

Returns:

    {
      "class": "com.simiacryptus.mindseye.layers.java.EntropyLayer",
      "id": "90092c01-ced2-4464-bb2f-8d81904de41a",
      "isFrozen": true,
      "name": "EntropyLayer/90092c01-ced2-4464-bb2f-8d81904de41a"
    }

Wrote Model to EntropyLayer_Basic.json; 198 characters

Example Input/Output Pair

Display input/output pairs from random executions:

Code from ReferenceIO.java:69 executed in 0.00 seconds:

    final SimpleEval eval = SimpleEval.run(layer, inputPrototype);
    return String.format("--------------------\nInput: \n[%s]\n--------------------\nOutput: \n%s\n--------------------\nDerivative: \n%s",
                         Arrays.stream(inputPrototype).map(t -> t.prettyPrint()).reduce((a, b) -> a + ",\n" + b).get(),
                         eval.getOutput().prettyPrint(),
                         Arrays.stream(eval.getDerivative()).map(t -> t.prettyPrint()).reduce((a, b) -> a + ",\n" + b).get());

Returns:

    --------------------
    Input: 
    [[
    	[ [ -0.332 ], [ -0.98 ], [ 1.4 ] ],
    	[ [ -1.276 ], [ -1.536 ], [ 1.184 ] ]
    ]]
    --------------------
    Output: 
    [
    	[ [ -0.3660699429417953 ], [ -0.019798653171169075 ], [ -0.471061131269698 ] ],
    	[ [ 0.31099971596123527 ], [ 0.6592229909383379 ], [ -0.19997586717078764 ] ]
    ]
    --------------------
    Derivative: 
    [
    	[ [ 0.10262031006564842 ], [ -0.9797972926824805 ], [ -1.336472236621213 ] ],
    	[ [ -1.2437301849225981 ], [ -1.4291816347254804 ], [ -1.1688985364618139 ] ]
    ]

Batch Execution

Most layers, including this one, should behave the same no matter how the items are split between batches. We verify this:

Code from BatchingTester.java:113 executed in 0.00 seconds:

    return test(reference, inputPrototype);

Returns:

    ToleranceStatistics{absoluteTol=0.0000e+00 +- 0.0000e+00 [0.0000e+00 - 0.0000e+00] (120#), relativeTol=0.0000e+00 +- 0.0000e+00 [0.0000e+00 - 0.0000e+00] (120#)}

Differential Validation

Code from SingleDerivativeTester.java:292 executed in 0.00 seconds:

    log.info(String.format("Inputs: %s", Arrays.stream(inputPrototype).map(t -> t.prettyPrint()).reduce((a, b) -> a + ",\n" + b).get()));
    log.info(String.format("Inputs Statistics: %s", Arrays.stream(inputPrototype).map(x -> new ScalarStatistics().add(x.getData()).toString()).reduce((a, b) -> a + ",\n" + b).get()));
    log.info(String.format("Output: %s", outputPrototype.prettyPrint()));
    log.info(String.format("Outputs Statistics: %s", new ScalarStatistics().add(outputPrototype.getData())));

Logging:

    Inputs: [
    	[ [ -1.964 ], [ 1.98 ], [ -0.136 ] ],
    	[ [ 1.264 ], [ 0.044 ], [ -0.704 ] ]
    ]
    Inputs Statistics: {meanExponent=-0.28064700139044246, negative=3, min=-0.704, max=-0.704, mean=0.0806666666666667, count=6, positive=3, stdDev=1.2814313177935923, zeros=0}
    Output: [
    	[ [ 1.3256670243069864 ], [ -1.3525317525187588 ], [ -0.27133365348146754 ] ],
    	[ [ -0.29613155779597744 ], [ 0.13743688838281054 ], [ -0.24708775366816266 ] ]
    ]
    Outputs Statistics: {meanExponent=-0.385079198004363, negative=4, min=-0.24708775366816266, max=-0.24708775366816266, mean=-0.11733013412909492, count=6, positive=2, stdDev=0.7900837662333974, zeros=0}
    

Feedback Validation

We validate the agreement between the implemented derivative of the inputs with finite difference estimations:

Code from SingleDerivativeTester.java:303 executed in 0.00 seconds:

    return testFeedback(statistics, component, inputPrototype, outputPrototype);

Logging:

    Feedback for input 0
    Inputs Values: [
    	[ [ -1.964 ], [ 1.98 ], [ -0.136 ] ],
    	[ [ 1.264 ], [ 0.044 ], [ -0.704 ] ]
    ]
    Value Statistics: {meanExponent=-0.28064700139044246, negative=3, min=-0.704, max=-0.704, mean=0.0806666666666667, count=6, positive=3, stdDev=1.2814313177935923, zeros=0}
    Implemented Feedback: [ [ -1.6749832099322741, 0.0, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, -1.2342812957246656, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, -1.6830968447064438, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 2.123565645063876, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 0.9951003932460849, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 0.0, -0.6490230771759053 ] ]
    Implemented Statistics: {meanExponent=0.11312107322996064, negative=4, min=-0.6490230771759053, max=-0.6490230771759053, mean=-0.05896439970081466, count=36, positive=2, stdDev=0.5999457392103087, zeros=30}
    Measured: [ [ -1.6749577512520375, 0.0, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, -1.2343208516435444, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, -1.6831220968049898, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 2.1224301413319546, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 0.9954681304469304, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 0.0, -0.6489520510855051 ] ]
    Measured Statistics: {meanExponent=0.11310348651445264, negative=4, min=-0.6489520510855051, max=-0.6489520510855051, mean=-0.058984846639088664, count=36, positive=2, stdDev=0.5998491721865311, zeros=30}
    Feedback Error: [ [ 2.545868023662301E-5, 0.0, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, -3.955591887883081E-5, 0.0, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, -2.5252098545980317E-5, 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, -0.0011355037319211725, 0.0, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 3.67737200845486E-4, 0.0 ], [ 0.0, 0.0, 0.0, 0.0, 0.0, 7.10260904002169E-5 ] ]
    Error Statistics: {meanExponent=-4.020418519827442, negative=3, min=7.10260904002169E-5, max=7.10260904002169E-5, mean=-2.0446938273990492E-5, count=36, positive=3, stdDev=1.9842741332766893E-4, zeros=30}
    

Returns:

    java.lang.AssertionError: ToleranceStatistics{absoluteTol=4.6237e-05 +- 1.9405e-04 [0.0000e+00 - 1.1355e-03] (36#), relativeTol=8.9669e-05 +- 1.0064e-04 [7.5016e-06 - 2.6743e-04] (6#)}
    	at com.simiacryptus.mindseye.test.unit.SingleDerivativeTester.lambda$testFeedback$29(SingleDerivativeTester.java:407)
    	at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
    	at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
    	at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
    	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    	at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:479)
    	at com.simiacryptus.mindseye.test.unit.SingleDerivativeTester.testFeedback(SingleDerivativeTester.java:438)
    	at com.simiacryptus.mindseye.test.unit.SingleDerivativeTester.lambda$test$17(SingleDerivativeTester.java:304)
    	at com.simiacryptus.util.io.MarkdownNotebookOutput.lambda$null$1(MarkdownNotebookOutput.java:205)
    	at com.simiacryptus.util.lang.TimedResult.time(TimedResult.java:59)
    	at com.simiacryptus.util.io.MarkdownNotebookOutput.lambda$code$2(MarkdownNotebookOutput.java:205)
    	at com.simiacryptus.util.test.SysOutInterceptor.withOutput(SysOutInterceptor.java:107)
    	at com.simiacryptus.util.io.MarkdownNotebookOutput.code(MarkdownNotebookOutput.java:203)
    	at com.simiacryptus.util.io.NotebookOutput.code(NotebookOutput.java:82)
    	at com.simiacryptus.mindseye.test.unit.SingleDerivativeTester.test(SingleDerivativeTester.java:303)
    	at com.simiacryptus.mindseye.test.unit.SingleDerivativeTester.test(SingleDerivativeTester.java:42)
    	at com.simiacryptus.mindseye.test.unit.StandardLayerTests.lambda$run$5(StandardLayerTests.java:257)
    	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
    	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    	at com.simiacryptus.mindseye.test.unit.StandardLayerTests.run(StandardLayerTests.java:256)
    	at com.simiacryptus.mindseye.layers.java.ActivationLayerTestBase.run(ActivationLayerTestBase.java:112)
    	at com.simiacryptus.mindseye.test.NotebookReportBase.lambda$run$0(NotebookReportBase.java:105)
    	at com.simiacryptus.util.lang.TimedResult.time(TimedResult.java:76)
    	at com.simiacryptus.mindseye.test.NotebookReportBase.run(NotebookReportBase.java:103)
    	at com.simiacryptus.mindseye.layers.LayerTestBase.test(LayerTestBase.java:37)
    	at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    	at org.junit.runners.Suite.runChild(Suite.java:128)
    	at org.junit.runners.Suite.runChild(Suite.java:27)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)