/** * Creates an output label matrix * * @param outcomeLabel the outcome label to use * @return a binary vector where 1 is transform to the * index specified by outcomeLabel */ protected INDArray createOutputVector(int outcomeLabel) { return FeatureUtil.toOutcomeVector(outcomeLabel, numOutcomes); }
/** * Sets the outcome of a particular example * * @param example the example to transform * @param label the label of the outcome */ @Override public void setOutcome(int example, int label) { if (example > numExamples()) throw new IllegalArgumentException("No example at " + example); if (label > numOutcomes() || label < 0) throw new IllegalArgumentException("Illegal label"); INDArray outcome = FeatureUtil.toOutcomeVector(label, numOutcomes()); getLabels().putRow(example, outcome); }
if (i2 == null) throw new IllegalStateException("Label not found on row " + i); INDArray newRow = FeatureUtil.toOutcomeVector(i2, labels.length); newLabelMatrix.putRow(i, newRow);
/** * Creates an output label matrix * * @param outcomeLabel the outcome label to use * @return a binary vector where 1 is transform to the * index specified by outcomeLabel */ protected INDArray createOutputVector(int outcomeLabel) { return FeatureUtil.toOutcomeVector(outcomeLabel, numOutcomes); }
/** * Creates an output label matrix * @param outcomeLabel the outcome label to use * @return a binary vector where 1 is transform to the * index specified by outcomeLabel */ protected INDArray createOutputVector(int outcomeLabel) { return FeatureUtil.toOutcomeVector(outcomeLabel, numOutcomes); }
/** * Creates an output label matrix * @param outcomeLabel the outcome label to use * @return a binary vector where 1 is applyTransformToDestination to the * index specified by outcomeLabel */ protected INDArray createOutputVector(int outcomeLabel) { return FeatureUtil.toOutcomeVector(outcomeLabel, numOutcomes); }
public Pair<INDArray, opencv_core.Mat> convertMat(byte[] byteFeature) { INDArray label = FeatureUtil.toOutcomeVector(byteFeature[0], NUM_LABELS);; // first value in the 3073 byte array opencv_core.Mat image = new opencv_core.Mat(HEIGHT, WIDTH, CV_8UC(CHANNELS)); // feature are 3072 ByteBuffer imageData = image.createBuffer(); for (int i = 0; i < HEIGHT * WIDTH; i++) { imageData.put(3 * i, byteFeature[i + 1 + 2 * HEIGHT * WIDTH]); // blue imageData.put(3 * i + 1, byteFeature[i + 1 + HEIGHT * WIDTH]); // green imageData.put(3 * i + 2, byteFeature[i + 1]); // red } // if (useSpecialPreProcessCifar) { // image = convertCifar(image); // } return new Pair<>(label, image); }
/** * Sets the outcome of a particular example * * @param example the example to transform * @param label the label of the outcome */ @Override public void setOutcome(int example, int label) { if (example > numExamples()) throw new IllegalArgumentException("No example at " + example); if (label > numOutcomes() || label < 0) throw new IllegalArgumentException("Illegal label"); INDArray outcome = FeatureUtil.toOutcomeVector(label, numOutcomes()); getLabels().putRow(example, outcome); }
vectorBatch.add( new DataSet( tmpPair.getFirst(), FeatureUtil.toOutcomeVector(tmpPair.getSecond().getInt(0),numOutcomes)));
if (i2 == null) throw new IllegalStateException("Label not found on row " + i); INDArray newRow = FeatureUtil.toOutcomeVector(i2, labels.length); newLabelMatrix.putRow(i, newRow);