@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()[0]; assertSame(featuresArg, features); INDArray labelsArg = labelsCaptor.getValue()[0]; assertSame(labelsArg, labels); }
@Override public void performFit(FeaturesLabels featuresLabels) { INDArray[] features = new INDArray[] { featuresLabels.getFeatures() }; INDArray[] labels = getLabelsFromFeaturesLabels(featuresLabels); model.fit(features, labels); }
ComputationGraphHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray[] features = new INDArray[] { featuresLabels.getFeatures() }; INDArray[] labels = getLabelsFromFeaturesLabels(featuresLabels); model.fit(features, labels); } }
ComputationGraphHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray[] features = new INDArray[] { featuresLabels.getFeatures() }; INDArray[] labels = getLabelsFromFeaturesLabels(featuresLabels); model.fit(features, labels); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); }
ComputationGraphHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray[] features = new INDArray[] { featuresLabels.getFeatures() }; INDArray[] labels = getLabelsFromFeaturesLabels(featuresLabels); model.fit(features, labels); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @Override void fillGradientsResponse(Gradients gradients); @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); }
ComputationGraphHandler implements INetworkHandler { @Override public void performFit(FeaturesLabels featuresLabels) { INDArray[] features = new INDArray[] { featuresLabels.getFeatures() }; INDArray[] labels = getLabelsFromFeaturesLabels(featuresLabels); model.fit(features, labels); } ComputationGraphHandler(ComputationGraph model, String[] labelNames, String gradientName); @Override void notifyGradientCalculation(); @Override void notifyIterationDone(); @Override void performFit(FeaturesLabels featuresLabels); @Override void performGradientsComputation(FeaturesLabels featuresLabels); @Override void fillGradientsResponse(Gradients gradients); @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);  }