Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created February 17, 2019 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/177e2702598c681e11027cbb323f042a to your computer and use it in GitHub Desktop.
Save NMZivkovic/177e2702598c681e11027cbb323f042a to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
var regressors = new List<ITrainerEstimator<ISingleFeaturePredictionTransformer<IPredictor>, IPredictor>>()
{
_mlContext.Regression.Trainers.FastForest(labelColumn: "Count", featureColumn: "Features"),
_mlContext.Regression.Trainers.FastTree(labelColumn: "Count", featureColumn: "Features"),
_mlContext.Regression.Trainers.FastTreeTweedie(labelColumn: "Count", featureColumn: "Features"),
_mlContext.Regression.Trainers.GeneralizedAdditiveModels(labelColumn: "Count", featureColumn: "Features"),
_mlContext.Regression.Trainers.OnlineGradientDescent(labelColumn: "Count", featureColumn: "Features"),
_mlContext.Regression.Trainers.PoissonRegression(labelColumn: "Count", featureColumn: "Features"),
_mlContext.Regression.Trainers.StochasticDualCoordinateAscent(labelColumn: "Count", featureColumn: "Features")
};
regressors.ForEach(RunAlgorythm);
var bestModel = _stats.Where(x => x.Value == _stats.Max(y => y.Value)).Single().Key;
VisualizeTenPredictionsForTheModel(bestModel);
bestModel.SaveModel();
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment