CustomMappingCatalog.StatefulCustomMapping<TSrc,TDst,TState> 方法

定义

创建一个 StatefulCustomMappingEstimator<TSrc,TDst,TState>,该映射将输入列的自定义映射应用于输出列,同时允许按游标状态。

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)

类型参数

TSrc

用于定义要从传入数据获取的列的类。

TDst

用于定义向数据添加新列的类。

TState

描述每个游标状态的类型。

参数

catalog
TransformsCatalog

转换目录。

mapAction
Action<TSrc,TDst,TState>

映射操作。 除了输入和输出对象外,该操作还提供一个状态对象,该对象可以查看和/或修改。 如果需要保存生成的转换器,则定义 mapAction 类应实现 StatefulCustomMappingFactory<TSrc,TDst,TState> ,并且需要用 CustomMappingFactoryAttributeAttribute 提供的 contractName修饰。 应在加载 RegisterAssembly(Assembly, Boolean)回类的环境中注册包含该类的程序集。

stateInitAction
Action<TState>

初始化状态对象的操作,在初始化游标之前调用一次。

contractName
String

ML.NET 用于加载模型的协定名称。 如果 null 指定,生成的转换器将无法保存。

返回

适用于