/**
* A GraphBuilder provides APIs to build Estimator/Model/AlgoOperator from a DAG of stages, each of
* which could be an Estimator, Model, Transformer or AlgoOperator.
*/
@PublicEvolving
public final class GraphBuilder {
/**
* 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.
*
* <p>The default upper bound is 20.
*/
public GraphBuilder setMaxOutputTableNum(int maxOutputLength) {...}
/**
* Creates a TableId associated with this GraphBuilder. It can be used to specify the passing of
* tables between stages, as well as the input/output tables of the Graph/GraphModel generated
* by this builder.
*
* @return A TableId.
*/
public TableId createTableId() {...}
/**
* Adds an AlgoOperator in the graph.
*
* <p>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.
*
* <p>When the graph runs as AlgoOperator or Model, the transform() of the given AlgoOperator
* would be invoked with the given inputs.
*
* <p>NOTE: the number of the returned TableIds does not represent the actual number of Tables
* outputted by transform(). This number could be configured using {@link
* #setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
* Tables outputted by transform().
*
* @param algoOp An AlgoOperator instance.
* @param inputs A list of TableIds which represents inputs to transform() of the given
* AlgoOperator.
* @return A list of TableIds which represents the outputs of transform() of the given
* AlgoOperator.
*/
public TableId[] addAlgoOperator(AlgoOperator<?> algoOp, TableId... inputs) {...}
/**
* Adds an Estimator in the graph.
*
* <p>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.
*
* <p>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.
*
* <p>NOTE: the number of the returned TableIds does not represent the actual number of Tables
* outputted by transform(). This number could be configured using {@link
* #setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
* Tables outputted by transform().
*
* @param estimator An Estimator instance.
* @param 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.
* @return A list of TableIds which represents the outputs of transform() of the Model fitted by
* the given Estimator.
*/
public TableId[] addEstimator(Estimator<?, ?> estimator, TableId... inputs) {...}
/**
* Adds an Estimator in the graph.
*
* <p>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.
*
* <p>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.
*
* <p>NOTE: the number of the returned TableIds does not represent the actual number of Tables
* outputted by transform(). This number could be configured using {@link
* #setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
* Tables outputted by transform().
*
* @param estimator An Estimator instance.
* @param estimatorInputs A list of TableIds which represents inputs to fit() of the given
* Estimator.
* @param modelInputs A list of TableIds which represents inputs to transform() of the Model
* fitted by the given Estimator.
* @return A list of TableIds which represents the outputs of transform() of the Model fitted by
* the given Estimator.
*/
public TableId[] addEstimator(
Estimator<?, ?> estimator, TableId[] estimatorInputs, TableId[] modelInputs) {...}
/**
* When the graph runs as Estimator, it AlgoOperatorfirst orgenerates Model,a theGraphModel setModelData()that ofcontains the givenModel
* Modelfitted would be invoked with by the given inputsEstimator.
Then when this GraphModel runs, the setModelData() of the
* fitted Model would be invoked with the given inputs before its transform() is invoked.
*
* @param model A Model instance <p>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.
*
* @param estimator An Estimator instance.
* @param inputs A list of TableIds which represents inputs to setModelData() of the Model
* fitted by the given Estimator.
*/
public void setModelDataOnEstimator(Estimator<?, ?> estimator, 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. Then when the GraphModel fitted by this
* graph runs, the setModelData() of the given Model would be invoked with the given inputs.
*
* <p>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.
*
* @param model A Model instance.
* @param inputs A list of TableIds which represents inputs to setModelData() of the given
* Model.
*/
public void setModelDataOnModel(Model<?> model, TableId... inputs) {...}
/**
* When the graph runs as Estimator, it first generates a GraphModel that contains the Model
* fitted by the given Estimator. Then when this GraphModel runs, the getModelData() of the
* fitted Model would be invoked.
*
* <p>When the graph runs as AlgoOperator or Model, the getModelData() of the Model fitted by
* the given Estimator would be invoked.
*
* <p>NOTE: the number of the returned TableIds does not represent the actual number of Tables
* outputted by getModelData(). This number could be configured using {@link
* #setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
* Tables outputted by getModelData().
*
* @param estimator An Estimator instance.
* @return A list of TableIds which represents the outputs of getModelData() of the Model fitted
* by the given Estimator.
*/
public TableId[] getModelDataFromEstimator(Estimator<?, ?> estimator) {...}
/**
* When the graph runs as Estimator, the getModelData() of the given Model would be invoked.
* @paramThen inputswhen Athe listGraphModel offitted TableIdsby whichthis representsgraph inputsruns, tothe setModelDatagetModelData() of the given
* Model.
*/
would public void setModelData(Model<?> model, TableId... inputs) {...}
/*be invoked.
*
* When<p>When the graph runs as Estimator, AlgoOperator or Model, the getModelData() of the given Model would
* Model would be invoked.
*
* <p>NOTE: the number of the returned TableIds does not represent the actual number of Tables
* outputted by getModelData(). This number could be configured using {@link
* #setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
* Tables outputted by getModelData().
*
* @param model A Model instance.
* @return A list of TableIds which represents the outputs of getModelData() of the given Model.
*/
public TableId[] getModelDatagetModelDataFromModel(Model<?> model) {...}
/**
* Wraps nodes of the graph into an Estimator.
*
* <p>When the returned Estimator runs, and when the Model fitted by the returned Estimator
* runs, the sequence of operations recorded by the {@code addAlgoOperator(...)}, {@code
* addEstimator(...)}, {@code setModelData(...)} and {@code getModelData(...)} would be executed
* as specified in the Java doc of the corresponding methods.
*
* @param 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.
* @param outputs A list of TableIds which represents outputs of transform() of the Model fitted
* by the returned Estimator.
* @return An Estimator which wraps the nodes of this graph.
*/
public Estimator<?, ?> buildEstimator(TableId[] inputs, TableId[] outputs) {...}
/**
* Wraps nodes of the graph into an Estimator.
*
* <p>When the returned Estimator runs, and when the Model fitted by the returned Estimator
* runs, the sequence of operations recorded by the {@code addAlgoOperator(...)}, {@code
* addEstimator(...)}, {@code setModelData(...)} and {@code getModelData(...)} would be executed
* as specified in the Java doc of the corresponding methods.
*
* @param 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.
* @param outputs A list of TableIds which represents outputs of transform() of the Model fitted
* by the returned Estimator.
* @param inputModelData A list of TableIds which represents inputs to setModelData() of the
* Model fitted by the returned Estimator.
* @param outputModelData A list of TableIds which represents outputs of getModelData() of the
* Model fitted by the returned Estimator.
* @return An Estimator which wraps the nodes of this graph.
*/
public Estimator<?, ?> buildEstimator(
TableId[] inputs,
TableId[] outputs,
TableId[] inputModelData,
TableId[] outputModelData) {...}
/**
* Wraps nodes of the graph into an Estimator.
*
* <p>When the returned Estimator runs, and when the Model fitted by the returned Estimator
* runs, the sequence of operations recorded by the {@code addAlgoOperator(...)}, {@code
* addEstimator(...)}, {@code setModelData(...)} and {@code getModelData(...)} would be executed
* as specified in the Java doc of the corresponding methods.
*
* @param estimatorInputs A list of TableIds which represents inputs to fit() of the returned
* Estimator.
* @param modelInputs A list of TableIds which represents inputs to transform() of the Model
* fitted by the returned Estimator.
* @param outputs A list of TableIds which represents outputs of transform() of the Model fitted
* by the returned Estimator.
* @param inputModelData A list of TableIds which represents inputs to setModelData() of the
* Model fitted by the returned Estimator.
* @param outputModelData A list of TableIds which represents outputs of getModelData() of the
* Model fitted by the returned Estimator.
* @return An Estimator which wraps the nodes of this graph.
*/
public Estimator<?, ?> buildEstimator(
TableId[] estimatorInputs,
TableId[] modelInputs,
TableId[] outputs,
TableId[] inputModelData,
TableId[] outputModelData) {...}
/**
* Wraps nodes of the graph into an AlgoOperator.
*
* <p>When the returned AlgoOperator runs, the sequence of operations recorded by the {@code
* addAlgoOperator(...)} and {@code addEstimator(...)} would be executed as specified in the
* Java doc of the corresponding methods.
*
* @param inputs A list of TableIds which represents inputs to transform() of the returned
* AlgoOperator.
* @param outputs A list of TableIds which represents outputs of transform() of the returned
* AlgoOperator.
* @return An AlgoOperator which wraps the nodes of this graph.
*/
public AlgoOperator<?> buildAlgoOperator(TableId[] inputs, TableId[] outputs) {...}
/**
* Wraps nodes of the graph into a Model.
*
* <p>When the returned Model runs, the sequence of operations recorded by the {@code
* addAlgoOperator(...)} and {@code addEstimator(...)} would be executed as specified in the
* Java doc of the corresponding methods.
*
* @param inputs A list of TableIds which represents inputs to transform() of the returned
* Model.
* @param outputs A list of TableIds which represents outputs of transform() of the returned
* Model.
* @return A Model which wraps the nodes of this graph.
*/
public Model<?> buildModel(TableId[] inputs, TableId[] outputs) {...}
/**
* Wraps nodes of the graph into a Model.
*
* <p>When the returned Model runs, the sequence of operations recorded by the {@code
* addAlgoOperator(...)}, {@code addEstimator(...)}, {@code setModelData(...)} and {@code
* getModelData(...)} would be executed as specified in the Java doc of the corresponding
* methods.
*
* @param inputs A list of TableIds which represents inputs to transform() of the returned
* Model.
* @param outputs A list of TableIds which represents outputs of transform() of the returned
* Model.
* @param inputModelData A list of TableIds which represents inputs to setModelData() of the
* returned Model.
* @param outputModelData A list of TableIds which represents outputs of getModelData() of the
* returned Model.
* @return A Model which wraps the nodes of this graph.
*/
public Model<?> buildModel(
TableId[] inputs,
TableId[] outputs,
TableId[] inputModelData,
TableId[] outputModelData) {...}
}
|