共用方式為


MLContext Class

Definition

Represents the common context for all ML.NET operations.

public sealed class MLContext
public sealed class MLContext : Microsoft.ML.Runtime.IHostEnvironment
type MLContext = class
    interface IHostEnvironment
    interface IChannelProvider
    interface IExceptionContext
    interface IProgressChannelProvider
Public NotInheritable Class MLContext
Public NotInheritable Class MLContext
Implements IHostEnvironment
Inheritance
MLContext
Implements

Remarks

Once instantiated by the user, this class provides a way to create components for data preparation, feature engineering, training, prediction, and model evaluation. It also allows logging, execution control, and the ability to set repeatable random numbers.

Constructors

MLContext(Nullable<Int32>)

Create the ML context.

Properties

AnomalyDetection

Gets the trainers and tasks specific to anomaly detection problems.

BinaryClassification

Gets the trainers and tasks specific to binary classification problems.

Clustering

Gets the trainers and tasks specific to clustering problems.

ComponentCatalog

Gets the catalog of components that will be used for model loading.

Data

Gets the data loading and saving operations.

FallbackToCpu

Gets or sets a value that indicates whether the CPU will be used if the task couldn't run on GPU.

Forecasting

Gets the trainers and tasks specific to forecasting problems.

GpuDeviceId

Gets or sets the GPU device ID to run execution on, null to run on CPU.

Model

Gets the operations with trained models.

MulticlassClassification

Gets the trainers and tasks specific to multiclass classification problems.

Ranking

Gets the trainers and tasks specific to ranking problems.

Regression

Gets the trainers and tasks specific to regression problems.

TempFilePath

Gets or sets the location for the temp files created by ML.NET.

Transforms

Gets the data processing operations.

Methods

GetOptionOrDefault<T>(String)
RemoveOption(String)
SetOption<T>(String, T)
TryAddOption<T>(String, T)
TryGetOption<T>(String, T)

Events

Log

Represents the callback method that will handle the log messages.

Explicit Interface Implementations

IChannelProvider.Start(String)
IChannelProvider.StartPipe<TMessage>(String)
IExceptionContext.ContextDescription
IExceptionContext.Process<TException>(TException)
IHostEnvironment.Register(String, Nullable<Int32>, Nullable<Boolean>)
IProgressChannelProvider.StartProgressChannel(String)

Extension Methods

Auto(MLContext)

Returns a catalog of all possible AutoML operations.

CancelExecution(MLContext)

Stop the execution of pipeline in MLContext

Recommendation(MLContext)

Trainers and tasks specific to recommendation problems.

GetOnnxSessionOption(IHostEnvironment)
SetOnnxSessionOption(IHostEnvironment, OnnxSessionOptions)

Applies to