Performing a regression experiment
Our experiment in this chapter will rely both on ML.NET and AutoML once more, so we’ll start by importing those NuGet packages and creating an MLContext, as we did last chapter:
#r "nuget:Microsoft.ML,3.0.1" #r "nuget:Microsoft.ML.AutoML,0.21.1" using Microsoft.ML; using Microsoft.ML.Data; using Microsoft.ML.AutoML; MLContext context = new();
Ordinarily, our next step would be to split our DataFrame
(which implements IDataView
) into a training and test set using context.Data.TrainTestSplit
as we did in the last chapter. This process is still an option for us in regression and with this dataset, but in this chapter, I want to show you an alternative way of splitting our data later on.
Since we’re performing a regression experiment, we’ll instantiate a RegressionExperiment
Settings
object:
RegressionExperimentSettings settings = new() { OptimizingMetric = RegressionMetric.MeanAbsoluteError...