Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Last active July 8, 2018 11:17
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/d494f90e36eccbfb86c075d0659ad2d2 to your computer and use it in GitHub Desktop.
Save NMZivkovic/d494f90e36eccbfb86c075d0659ad2d2 to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
var trainingDataLocation = @"Data/hour_train.csv";
var testDataLocation = @"Data/hour_test.csv";
var modelEvaluator = new ModelEvaluator();
var fastTreeModel = new ModelBuilder(trainingDataLocation, new FastTreeRegressor()).BuildAndTrain();
var fastTreeMetrics = modelEvaluator.Evaluate(fastTreeModel, testDataLocation);
PrintMetrics("Fast Tree", fastTreeMetrics);
var fastForestModel = new ModelBuilder(trainingDataLocation, new FastForestRegressor()).BuildAndTrain();
var fastForestMetrics = modelEvaluator.Evaluate(fastForestModel, testDataLocation);
PrintMetrics("Fast Forest", fastForestMetrics);
var poissonModel = new ModelBuilder(trainingDataLocation, new PoissonRegressor()).BuildAndTrain();
var poissonMetrics = modelEvaluator.Evaluate(poissonModel, testDataLocation);
PrintMetrics("Poisson", poissonMetrics);
var gradientDescentModel = new ModelBuilder(trainingDataLocation, new OnlineGradientDescentRegressor()).BuildAndTrain();
var gradientDescentMetrics = modelEvaluator.Evaluate(gradientDescentModel, testDataLocation);
PrintMetrics("Online Gradient Descent", gradientDescentMetrics);
var fastTreeTweedieModel = new ModelBuilder(trainingDataLocation, new FastTreeTweedieRegressor()).BuildAndTrain();
var fastTreeTweedieMetrics = modelEvaluator.Evaluate(fastTreeTweedieModel, testDataLocation);
PrintMetrics("Fast Tree Tweedie", fastTreeTweedieMetrics);
var additiveModel = new ModelBuilder(trainingDataLocation, new GeneralizedAdditiveModelRegressor()).BuildAndTrain();
var additiveMetrics = modelEvaluator.Evaluate(additiveModel, testDataLocation);
PrintMetrics("Generalized Additive Model", additiveMetrics);
var stohasticDualCorordinateAscentModel = new ModelBuilder(trainingDataLocation, new StochasticDualCoordinateAscentRegressor()).BuildAndTrain();
var stohasticDualCorordinateAscentMetrics = modelEvaluator.Evaluate(stohasticDualCorordinateAscentModel, testDataLocation);
PrintMetrics("Stochastic Dual Coordinate Ascent", stohasticDualCorordinateAscentMetrics);
VisualizeTenPredictionsForTheModel(fastTreeTweedieModel, testDataLocation);
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment