语言

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>,并且需要使用提供的contractName类进行CustomMappingFactoryAttributeAttribute修饰。 包含该类的程序集应在加载 RegisterAssembly(Assembly, Boolean)回它的环境中注册。

stateInitAction
Action<TState>

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

contractName
String

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

返回

适用于