Java Code Examples for org.nd4j.linalg.dataset.api.DataSet#numExamples()
The following examples show how to use
org.nd4j.linalg.dataset.api.DataSet#numExamples() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecordConverter.java From DataVec with Apache License 2.0 | 6 votes |
private static List<List<Writable>> getRegressionWritableMatrix(DataSet dataSet) { List<List<Writable>> writableMatrix = new ArrayList<>(); for (int i = 0; i < dataSet.numExamples(); i++) { List<Writable> writables = toRecord(dataSet.getFeatures().getRow(i)); INDArray labelRow = dataSet.getLabels().getRow(i); for (int j = 0; j < labelRow.shape()[1]; j++) { writables.add(new DoubleWritable(labelRow.getDouble(j))); } writableMatrix.add(writables); } return writableMatrix; }
Example 2
Source File: RecordConverter.java From deeplearning4j with Apache License 2.0 | 6 votes |
private static List<List<Writable>> getRegressionWritableMatrix(DataSet dataSet) { List<List<Writable>> writableMatrix = new ArrayList<>(); for (int i = 0; i < dataSet.numExamples(); i++) { List<Writable> writables = toRecord(dataSet.getFeatures().getRow(i)); INDArray labelRow = dataSet.getLabels().getRow(i); for (int j = 0; j < labelRow.shape()[1]; j++) { writables.add(new DoubleWritable(labelRow.getDouble(j))); } writableMatrix.add(writables); } return writableMatrix; }
Example 3
Source File: RecordConverter.java From DataVec with Apache License 2.0 | 5 votes |
private static List<List<Writable>> getClassificationWritableMatrix(DataSet dataSet) { List<List<Writable>> writableMatrix = new ArrayList<>(); for (int i = 0; i < dataSet.numExamples(); i++) { List<Writable> writables = toRecord(dataSet.getFeatures().getRow(i)); writables.add(new IntWritable(Nd4j.argMax(dataSet.getLabels().getRow(i), 1).getInt(0))); writableMatrix.add(writables); } return writableMatrix; }
Example 4
Source File: RecordConverter.java From deeplearning4j with Apache License 2.0 | 5 votes |
private static List<List<Writable>> getClassificationWritableMatrix(DataSet dataSet) { List<List<Writable>> writableMatrix = new ArrayList<>(); for (int i = 0; i < dataSet.numExamples(); i++) { List<Writable> writables = toRecord(dataSet.getFeatures().getRow(i, true)); writables.add(new IntWritable(Nd4j.argMax(dataSet.getLabels().getRow(i)).getInt(0))); writableMatrix.add(writables); } return writableMatrix; }
Example 5
Source File: RecordConverter.java From DataVec with Apache License 2.0 | 4 votes |
private static boolean isClassificationDataSet(DataSet dataSet) { INDArray labels = dataSet.getLabels(); return labels.sum(0, 1).getInt(0) == dataSet.numExamples() && labels.shape()[1] > 1; }
Example 6
Source File: RecordConverter.java From deeplearning4j with Apache License 2.0 | 4 votes |
private static boolean isClassificationDataSet(DataSet dataSet) { INDArray labels = dataSet.getLabels(); return labels.sum(0, 1).getInt(0) == dataSet.numExamples() && labels.shape()[1] > 1; }