Java Code Examples for org.datavec.local.transforms.LocalTransformExecutor#execute()
The following examples show how to use
org.datavec.local.transforms.LocalTransformExecutor#execute() .
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: TestPythonTransformProcess.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Test public void testNumpyTransform() { PythonTransform pythonTransform = PythonTransform.builder() .code("a += 2; b = 'hello world'") .returnAllInputs(true) .build(); List<List<Writable>> inputs = new ArrayList<>(); inputs.add(Arrays.asList((Writable) new NDArrayWritable(Nd4j.scalar(1).reshape(1,1)))); Schema inputSchema = new Builder() .addColumnNDArray("a",new long[]{1,1}) .build(); TransformProcess tp = new TransformProcess.Builder(inputSchema) .transform(pythonTransform) .build(); List<List<Writable>> execute = LocalTransformExecutor.execute(inputs, tp); assertFalse(execute.isEmpty()); assertNotNull(execute.get(0)); assertNotNull(execute.get(0).get(0)); assertNotNull(execute.get(0).get(1)); assertEquals(Nd4j.scalar(3).reshape(1, 1),((NDArrayWritable)execute.get(0).get(0)).get()); assertEquals("hello world",execute.get(0).get(1).toString()); }
Example 2
Source File: TestPythonTransformProcess.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Test public void testPythonTransformNoOutputSpecified() throws Exception { PythonTransform pythonTransform = PythonTransform.builder() .code("a += 2; b = 'hello world'") .returnAllInputs(true) .build(); List<List<Writable>> inputs = new ArrayList<>(); inputs.add(Arrays.asList((Writable)new IntWritable(1))); Schema inputSchema = new Builder() .addColumnInteger("a") .build(); TransformProcess tp = new TransformProcess.Builder(inputSchema) .transform(pythonTransform) .build(); List<List<Writable>> execute = LocalTransformExecutor.execute(inputs, tp); assertEquals(3,execute.get(0).get(0).toInt()); assertEquals("hello world",execute.get(0).get(1).toString()); }
Example 3
Source File: ExecutionTest.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test(timeout = 60000L) @Ignore("AB 2019/05/21 - Fine locally, timeouts on CI - Issue #7657 and #7771") public void testPythonExecutionNdarray()throws Exception{ Schema schema = new Schema.Builder() .addColumnNDArray("first",new long[]{1,32577}) .addColumnNDArray("second",new long[]{1,32577}).build(); TransformProcess transformProcess = new TransformProcess.Builder(schema) .transform( PythonTransform.builder().code( "first = np.sin(first)\nsecond = np.cos(second)") .outputSchema(schema).build()) .build(); List<List<Writable>> functions = new ArrayList<>(); List<Writable> firstRow = new ArrayList<>(); INDArray firstArr = Nd4j.linspace(1,4,4); INDArray secondArr = Nd4j.linspace(1,4,4); firstRow.add(new NDArrayWritable(firstArr)); firstRow.add(new NDArrayWritable(secondArr)); functions.add(firstRow); List<List<Writable>> execute = LocalTransformExecutor.execute(functions, transformProcess); INDArray firstResult = ((NDArrayWritable) execute.get(0).get(0)).get(); INDArray secondResult = ((NDArrayWritable) execute.get(0).get(1)).get(); INDArray expected = Transforms.sin(firstArr); INDArray secondExpected = Transforms.cos(secondArr); assertEquals(expected,firstResult); assertEquals(secondExpected,secondResult); }
Example 4
Source File: ExecutionTest.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testReductionGlobal() { List<List<Writable>> in = Arrays.asList( Arrays.<Writable>asList(new Text("first"), new DoubleWritable(3.0)), Arrays.<Writable>asList(new Text("second"), new DoubleWritable(5.0)) ); List<List<Writable>> inData = in; Schema s = new Schema.Builder() .addColumnString("textCol") .addColumnDouble("doubleCol") .build(); TransformProcess tp = new TransformProcess.Builder(s) .reduce(new Reducer.Builder(ReduceOp.TakeFirst) .takeFirstColumns("textCol") .meanColumns("doubleCol").build()) .build(); List<List<Writable>> outRdd = LocalTransformExecutor.execute(inData, tp); List<List<Writable>> out = outRdd; List<List<Writable>> expOut = Collections.singletonList(Arrays.<Writable>asList(new Text("first"), new DoubleWritable(4.0))); assertEquals(expOut, out); }
Example 5
Source File: ExecutionTest.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testFilter() { Schema filterSchema = new Schema.Builder() .addColumnDouble("col1").addColumnDouble("col2") .addColumnDouble("col3").build(); List<List<Writable>> inputData = new ArrayList<>(); inputData.add(Arrays.<Writable>asList(new IntWritable(0), new DoubleWritable(1), new DoubleWritable(0.1))); inputData.add(Arrays.<Writable>asList(new IntWritable(1), new DoubleWritable(3), new DoubleWritable(1.1))); inputData.add(Arrays.<Writable>asList(new IntWritable(2), new DoubleWritable(3), new DoubleWritable(2.1))); TransformProcess transformProcess = new TransformProcess.Builder(filterSchema) .filter(new DoubleColumnCondition("col1",ConditionOp.LessThan,1)).build(); List<List<Writable>> execute = LocalTransformExecutor.execute(inputData, transformProcess); assertEquals(2,execute.size()); }
Example 6
Source File: ExecutionTest.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testExecutionSimple() { Schema schema = new Schema.Builder().addColumnInteger("col0") .addColumnCategorical("col1", "state0", "state1", "state2").addColumnDouble("col2"). addColumnFloat("col3").build(); TransformProcess tp = new TransformProcess.Builder(schema).categoricalToInteger("col1") .doubleMathOp("col2", MathOp.Add, 10.0).floatMathOp("col3", MathOp.Add, 5f).build(); List<List<Writable>> inputData = new ArrayList<>(); inputData.add(Arrays.<Writable>asList(new IntWritable(0), new Text("state2"), new DoubleWritable(0.1), new FloatWritable(0.3f))); inputData.add(Arrays.<Writable>asList(new IntWritable(1), new Text("state1"), new DoubleWritable(1.1), new FloatWritable(1.7f))); inputData.add(Arrays.<Writable>asList(new IntWritable(2), new Text("state0"), new DoubleWritable(2.1), new FloatWritable(3.6f))); List<List<Writable>> rdd = (inputData); List<List<Writable>> out = new ArrayList<>(LocalTransformExecutor.execute(rdd, tp)); Collections.sort(out, new Comparator<List<Writable>>() { @Override public int compare(List<Writable> o1, List<Writable> o2) { return Integer.compare(o1.get(0).toInt(), o2.get(0).toInt()); } }); List<List<Writable>> expected = new ArrayList<>(); expected.add(Arrays.<Writable>asList(new IntWritable(0), new IntWritable(2), new DoubleWritable(10.1), new FloatWritable(5.3f))); expected.add(Arrays.<Writable>asList(new IntWritable(1), new IntWritable(1), new DoubleWritable(11.1), new FloatWritable(6.7f))); expected.add(Arrays.<Writable>asList(new IntWritable(2), new IntWritable(0), new DoubleWritable(12.1), new FloatWritable(8.6f))); assertEquals(expected, out); }
Example 7
Source File: ExecutionTest.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testExecutionNdarray() { Schema schema = new Schema.Builder() .addColumnNDArray("first",new long[]{1,32577}) .addColumnNDArray("second",new long[]{1,32577}).build(); TransformProcess transformProcess = new TransformProcess.Builder(schema) .ndArrayMathFunctionTransform("first", MathFunction.SIN) .ndArrayMathFunctionTransform("second",MathFunction.COS) .build(); List<List<Writable>> functions = new ArrayList<>(); List<Writable> firstRow = new ArrayList<>(); INDArray firstArr = Nd4j.linspace(1,4,4); INDArray secondArr = Nd4j.linspace(1,4,4); firstRow.add(new NDArrayWritable(firstArr)); firstRow.add(new NDArrayWritable(secondArr)); functions.add(firstRow); List<List<Writable>> execute = LocalTransformExecutor.execute(functions, transformProcess); INDArray firstResult = ((NDArrayWritable) execute.get(0).get(0)).get(); INDArray secondResult = ((NDArrayWritable) execute.get(0).get(1)).get(); INDArray expected = Transforms.sin(firstArr); INDArray secondExpected = Transforms.cos(secondArr); assertEquals(expected,firstResult); assertEquals(secondExpected,secondResult); }
Example 8
Source File: TestCalculateSortedRank.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testCalculateSortedRank() { List<List<Writable>> data = new ArrayList<>(); data.add(Arrays.asList((Writable) new Text("0"), new DoubleWritable(0.0))); data.add(Arrays.asList((Writable) new Text("3"), new DoubleWritable(0.3))); data.add(Arrays.asList((Writable) new Text("2"), new DoubleWritable(0.2))); data.add(Arrays.asList((Writable) new Text("1"), new DoubleWritable(0.1))); List<List<Writable>> rdd = (data); Schema schema = new Schema.Builder().addColumnsString("TextCol").addColumnDouble("DoubleCol").build(); TransformProcess tp = new TransformProcess.Builder(schema) .calculateSortedRank("rank", "DoubleCol", new DoubleWritableComparator()).build(); Schema outSchema = tp.getFinalSchema(); assertEquals(3, outSchema.numColumns()); assertEquals(Arrays.asList("TextCol", "DoubleCol", "rank"), outSchema.getColumnNames()); assertEquals(Arrays.asList(ColumnType.String, ColumnType.Double, ColumnType.Long), outSchema.getColumnTypes()); List<List<Writable>> out = LocalTransformExecutor.execute(rdd, tp); List<List<Writable>> collected = out; assertEquals(4, collected.size()); for (int i = 0; i < 4; i++) assertEquals(3, collected.get(i).size()); for (List<Writable> example : collected) { int exampleNum = example.get(0).toInt(); int rank = example.get(2).toInt(); assertEquals(exampleNum, rank); } }
Example 9
Source File: TestPythonTransformProcess.java From deeplearning4j with Apache License 2.0 | 5 votes |
@Test public void testWithSetupRun() throws Exception { PythonTransform pythonTransform = PythonTransform.builder() .code("five=None\n" + "def setup():\n" + " global five\n"+ " five = 5\n\n" + "def run(a, b):\n" + " c = a + b + five\n"+ " return {'c':c}\n\n") .returnAllInputs(true) .setupAndRun(true) .build(); List<List<Writable>> inputs = new ArrayList<>(); inputs.add(Arrays.asList((Writable) new NDArrayWritable(Nd4j.scalar(1).reshape(1,1)), new NDArrayWritable(Nd4j.scalar(2).reshape(1,1)))); Schema inputSchema = new Builder() .addColumnNDArray("a",new long[]{1,1}) .addColumnNDArray("b", new long[]{1, 1}) .build(); TransformProcess tp = new TransformProcess.Builder(inputSchema) .transform(pythonTransform) .build(); List<List<Writable>> execute = LocalTransformExecutor.execute(inputs, tp); assertFalse(execute.isEmpty()); assertNotNull(execute.get(0)); assertNotNull(execute.get(0).get(0)); assertEquals(Nd4j.scalar(8).reshape(1, 1),((NDArrayWritable)execute.get(0).get(3)).get()); }
Example 10
Source File: ExecutionTest.java From DataVec with Apache License 2.0 | 5 votes |
@Test public void testReductionGlobal() { List<List<Writable>> in = Arrays.asList( Arrays.<Writable>asList(new Text("first"), new DoubleWritable(3.0)), Arrays.<Writable>asList(new Text("second"), new DoubleWritable(5.0)) ); List<List<Writable>> inData = in; Schema s = new Schema.Builder() .addColumnString("textCol") .addColumnDouble("doubleCol") .build(); TransformProcess tp = new TransformProcess.Builder(s) .reduce(new Reducer.Builder(ReduceOp.TakeFirst) .takeFirstColumns("textCol") .meanColumns("doubleCol").build()) .build(); List<List<Writable>> outRdd = LocalTransformExecutor.execute(inData, tp); List<List<Writable>> out = outRdd; List<List<Writable>> expOut = Collections.singletonList(Arrays.<Writable>asList(new Text("first"), new DoubleWritable(4.0))); assertEquals(expOut, out); }
Example 11
Source File: ExecutionTest.java From DataVec with Apache License 2.0 | 5 votes |
@Test public void testFilter() { Schema filterSchema = new Schema.Builder() .addColumnDouble("col1").addColumnDouble("col2") .addColumnDouble("col3").build(); List<List<Writable>> inputData = new ArrayList<>(); inputData.add(Arrays.<Writable>asList(new IntWritable(0), new DoubleWritable(1), new DoubleWritable(0.1))); inputData.add(Arrays.<Writable>asList(new IntWritable(1), new DoubleWritable(3), new DoubleWritable(1.1))); inputData.add(Arrays.<Writable>asList(new IntWritable(2), new DoubleWritable(3), new DoubleWritable(2.1))); TransformProcess transformProcess = new TransformProcess.Builder(filterSchema) .filter(new DoubleColumnCondition("col1",ConditionOp.LessThan,1)).build(); List<List<Writable>> execute = LocalTransformExecutor.execute(inputData, transformProcess); assertEquals(2,execute.size()); }
Example 12
Source File: ExecutionTest.java From DataVec with Apache License 2.0 | 5 votes |
@Test public void testExecutionSimple() { Schema schema = new Schema.Builder().addColumnInteger("col0") .addColumnCategorical("col1", "state0", "state1", "state2").addColumnDouble("col2").build(); TransformProcess tp = new TransformProcess.Builder(schema).categoricalToInteger("col1") .doubleMathOp("col2", MathOp.Add, 10.0).build(); List<List<Writable>> inputData = new ArrayList<>(); inputData.add(Arrays.<Writable>asList(new IntWritable(0), new Text("state2"), new DoubleWritable(0.1))); inputData.add(Arrays.<Writable>asList(new IntWritable(1), new Text("state1"), new DoubleWritable(1.1))); inputData.add(Arrays.<Writable>asList(new IntWritable(2), new Text("state0"), new DoubleWritable(2.1))); List<List<Writable>> rdd = (inputData); List<List<Writable>> out = new ArrayList<>(LocalTransformExecutor.execute(rdd, tp)); Collections.sort(out, new Comparator<List<Writable>>() { @Override public int compare(List<Writable> o1, List<Writable> o2) { return Integer.compare(o1.get(0).toInt(), o2.get(0).toInt()); } }); List<List<Writable>> expected = new ArrayList<>(); expected.add(Arrays.<Writable>asList(new IntWritable(0), new IntWritable(2), new DoubleWritable(10.1))); expected.add(Arrays.<Writable>asList(new IntWritable(1), new IntWritable(1), new DoubleWritable(11.1))); expected.add(Arrays.<Writable>asList(new IntWritable(2), new IntWritable(0), new DoubleWritable(12.1))); assertEquals(expected, out); }
Example 13
Source File: TestCalculateSortedRank.java From DataVec with Apache License 2.0 | 5 votes |
@Test public void testCalculateSortedRank() { List<List<Writable>> data = new ArrayList<>(); data.add(Arrays.asList((Writable) new Text("0"), new DoubleWritable(0.0))); data.add(Arrays.asList((Writable) new Text("3"), new DoubleWritable(0.3))); data.add(Arrays.asList((Writable) new Text("2"), new DoubleWritable(0.2))); data.add(Arrays.asList((Writable) new Text("1"), new DoubleWritable(0.1))); List<List<Writable>> rdd = (data); Schema schema = new Schema.Builder().addColumnsString("TextCol").addColumnDouble("DoubleCol").build(); TransformProcess tp = new TransformProcess.Builder(schema) .calculateSortedRank("rank", "DoubleCol", new DoubleWritableComparator()).build(); Schema outSchema = tp.getFinalSchema(); assertEquals(3, outSchema.numColumns()); assertEquals(Arrays.asList("TextCol", "DoubleCol", "rank"), outSchema.getColumnNames()); assertEquals(Arrays.asList(ColumnType.String, ColumnType.Double, ColumnType.Long), outSchema.getColumnTypes()); List<List<Writable>> out = LocalTransformExecutor.execute(rdd, tp); List<List<Writable>> collected = out; assertEquals(4, collected.size()); for (int i = 0; i < 4; i++) assertEquals(3, collected.get(i).size()); for (List<Writable> example : collected) { int exampleNum = example.get(0).toInt(); int rank = example.get(2).toInt(); assertEquals(exampleNum, rank); } }
Example 14
Source File: TestPythonTransformProcess.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Test(timeout = 60000L) public void testPythonFilterAndTransform() throws Exception{ Builder schemaBuilder = new Builder(); schemaBuilder .addColumnInteger("col1") .addColumnFloat("col2") .addColumnString("col3") .addColumnDouble("col4"); Schema initialSchema = schemaBuilder.build(); schemaBuilder.addColumnString("col6"); Schema finalSchema = schemaBuilder.build(); Condition condition = new PythonCondition( "f = lambda: col1 < 0 and col2 > 10.0" ); condition.setInputSchema(initialSchema); Filter filter = new ConditionFilter(condition); String pythonCode = "col6 = str(col1 + col2)"; TransformProcess tp = new TransformProcess.Builder(initialSchema).transform( PythonTransform.builder().code(pythonCode) .outputSchema(finalSchema) .build() ).filter( filter ).build(); List<List<Writable>> inputs = new ArrayList<>(); inputs.add( Arrays.asList( (Writable) new IntWritable(5), new FloatWritable(3.0f), new Text("abcd"), new DoubleWritable(2.1)) ); inputs.add( Arrays.asList( (Writable) new IntWritable(-3), new FloatWritable(3.0f), new Text("abcd"), new DoubleWritable(2.1)) ); inputs.add( Arrays.asList( (Writable) new IntWritable(5), new FloatWritable(11.2f), new Text("abcd"), new DoubleWritable(2.1)) ); LocalTransformExecutor.execute(inputs,tp); }
Example 15
Source File: ExecutionTest.java From DataVec with Apache License 2.0 | 4 votes |
@Test public void testReductionByKey(){ List<List<Writable>> in = Arrays.asList( Arrays.<Writable>asList(new IntWritable(0), new Text("first"), new DoubleWritable(3.0)), Arrays.<Writable>asList(new IntWritable(0), new Text("second"), new DoubleWritable(5.0)), Arrays.<Writable>asList(new IntWritable(1), new Text("f"), new DoubleWritable(30.0)), Arrays.<Writable>asList(new IntWritable(1), new Text("s"), new DoubleWritable(50.0)) ); List<List<Writable>> inData = in; Schema s = new Schema.Builder() .addColumnInteger("intCol") .addColumnString("textCol") .addColumnDouble("doubleCol") .build(); TransformProcess tp = new TransformProcess.Builder(s) .reduce(new Reducer.Builder(ReduceOp.TakeFirst) .keyColumns("intCol") .takeFirstColumns("textCol") .meanColumns("doubleCol").build()) .build(); List<List<Writable>> outRdd = LocalTransformExecutor.execute(inData, tp); List<List<Writable>> out = outRdd; List<List<Writable>> expOut = Arrays.asList( Arrays.<Writable>asList(new IntWritable(0), new Text("first"), new DoubleWritable(4.0)), Arrays.<Writable>asList(new IntWritable(1), new Text("f"), new DoubleWritable(40.0))); out = new ArrayList<>(out); Collections.sort( out, new Comparator<List<Writable>>() { @Override public int compare(List<Writable> o1, List<Writable> o2) { return Integer.compare(o1.get(0).toInt(), o2.get(0).toInt()); } } ); assertEquals(expOut, out); }
Example 16
Source File: LocalExecuteExample.java From Java-Deep-Learning-Cookbook with MIT License | 4 votes |
public static void main(String[] args) throws Exception { try { int numClasses = 2; int batchSize = 8; File file = new File("Path/to/titanic.csv-file"); RecordReader recordReader = new CSVRecordReader(1,','); recordReader.initialize(new FileSplit(file)); // WritableConverter writableConverter = new SelfWritableConverter(); Schema schema = new Schema.Builder() .addColumnInteger("Survived") .addColumnCategorical("Pclass", Arrays.asList("1","2","3")) .addColumnString("Name") .addColumnCategorical("Sex", Arrays.asList("male","female")) .addColumnsInteger("Age","Siblings/Spouses Aboard","Parents/Children Aboard") .addColumnDouble("Fare") .build(); TransformProcess transformProcess = new TransformProcess.Builder(schema) .removeColumns("Name","Fare") .categoricalToInteger("Sex") .categoricalToOneHot("Pclass") .removeColumns("Pclass[1]") .build(); List<List<Writable>> outputData = new ArrayList<>(); RecordWriter recordWriter = new CSVRecordWriter(); Partitioner partitioner = new NumberOfRecordsPartitioner(); recordWriter.initialize(new FileSplit(new File("/Path/To/LocalExecuteExample.csv/file")),partitioner); while(recordReader.hasNext()){ outputData.add(recordReader.next()); } List<List<Writable>> transformedOutput=LocalTransformExecutor.execute(outputData,transformProcess); recordWriter.writeBatch(transformedOutput); recordWriter.close(); } catch (IllegalArgumentException e) { System.out.println("Please provide proper file paths for titanic.csv & fle in place of: Path/to/titanic.csv-file && /Path/To/LocalExecuteExample.csv"); System.out.println("You need to create an empty CSV file and mention the file path in place of /Path/To/LocalExecuteExample.csv"); } }
Example 17
Source File: ExecutionTest.java From deeplearning4j with Apache License 2.0 | 4 votes |
@Test public void testReductionByKey(){ List<List<Writable>> in = Arrays.asList( Arrays.<Writable>asList(new IntWritable(0), new Text("first"), new DoubleWritable(3.0)), Arrays.<Writable>asList(new IntWritable(0), new Text("second"), new DoubleWritable(5.0)), Arrays.<Writable>asList(new IntWritable(1), new Text("f"), new DoubleWritable(30.0)), Arrays.<Writable>asList(new IntWritable(1), new Text("s"), new DoubleWritable(50.0)) ); List<List<Writable>> inData = in; Schema s = new Schema.Builder() .addColumnInteger("intCol") .addColumnString("textCol") .addColumnDouble("doubleCol") .build(); TransformProcess tp = new TransformProcess.Builder(s) .reduce(new Reducer.Builder(ReduceOp.TakeFirst) .keyColumns("intCol") .takeFirstColumns("textCol") .meanColumns("doubleCol").build()) .build(); List<List<Writable>> outRdd = LocalTransformExecutor.execute(inData, tp); List<List<Writable>> out = outRdd; List<List<Writable>> expOut = Arrays.asList( Arrays.<Writable>asList(new IntWritable(0), new Text("first"), new DoubleWritable(4.0)), Arrays.<Writable>asList(new IntWritable(1), new Text("f"), new DoubleWritable(40.0))); out = new ArrayList<>(out); Collections.sort( out, new Comparator<List<Writable>>() { @Override public int compare(List<Writable> o1, List<Writable> o2) { return Integer.compare(o1.get(0).toInt(), o2.get(0).toInt()); } } ); assertEquals(expOut, out); }
Example 18
Source File: LocalExecuteExample.java From Java-Deep-Learning-Cookbook with MIT License | 4 votes |
public static void main(String[] args) throws Exception { try { int numClasses = 2; int batchSize = 8; File file = new File("Path/to/titanic.csv-file"); RecordReader recordReader = new CSVRecordReader(1,','); recordReader.initialize(new FileSplit(file)); // WritableConverter writableConverter = new SelfWritableConverter(); Schema schema = new Schema.Builder() .addColumnInteger("Survived") .addColumnCategorical("Pclass", Arrays.asList("1","2","3")) .addColumnString("Name") .addColumnCategorical("Sex", Arrays.asList("male","female")) .addColumnsInteger("Age","Siblings/Spouses Aboard","Parents/Children Aboard") .addColumnDouble("Fare") .build(); TransformProcess transformProcess = new TransformProcess.Builder(schema) .removeColumns("Name","Fare") .categoricalToInteger("Sex") .categoricalToOneHot("Pclass") .removeColumns("Pclass[1]") .build(); List<List<Writable>> outputData = new ArrayList<>(); RecordWriter recordWriter = new CSVRecordWriter(); Partitioner partitioner = new NumberOfRecordsPartitioner(); recordWriter.initialize(new FileSplit(new File("/Path/To/LocalExecuteExample.csv/file")),partitioner); while(recordReader.hasNext()){ outputData.add(recordReader.next()); } List<List<Writable>> transformedOutput=LocalTransformExecutor.execute(outputData,transformProcess); recordWriter.writeBatch(transformedOutput); recordWriter.close(); } catch (IllegalArgumentException e) { System.out.println("Please provide proper file paths for titanic.csv & fle in place of: Path/to/titanic.csv-file && /Path/To/LocalExecuteExample.csv"); System.out.println("You need to create an empty CSV file and mention the file path in place of /Path/To/LocalExecuteExample.csv"); } }