Delen via


CustomMappingCatalog.StatefulCustomMapping<TSrc,TDst,TState> Method

Definition

Create a StatefulCustomMappingEstimator<TSrc,TDst,TState>, which applies a custom mapping of input columns to output columns, while allowing a per-cursor state.

public static Microsoft.ML.Transforms.StatefulCustomMappingEstimator<TSrc,TDst,TState> StatefulCustomMapping<TSrc,TDst,TState> (this Microsoft.ML.TransformsCatalog catalog, Action<TSrc,TDst,TState> mapAction, Action<TState> stateInitAction, string contractName) where TSrc : class, new() where TDst : class, new() where TState : class, new();
static member StatefulCustomMapping : Microsoft.ML.TransformsCatalog * Action<'Src, 'Dst, 'State (requires 'Src : null and 'Src : (new : unit -> 'Src) and 'Dst : null and 'Dst : (new : unit -> 'Dst) and 'State : null and 'State : (new : unit -> 'State))> * Action<'State (requires 'State : null and 'State : (new : unit -> 'State))> * string -> Microsoft.ML.Transforms.StatefulCustomMappingEstimator<'Src, 'Dst, 'State (requires 'Src : null and 'Src : (new : unit -> 'Src) and 'Dst : null and 'Dst : (new : unit -> 'Dst) and 'State : null and 'State : (new : unit -> 'State))> (requires 'Src : null and 'Src : (new : unit -> 'Src) and 'Dst : null and 'Dst : (new : unit -> 'Dst) and 'State : null and 'State : (new : unit -> 'State))
<Extension()>
Public Function StatefulCustomMapping(Of TSrc As {Class, New}, TDst As {Class, New}, TState As {Class, New}) (catalog As TransformsCatalog, mapAction As Action(Of TSrc, TDst, TState), stateInitAction As Action(Of TState), contractName As String) As StatefulCustomMappingEstimator(Of TSrc, TDst, TState)

Type Parameters

TSrc

The class defining which columns to take from the incoming data.

TDst

The class defining which new columns are added to the data.

TState

The type that describes per-cursor state.

Parameters

catalog
TransformsCatalog

The transform catalog.

mapAction
Action<TSrc,TDst,TState>

The mapping action. In addition to the input and output objects, the action is given a state object that it can look at and/or modify. If the resulting transformer needs to be save-able, the class defining mapAction should implement StatefulCustomMappingFactory<TSrc,TDst,TState> and needs to be decorated with CustomMappingFactoryAttributeAttribute with the provided contractName. The assembly containing the class should be registered in the environment where it is loaded back using RegisterAssembly(Assembly, Boolean).

stateInitAction
Action<TState>

The action to initialize the state object, that is called once before the cursor is initialized.

contractName
String

The contract name, used by ML.NET for loading the model. If null is specified, resulting transformer would not be save-able.

Returns

Applies to