Share via


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 已指定,產生的轉換器將無法儲存。

傳回

適用於