예제 #1
0
        static void Main(string[] args)
        {
            // Create MLContext to be shared across the model creation workflow objects
            // Set a random seed for repeatable/deterministic results across multiple trainings.
            var mlContext = new MLContext(seed: 0);

            // 1. Common data loading configuration
            var textLoader       = BikeSharingTextLoaderFactory.CreateTextLoader(mlContext);
            var trainingDataView = textLoader.Read(TrainingDataLocation);
            var testDataView     = textLoader.Read(TestDataLocation);

            // 2. Common data pre-process with pipeline data transformations
            var dataProcessPipeline = mlContext.Transforms.CopyColumns("Count", "Label")
                                      // Concatenate all the numeric columns into a single features column
                                      .Append(mlContext.Transforms.Concatenate("Features", "Season", "Year", "Month",
                                                                               "Hour", "Holiday", "Weekday",
                                                                               "Weather", "Temperature", "NormalizedTemperature",
                                                                               "Humidity", "Windspeed"));

            // (Optional) Peek data in training DataView after applying the ProcessPipeline's transformations
            Common.ConsoleHelper.PeekDataViewInConsole <DemandObservation>(mlContext, trainingDataView, dataProcessPipeline, 10);
            Common.ConsoleHelper.PeekVectorColumnDataInConsole(mlContext, "Features", trainingDataView, dataProcessPipeline, 10);

            // Definition of regression trainers/algorithms to use
            //var regressionLearners = new (string name, IEstimator<ITransformer> value)[]
            (string name, IEstimator <ITransformer> value)[] regressionLearners =
예제 #2
0
        static void Main(string[] args)
        {
            // Create MLContext to be shared across the model creation workflow objects
            // Set a random seed for repeatable/deterministic results across multiple trainings.
            var mlContext = new MLContext(seed: 0);

            // 1. Common data loading configuration
            var textLoader       = BikeSharingTextLoaderFactory.CreateTextLoader(mlContext);
            var trainingDataView = textLoader.Read(TrainingDataLocation);
            var testDataView     = textLoader.Read(TestDataLocation);

            // 2. Common data pre-process with pipeline data transformations
            var dataProcessPipeline = BikeSharingDataProcessPipelineFactory.CreateDataProcessPipeline(mlContext);

            // (Optional) Peek data in training DataView after applying the ProcessPipeline's transformations
            Common.ConsoleHelper.PeekDataViewInConsole <DemandObservation>(mlContext, trainingDataView, dataProcessPipeline, 10);
            Common.ConsoleHelper.PeekVectorColumnDataInConsole(mlContext, "Features", trainingDataView, dataProcessPipeline, 10);

            // Definition of regression trainers/algorithms to use
            //var regressionLearners = new (string name, IEstimator<ITransformer> value)[]
            (string name, IEstimator <ITransformer> value)[] regressionLearners =