T
- the type of model.public abstract class AbstractModelPort<T> extends LogicalPort
SimpleModelPort
or PMMLPort
).
The term "model" originated in the analytics package because model ports are most commonly
used for prediction models (i.e. PMML). Model ports share the following
characteristics:
merge-handler
.
Note that MergeModel
is a convenient, re-usable model reducer, parameterized with
a merge-handler. RecordPort
's
where gather and scatter operators are symmetric).LogicalPort.Direction
Modifier | Constructor and Description |
---|---|
protected |
AbstractModelPort(LogicalOperator owner,
String name,
LogicalPort.Direction direction,
boolean optional,
ModelStorageHandler<T> storageHandler)
Subclasses must invoke this constructor
|
Modifier and Type | Method and Description |
---|---|
abstract LogicalPortFactory<? extends AbstractModelPort<?>> |
getFactory()
Returns the factory that knows how to create ports of this type
|
abstract AbstractModelPortMetadata |
getMetadata(T model)
Returns the metadata associate with the model.
|
T |
getModel(ExecutionContext ctx)
Reads the model from this model input port.
|
Class<T> |
getModelClass()
Returns the java class of the model
|
protected ModelStorageHandler<T> |
getStorageHandler()
Returns the storage handler responsible for persisting the model
|
void |
setMergeHandler(MetadataCalculationContext ctx,
ModelMergeHandler<T> mergeHandler)
Sets the merge handler for the input port
|
void |
setModel(ExecutionContext ctx,
T model)
Outputs the model on this model output port.
|
getDirection, getMetadataType, getName, getOwner, isOptional, toString
protected AbstractModelPort(LogicalOperator owner, String name, LogicalPort.Direction direction, boolean optional, ModelStorageHandler<T> storageHandler)
owner
- the operator that owns this portname
- the name of the portdirection
- the direction, input vs. outputoptional
- whether the port is optionalstorageHandler
- a storage handler responsible for persisting the modelpublic final Class<T> getModelClass()
protected final ModelStorageHandler<T> getStorageHandler()
public abstract AbstractModelPortMetadata getMetadata(T model)
model
- the model objectpublic abstract LogicalPortFactory<? extends AbstractModelPort<?>> getFactory()
LogicalPort
getFactory
in class LogicalPort
public final void setMergeHandler(MetadataCalculationContext ctx, ModelMergeHandler<T> mergeHandler)
ctx
- the metadata contextmergeHandler
- the merge handler to usepublic final T getModel(ExecutionContext ctx)
ctx
- the execution contextpublic final void setModel(ExecutionContext ctx, T model)
ctx
- the execution contextmodel
- the modelCopyright © 2021 Actian Corporation. All rights reserved.