Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Dotnet Machinelearning AutoML SweepablePipeline

From Leeroopedia


Knowledge Sources
Domains Machine_Learning, AutoML
Last Updated 2026-02-09 00:00 GMT

Overview

Concrete tool for defining a sweepable ML pipeline search space provided by ML.NET AutoML.

Description

The AutoCatalog extension methods and the SweepablePipeline class together provide the API for constructing pipeline search spaces in ML.NET AutoML. The AutoCatalog.BinaryClassification() method creates a sweepable pipeline containing one or more binary classification trainers, each with boolean flags to include or exclude them from the search. The AutoCatalog.Featurizer() method creates a sweepable featurization pipeline that automatically detects column types and applies appropriate transforms. The SweepablePipeline.Append() method composes pipeline stages sequentially (the * concatenation operator), while passing multiple estimators to a single stage implements the + OneOf operator.

Usage

Import Microsoft.ML.AutoML when you need to define a search space of ML pipelines for AutoML experiments. Use the BinaryClassification() catalog method for quick setup with default trainer selections, or manually construct a SweepablePipeline with Append() for fine-grained control over pipeline structure and search spaces.

Code Reference

Source Location

  • Repository: ML.NET
  • File: src/Microsoft.ML.AutoML/API/AutoCatalog.cs (Lines 337-404 for BinaryClassification, Lines 747-859 for Featurizer)
  • File: src/Microsoft.ML.AutoML/SweepableEstimator/SweepablePipeline.cs (Lines 14-261)

Signature

// Create a sweepable pipeline for binary classification trainers
public SweepablePipeline BinaryClassification(
    string labelColumnName = "Label",
    string featureColumnName = "Features",
    bool useFastForest = true,
    bool useLgbm = true,
    bool useFastTree = true,
    bool useLbfgsLogisticRegression = true,
    bool useSdcaLogisticRegression = true,
    SearchSpace<FastForestOption> fastForestSearchSpace = null,
    SearchSpace<LgbmOption> lgbmSearchSpace = null,
    SearchSpace<FastTreeOption> fastTreeSearchSpace = null,
    SearchSpace<LbfgsOption> lbfgsSearchSpace = null,
    SearchSpace<SdcaOption> sdcaSearchSpace = null)

// Create a sweepable featurization pipeline
public SweepablePipeline Featurizer(
    IDataView data,
    string outputColumnName = "Features",
    string[] catelogicalColumns = null,
    string[] numericColumns = null,
    string[] textColumns = null,
    string[] imagePathColumns = null)

// Append estimators to a sweepable pipeline (sequential composition)
public SweepablePipeline Append(
    params ISweepable<IEstimator<ITransformer>>[] sweepables)

Import

using Microsoft.ML.AutoML;

I/O Contract

Inputs

Name Type Required Description
labelColumnName string No (default: "Label") Name of the label column in the training data
featureColumnName string No (default: "Features") Name of the feature column for trainers
useFastTree bool No (default: true) Include FastTree trainer in the search space
useLgbm bool No (default: true) Include LightGBM trainer in the search space
useFastForest bool No (default: true) Include FastForest trainer in the search space
useLbfgsLogisticRegression bool No (default: true) Include LBFGS Logistic Regression in the search space
useSdcaLogisticRegression bool No (default: true) Include SDCA Logistic Regression in the search space
data IDataView Yes (for Featurizer) Training data used for auto-detection of column types
sweepables ISweepable[] Yes (for Append) One or more sweepable estimators to append as a pipeline stage

Outputs

Name Type Description
(return) SweepablePipeline A pipeline search space with embedded SearchSpace definitions and estimator algebra (OneOf / Concatenate)

Usage Examples

Basic Example

var mlContext = new MLContext();

// Create a sweepable pipeline using the BinaryClassification catalog
// This includes FastTree, LightGBM, FastForest, and both logistic regressions
var pipeline = mlContext.Auto()
    .Featurizer(data, outputColumnName: "Features")
    .Append(mlContext.Auto().BinaryClassification(
        labelColumnName: "Label",
        featureColumnName: "Features"));

Selective Trainer Example

// Only search over FastTree and LightGBM, exclude others
var pipeline = mlContext.Auto()
    .Featurizer(data, outputColumnName: "Features")
    .Append(mlContext.Auto().BinaryClassification(
        labelColumnName: "Label",
        useFastTree: true,
        useLgbm: true,
        useFastForest: false,
        useLbfgsLogisticRegression: false,
        useSdcaLogisticRegression: false));

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment