@Test public void when_callingPerformFit_expect_fitCalledOnModelWithCorrectLabels() { setup(false); INDArray features = Nd4j.rand(1, 2); INDArray labels = Nd4j.rand(1, 2); FeaturesLabels featuresLabels = new FeaturesLabels(features); featuresLabels.putLabels("TEST_LABEL", labels); sut.performFit(featuresLabels); ArgumentCaptor<INDArray> featuresCaptor = ArgumentCaptor.forClass(INDArray.class); ArgumentCaptor<INDArray> labelsCaptor = ArgumentCaptor.forClass(INDArray.class); verify(modelMock, times(1)).fit(featuresCaptor.capture(), labelsCaptor.capture()); INDArray featuresArg = featuresCaptor.getValue(); assertSame(featuresArg, features); INDArray labelsArg = labelsCaptor.getValue(); assertSame(labelsArg, labels); }
@Override public void performFit(FeaturesLabels featuresLabels) { INDArray features = featuresLabels.getFeatures(); INDArray labels = featuresLabels.getLabels(labelName); model.fit(features, labels); }
MultiLayerNetworkHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray features = featuresLabels.getFeatures(); INDArray labels = featuresLabels.getLabels(labelName); model.fit(features, labels); } }
MultiLayerNetworkHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray features = featuresLabels.getFeatures(); INDArray labels = featuresLabels.getLabels(labelName); model.fit(features, labels); } MultiLayerNetworkHandler(MultiLayerNetwork model, String labelName, String gradientName); }
MultiLayerNetworkHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray features = featuresLabels.getFeatures(); INDArray labels = featuresLabels.getLabels(labelName); model.fit(features, labels); } MultiLayerNetworkHandler(MultiLayerNetwork model, String labelName, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @Override void applyGradient(Gradients gradients, long batchSize); @Override INDArray[] recurrentStepOutput(Observation observation); @Override INDArray[] batchOutput(INDArray batch); @Override void resetState(); @Override INetworkHandler clone(); @Override void copyFrom(INetworkHandler from); @Override void fillGradientsResponse(Gradients gradients); }
MultiLayerNetworkHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray features = featuresLabels.getFeatures(); INDArray labels = featuresLabels.getLabels(labelName); model.fit(features, labels); } MultiLayerNetworkHandler(MultiLayerNetwork model, String labelName, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @Override void applyGradient(Gradients gradients, long batchSize); @Override INDArray[] recurrentStepOutput(Observation observation); @Override INDArray[] batchOutput(INDArray batch); @Override void resetState(); @Override INetworkHandler clone(); @Override void copyFrom(INetworkHandler from); @Override void fillGradientsResponse(Gradients gradients);  }