THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
7) Added transformSchemas() to the Stage interface.
- This is needed to validate the compatibility of input schemas with a given Estimator/Transformer instance.
8) Added setStateStreams and getStateStreams to the Transformer interface.
...
And we want to compose an Estimator (e.g. Graph) as from the following DAG of Transformer/Estimator.
The resulting Graph:TODO: add a graph:fit has the following behavior:
- The method takes 2 input tables. The 1st input table is given to a TransformerA instance. And the 2nd input table is given to another TransformerA instance.
- An EstimatorB instance fits the output tables of these two TransformerA instances and generates a new TransformerB instance.
- Returns a GraphModel instance which contains 2 TransformerA instance and 1 TransformerB instance, connected using the same DAG as shown above.
Here is the code snippet to complete this goal:
Code Block | ||
---|---|---|
| ||
GraphBuilder builder = new GraphBuilder(); // Creates nodes Stage<?> stage1 = new TransformerA(); Stage<?> stage2 = new TransformerA(); Stage<?> stage3 = new EstimatorB(); // Creates inputs and inputStates TableId input1 = builder.createTableId(); inputs and inputStates TableId input2input1 = builder.createTableId(); TableId inputState1input2 = builder.createTableId(); // Feeds input states to nodes. builder.setStateStreams(stage1, inputState1); // Feeds inputs to nodes and gets outputs. TableId output1 = builder.getOutputs(stage1, input1)[0]; TableId output2 = builder.getOutputs(stage2, input2)[0]; TableId output3 = builder.getOutputs(stage3, output1, output2)[0]; // Gets output states; TableId outputState1output3 = builder.getStateStreamsgetOutputs(stage3, output1, output2)[0]; // Specifies the ordered lists of inputs, outputs, input states and output states that will // be used as the inputs/outputs of the corresponding Graph and GraphModel APIs. TableId[] inputs = new TableId[] {input1, input2}; TableId[] outputs = new TableId[] {output3}; TableId[] inputStates = new TableId[] {inputState1}; TableId[] outputStates = new TableId[] {outputState1}; // Generates the Graph instance. Graph graph = builder.build(inputs, outputs, inputStates, outputStatesnew TableId[]{}, new TableId[]{}); // Use the Graph instance as an Estimator. GraphModel model = graph.fit(...); Table[] results = model.transform(...); |
Compatibility, Deprecation, and Migration Plan
...