Share via


MLContext Class

Definition

Represents the common context for all ML.NET operations.

C#
public sealed class MLContext
C#
public sealed class MLContext : Microsoft.ML.Runtime.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

Events

Log

Represents the callback method that will handle the log messages.

Explicit Interface Implementations

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

Product Versions
ML.NET 1.0.0, 1.1.0, 1.2.0, 1.3.1, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 2.0.0, 3.0.0, Preview, 4.0.0