Class ModelImpl

  • All Implemented Interfaces:
    Model

    @Internal
    public class ModelImpl
    extends Object
    implements Model
    Implementation of Model that works with the Table API.
    • Method Detail

      • getResolvedInputSchema

        public org.apache.flink.table.catalog.ResolvedSchema getResolvedInputSchema()
        Description copied from interface: Model
        Returns the resolved input schema of this model.

        The input schema describes the structure and data types of the input columns that the model expects for inference operations.

        Specified by:
        getResolvedInputSchema in interface Model
        Returns:
        the resolved input schema.
      • getResolvedOutputSchema

        public org.apache.flink.table.catalog.ResolvedSchema getResolvedOutputSchema()
        Description copied from interface: Model
        Returns the resolved output schema of this model.

        The output schema describes the structure and data types of the output columns that the model produces during inference operations.

        Specified by:
        getResolvedOutputSchema in interface Model
        Returns:
        the resolved output schema.
      • predict

        public Table predict​(Table table,
                             org.apache.flink.types.ColumnList inputColumns)
        Description copied from interface: Model
        Performs prediction on the given table using specified input columns.

        This method applies the model to the input data to generate predictions. The input columns must match the model's expected input schema.

        Example:

        
         Table predictions = model.predict(inputTable, ColumnList.of("feature1", "feature2"));
         
        Specified by:
        predict in interface Model
        Parameters:
        table - the input table containing data for prediction
        inputColumns - the columns from the input table to use as model input
        Returns:
        a table containing the input data along with prediction results
      • predict

        public Table predict​(Table table,
                             org.apache.flink.types.ColumnList inputColumns,
                             Map<String,​String> options)
        Description copied from interface: Model
        Performs prediction on the given table using specified input columns with runtime options.

        This method applies the model to the input data to generate predictions with additional runtime configuration options such as max-concurrent-operations, timeout, and execution mode settings.

        For Common runtime options, see MLPredictRuntimeConfigOptions.

        Example:

        
         Map<String, String> options = Map.of("max-concurrent-operations", "100", "timeout", "30s", "async", "true");
         Table predictions = model.predict(inputTable,
             ColumnList.of("feature1", "feature2"), options);
         
        Specified by:
        predict in interface Model
        Parameters:
        table - the input table containing data for prediction
        inputColumns - the columns from the input table to use as model input
        options - runtime options for configuring the prediction operation
        Returns:
        a table containing the input data along with prediction results
      • asArgument

        public ApiExpression asArgument​(String name)
        Description copied from interface: Model
        Converts this model object into a named argument.

        This method is intended for use in function calls that accept model arguments, particularly in process table functions (PTFs) or other operations that work with models.

        Example:

        
         env.fromCall(
           "ML_PREDICT",
           inputTable.asArgument("INPUT"),
           model.asArgument("MODEL"),
           Expressions.descriptor(ColumnList.of("feature1", "feature2")).asArgument("ARGS")
         )
         
        Specified by:
        asArgument in interface Model
        Parameters:
        name - the name to assign to this model argument
        Returns:
        an expression that can be passed to functions expecting model arguments