Skip to content

Provides easy API to create and train sweepable pipeline for ML.Net over a group of pre-defined paramaters and trainers

License

Notifications You must be signed in to change notification settings

LittleLittleCloud/auto-machinelearning

Repository files navigation

MLNet.AutoPipeline: AutoML for ML.NET

ML.Net AutoPipeline is a set of packages build on top of ML.Net that provide AutoML feature. It is aimed to solve the two following problems that vastly exists in Machinelearning:

  • Given a ML pipeline, find the best hyper-parameters for its transformers or trainers.
  • Given a dataset and a ML task, find the best pipeline for solving this task.

Build Status Azure DevOps coverage License: MIT

Try it on Binder

Binder

Quick Start

First, add MLNet.AutoPipeline to your project. You can get those packages from our nightly build.

<ItemGroup>
  <PackageReference Include="MLNet.AutoPipeline" />
</ItemGroup>

Then create a SweepablePipeline using AutoPipelineCatalog API. SweepablePipeline is similar to the concept of EstimatorChain in ML.Net. And it will fine-tune hyperparameters by sweeping over a group of pre-defined parameters during training.

var context = new MLContext();
var sweepablePipeline = context.Transforms.Conversion.MapValueToKey("species", "species")
                    // here we use Iris dataset as example.
                    .Append(context.Transforms.Concatenate("features", new string[] { "sepal_length", "sepal_width", "petal_length", "petal_width" }))
                    // create a sweepable LbfgsMaximumEntropy trainer
                    .Append(context.AutoML().MultiClassification.LbfgsMaximumEntropy("species", "features"));

Then create an Experiment to sweep over sweepablePipeline to find the best pipeline and hyperparameter.

var experimentOption = new Experiment.Option()
{
    EvaluateFunction = (MLContext context, IDataView data) =>
                {
                    return context.MulticlassClassification.Evaluate(data, "iris").MicroAccuracy;
                }, // Use Micro Accuracy as evaluate metric.
};

var experiment = context.AutoML().CreateExperiment(estimatorChain, experimentOption)
var result = await experiment.TrainAsync(split.TrainSet); // train experiment.

Examples

Please visit MLNet-AutoPipeline-Example for MLNet.AutoPipeline examples.

Installation

This project is still under developing, so no released package is available yet. However, you can get the prereleased version below.

auto-pipeline Pre-released
MLNet.AutoPipeline MLNet.AutoPipeline package in MLNet-Auto-Pipeline@Prerelease feed in Azure Artifacts
MLNet.Sweeper MLNet.Sweeper package in MLNet-Auto-Pipeline@Prerelease feed in Azure Artifacts
MLNet.Expert MLNet.Expert package in MLNet-Auto-Pipeline feed in Azure Artifacts

Contributing

We welcome contributions! Please see our contribution guide

About

Provides easy API to create and train sweepable pipeline for ML.Net over a group of pre-defined paramaters and trainers

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages