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.
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.Please visit MLNet-AutoPipeline-Example for MLNet.AutoPipeline examples.
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.Sweeper | |
| MLNet.Expert |
We welcome contributions! Please see our contribution guide