public void testAnalyze() { BasicNetwork network = EncogUtility.simpleFeedForward(2, 2, 0, 1, false); double[] weights = new double[network.encodedArrayLength()]; EngineArray.fill(weights, 1.0); network.decodeFromArray(weights); AnalyzeNetwork analyze = new AnalyzeNetwork(network); Assert.assertEquals(weights.length, analyze.getWeightsAndBias().getSamples()); Assert.assertEquals(3, analyze.getBias().getSamples()); Assert.assertEquals(6, analyze.getWeights().getSamples()); }
public void testFactoryFeedforward() { String architecture = "?:B->TANH->3->LINEAR->?:B"; MLMethodFactory factory = new MLMethodFactory(); BasicNetwork network = (BasicNetwork) factory.create(MLMethodFactory.TYPE_FEEDFORWARD, architecture, 1, 4); Assert.assertTrue(network.isLayerBiased(0)); Assert.assertFalse(network.isLayerBiased(1)); Assert.assertTrue(network.isLayerBiased(2)); Assert.assertEquals(3, network.getLayerCount()); Assert.assertTrue(network.getActivation(0) instanceof ActivationLinear); Assert.assertTrue(network.getActivation(1) instanceof ActivationTANH); Assert.assertTrue(network.getActivation(2) instanceof ActivationLinear); Assert.assertEquals(18, network.encodedArrayLength()); Assert.assertEquals(1, network.getLayerNeuronCount(0)); Assert.assertEquals(3, network.getLayerNeuronCount(1)); Assert.assertEquals(4, network.getLayerNeuronCount(2)); }