Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
/**
 * 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 (could be loose) of the number of output tables that can be
 returned by the
  * returned by the* Model::getModelData() and AlgoOperator::transform() methods, for any stage
 involved in this
  * involved in this* Graph.
     *
     * <p>The default upper bound is 20.
     */
    public GraphBuilder setMaxOutputLengthsetMaxOutputTableNum(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 @paramnumber algoOpof Anthe AlgoOperatorreturned instance.
TableIds does not represent the *actual @paramnumber inputsof ATables
 list of TableIds which represents* inputsoutputted toby transform(). ofThis the givennumber 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 @returninputs A list of TableIds which represents theinputs outputsto of 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.
     *
     * @param<p>NOTE: estimatorthe Annumber Estimatorof instance.
the returned TableIds does not *represent @paramthe inputsactual A listnumber of TableIdsTables
 which represents inputs to fit()* ofoutputted the given Estimator as
     *by transform(). This number could be configured using {@link
     well as inputs to transform() of the Model fitted by the given Estimator.* #setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
     * @returnTables Aoutputted list of TableIds which represents the outputs of by transform().
 of the Model fitted by*
     * @param estimator An Estimator instance.
     * @param inputs A list of TableIds which represents inputs to fit() of the given Estimator. as
     */
     well as publicinputs TableId[]to addEstimator(Estimator<?, ?> estimator, TableId... inputs) {...}

transform() of the Model fitted by the given Estimator.
     /**
     * Adds an Estimator in the graph.* @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().
 * <p>When the graph runs*
 as Estimator,  the fit() of the given Estimator would be invoked with * @param estimator An Estimator instance.
     * @param estimatorInputs. ThenA whenlist theof GraphModelTableIds fittedwhich byrepresents thisinputs graph runs, the transformto fit() of the given
     *  Model fitted by theEstimator.
 given Estimator would be invoked* with@param modelInputs.
 A list of TableIds *
which represents inputs to transform() of the *Model
 <p>When the graph runs as* AlgoOperator or Model, the fit()fitted ofby the given Estimator.
 would be
   * @return *A list invokedof withTableIds estimatorInputs,which thenrepresents the outputs of transform() of the Model fitted by
 the given Estimator
  *   * would be invokedthe withgiven modelInputsEstimator.
     */
    public * @param estimator An Estimator instance.
TableId[] addEstimator(
         * @param estimatorInputs A list of TableIds which represents inputs to fit() of the givenEstimator<?, ?> estimator, TableId[] estimatorInputs, TableId[] modelInputs) {...}

    /**
     * When the graph runs as Estimator.
, AlgoOperator or Model, the setModelData() *of @paramthe modelInputsgiven
 A list of TableIds which* representsModel inputswould tobe transform()invoked ofwith the Modelgiven inputs.
     *
     * fitted@param bymodel theA givenModel Estimatorinstance.
     * @param @returninputs A list of TableIds which represents theinputs outputsto of transformsetModelData() of the Model fitted bygiven
     *     the given EstimatorModel.
     */
    public TableId[]void addEstimator(
            Estimator<?, ?> estimator, TableId[] estimatorInputs, TableId[] modelInputssetModelData(Model<?> model, TableId... inputs) {...}

    /**
     * When the graph runs as Estimator, AlgoOperator or Model, the setModelDatagetModelData() of the given
     * Model would be invoked with the given inputs.
     *
     * @param<p>NOTE: modelthe Anumber Modelof instance.
     * @param inputs A list ofthe returned TableIds whichdoes representsnot inputs to setModelData() of represent the given
actual number    *     Model.
     */of Tables
    public void setModelData(Model<?> model, TableId... inputs) {...}

    /*** outputted by getModelData(). This number could be configured using {@link
     * When the graph runs as Estimator, AlgoOperator or Model, the getModelData() of the given#setMaxOutputTableNum(int)}. Users should make sure that this number >= the actual number of
     * ModelTables wouldoutputted beby invokedgetModelData().
     *
       * @param model A Model instance.
     * @return A list of TableIds which represents the outputs of getModelData() of the given Model.
     */
    public TableId[] getModelData(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) {...}
}

...