@PublicEvolving public final class GraphBuilder extends Object
Constructor and Description |
---|
GraphBuilder() |
Modifier and Type | Method and Description |
---|---|
TableId[] |
addAlgoOperator(AlgoOperator<?> algoOp,
TableId... inputs)
Adds an AlgoOperator in the graph.
|
TableId[] |
addEstimator(Estimator<?,?> estimator,
TableId... inputs)
Adds an Estimator in the graph.
|
TableId[] |
addEstimator(Estimator<?,?> estimator,
TableId[] estimatorInputs,
TableId[] modelInputs)
Adds an Estimator in the graph.
|
AlgoOperator<?> |
buildAlgoOperator(TableId[] inputs,
TableId[] outputs)
Wraps nodes of the graph into an AlgoOperator.
|
Estimator<?,?> |
buildEstimator(TableId[] inputs,
TableId[] outputs)
Wraps nodes of the graph into an Estimator.
|
Estimator<?,?> |
buildEstimator(TableId[] inputs,
TableId[] outputs,
TableId[] inputModelData,
TableId[] outputModelData)
Wraps nodes of the graph into an Estimator.
|
Estimator<?,?> |
buildEstimator(TableId[] estimatorInputs,
TableId[] modelInputs,
TableId[] outputs,
TableId[] inputModelData,
TableId[] outputModelData)
Wraps nodes of the graph into an Estimator.
|
Model<?> |
buildModel(TableId[] inputs,
TableId[] outputs)
Wraps nodes of the graph into a Model.
|
Model<?> |
buildModel(TableId[] inputs,
TableId[] outputs,
TableId[] inputModelData,
TableId[] outputModelData)
Wraps nodes of the graph into a Model.
|
TableId |
createTableId()
Creates a TableId associated with this GraphBuilder.
|
TableId[] |
getModelDataFromEstimator(Estimator<?,?> estimator)
When the graph runs as Estimator, it first generates a GraphModel that contains the Model
fitted by the given Estimator.
|
TableId[] |
getModelDataFromModel(Model<?> model)
When the graph runs as Estimator, the getModelData() of the given Model would be invoked.
|
GraphBuilder |
setMaxOutputTableNum(int maxOutputLength)
Specifies the loose upper bound of the number of output tables that can be returned by the
Model::getModelData() and AlgoOperator::transform() methods, for any stage involved in this
Graph.
|
void |
setModelDataOnEstimator(Estimator<?,?> estimator,
TableId... inputs)
When the graph runs as Estimator, it first generates a GraphModel that contains the Model
fitted by the given Estimator.
|
void |
setModelDataOnModel(Model<?> model,
TableId... inputs)
When the graph runs as Estimator, the setModelData() of the given Model would be invoked with
the given inputs before its transform() is invoked.
|
public GraphBuilder setMaxOutputTableNum(int maxOutputLength)
The default upper bound is 20.
public TableId createTableId()
public TableId[] addAlgoOperator(AlgoOperator<?> algoOp, TableId... inputs)
When the graph runs as Estimator, the transform() of the given AlgoOperator would be invoked with the given inputs. Then when the GraphModel fitted by this graph runs, the transform() of the given AlgoOperator would be invoked with the given inputs.
When the graph runs as AlgoOperator or Model, the transform() of the given AlgoOperator would be invoked with the given inputs.
NOTE: the number of the returned TableIds does not represent the actual number of Tables
outputted by transform(). This number could be configured using setMaxOutputTableNum(int)
. Users should make sure that this number >= the actual number of
Tables outputted by transform().
algoOp
- An AlgoOperator instance.inputs
- A list of TableIds which represents inputs to transform() of the given
AlgoOperator.public TableId[] addEstimator(Estimator<?,?> estimator, TableId... inputs)
When the graph runs as Estimator, the fit() of the given Estimator would be invoked with the given inputs. Then when the GraphModel fitted by this graph runs, the transform() of the Model fitted by the given Estimator would be invoked with the given inputs.
When the graph runs as AlgoOperator or Model, the fit() of the given Estimator would be invoked with the given inputs, then the transform() of the Model fitted by the given Estimator would be invoked with the given inputs.
NOTE: the number of the returned TableIds does not represent the actual number of Tables
outputted by transform(). This number could be configured using setMaxOutputTableNum(int)
. Users should make sure that this number >= the actual number of
Tables outputted by transform().
estimator
- An Estimator instance.inputs
- A list of TableIds which represents inputs to fit() of the given Estimator as
well as inputs to transform() of the Model fitted by the given Estimator.public TableId[] addEstimator(Estimator<?,?> estimator, TableId[] estimatorInputs, TableId[] modelInputs)
When the graph runs as Estimator, the fit() of the given Estimator would be invoked with estimatorInputs. Then when the GraphModel fitted by this graph runs, the transform() of the Model fitted by the given Estimator would be invoked with modelInputs.
When the graph runs as AlgoOperator or Model, the fit() of the given Estimator would be invoked with estimatorInputs, then the transform() of the Model fitted by the given Estimator would be invoked with modelInputs.
NOTE: the number of the returned TableIds does not represent the actual number of Tables
outputted by transform(). This number could be configured using setMaxOutputTableNum(int)
. Users should make sure that this number >= the actual number of
Tables outputted by transform().
estimator
- An Estimator instance.estimatorInputs
- A list of TableIds which represents inputs to fit() of the given
Estimator.modelInputs
- A list of TableIds which represents inputs to transform() of the Model
fitted by the given Estimator.public void setModelDataOnEstimator(Estimator<?,?> estimator, TableId... inputs)
When the graph runs as AlgoOperator or Model, the setModelData() of the Model fitted by the given Estimator would be invoked with the given inputs before its transform() is invoked.
estimator
- An Estimator instance.inputs
- A list of TableIds which represents inputs to setModelData() of the Model
fitted by the given Estimator.public void setModelDataOnModel(Model<?> model, TableId... inputs)
When the graph runs as AlgoOperator or Model, the setModelData() of the given Model would be invoked with the given inputs before its transform() is invoked.
model
- A Model instance.inputs
- A list of TableIds which represents inputs to setModelData() of the given
Model.public TableId[] getModelDataFromEstimator(Estimator<?,?> estimator)
When the graph runs as AlgoOperator or Model, the getModelData() of the Model fitted by the given Estimator would be invoked.
NOTE: the number of the returned TableIds does not represent the actual number of Tables
outputted by getModelData(). This number could be configured using setMaxOutputTableNum(int)
. Users should make sure that this number >= the actual number of
Tables outputted by getModelData().
estimator
- An Estimator instance.public TableId[] getModelDataFromModel(Model<?> model)
When the graph runs as AlgoOperator or Model, the getModelData() of the given Model would be invoked.
NOTE: the number of the returned TableIds does not represent the actual number of Tables
outputted by getModelData(). This number could be configured using setMaxOutputTableNum(int)
. Users should make sure that this number >= the actual number of
Tables outputted by getModelData().
model
- A Model instance.public Estimator<?,?> buildEstimator(TableId[] inputs, TableId[] outputs)
When the returned Estimator runs, and when the Model fitted by the returned Estimator
runs, the sequence of operations recorded by the addAlgoOperator(...)
, addEstimator(...)
, setModelData(...)
and getModelData(...)
would be executed
as specified in the Java doc of the corresponding methods.
inputs
- A list of TableIds which represents inputs to fit() of the returned Estimator
as well as inputs to transform() of the Model fitted by the returned Estimator.outputs
- A list of TableIds which represents outputs of transform() of the Model fitted
by the returned Estimator.public Estimator<?,?> buildEstimator(TableId[] inputs, TableId[] outputs, TableId[] inputModelData, TableId[] outputModelData)
When the returned Estimator runs, and when the Model fitted by the returned Estimator
runs, the sequence of operations recorded by the addAlgoOperator(...)
, addEstimator(...)
, setModelData(...)
and getModelData(...)
would be executed
as specified in the Java doc of the corresponding methods.
inputs
- A list of TableIds which represents inputs to fit() of the returned Estimator
as well as inputs to transform() of the Model fitted by the returned Estimator.outputs
- A list of TableIds which represents outputs of transform() of the Model fitted
by the returned Estimator.inputModelData
- A list of TableIds which represents inputs to setModelData() of the
Model fitted by the returned Estimator.outputModelData
- A list of TableIds which represents outputs of getModelData() of the
Model fitted by the returned Estimator.public Estimator<?,?> buildEstimator(TableId[] estimatorInputs, TableId[] modelInputs, TableId[] outputs, TableId[] inputModelData, TableId[] outputModelData)
When the returned Estimator runs, and when the Model fitted by the returned Estimator
runs, the sequence of operations recorded by the addAlgoOperator(...)
, addEstimator(...)
, setModelData(...)
and getModelData(...)
would be executed
as specified in the Java doc of the corresponding methods.
estimatorInputs
- A list of TableIds which represents inputs to fit() of the returned
Estimator.modelInputs
- A list of TableIds which represents inputs to transform() of the Model
fitted by the returned Estimator.outputs
- A list of TableIds which represents outputs of transform() of the Model fitted
by the returned Estimator.inputModelData
- A list of TableIds which represents inputs to setModelData() of the
Model fitted by the returned Estimator.outputModelData
- A list of TableIds which represents outputs of getModelData() of the
Model fitted by the returned Estimator.public AlgoOperator<?> buildAlgoOperator(TableId[] inputs, TableId[] outputs)
When the returned AlgoOperator runs, the sequence of operations recorded by the addAlgoOperator(...)
and addEstimator(...)
would be executed as specified in the
Java doc of the corresponding methods.
inputs
- A list of TableIds which represents inputs to transform() of the returned
AlgoOperator.outputs
- A list of TableIds which represents outputs of transform() of the returned
AlgoOperator.public Model<?> buildModel(TableId[] inputs, TableId[] outputs)
When the returned Model runs, the sequence of operations recorded by the addAlgoOperator(...)
and addEstimator(...)
would be executed as specified in the
Java doc of the corresponding methods.
inputs
- A list of TableIds which represents inputs to transform() of the returned
Model.outputs
- A list of TableIds which represents outputs of transform() of the returned
Model.public Model<?> buildModel(TableId[] inputs, TableId[] outputs, TableId[] inputModelData, TableId[] outputModelData)
When the returned Model runs, the sequence of operations recorded by the addAlgoOperator(...)
, addEstimator(...)
, setModelData(...)
and getModelData(...)
would be executed as specified in the Java doc of the corresponding
methods.
inputs
- A list of TableIds which represents inputs to transform() of the returned
Model.outputs
- A list of TableIds which represents outputs of transform() of the returned
Model.inputModelData
- A list of TableIds which represents inputs to setModelData() of the
returned Model.outputModelData
- A list of TableIds which represents outputs of getModelData() of the
returned Model.Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.