public static void Execute()
        {
            Print.Header("Plot Regression Chart");

            if (!Validate.DataIsLoaded() || !Validate.ModelIsTrained())
            {
                return;
            }

            var predictions = SalaryPredictionService.GetPrediction(Program.TrainedModel, Program.Data.Take(100)).ToList();

            const string fileName = "chart.png";

            Plot.RegressionChart(predictions, fileName);
            Plot.ShowImage(fileName);
        }
Ejemplo n.º 2
0
        public static void Execute()
        {
            Print.Header("Train Model");

            if (!Validate.DataIsLoaded())
            {
                return;
            }

            SplitData(Program.Data, out var trainingData, out var validationData);

            IEnumerable <string> previewData = null;

            Program.TrainedModel = ConsoleSpinner.Execute("Training", () => SalaryPredictionService.Train(trainingData, out previewData));
            Print.PreviewTransformedData(previewData);

            var metrics = ConsoleSpinner.Execute("Evaluating", () => SalaryPredictionService.Evaluate(Program.TrainedModel, validationData));

            Print.Metrics(metrics);
        }
Ejemplo n.º 3
0
        public static void Execute()
        {
            Print.Header("Get Salary Prediction");

            if (!Validate.DataIsLoaded() || !Validate.ModelIsTrained())
            {
                return;
            }

            var age = ConsoleHelper.GetNumber("Enter Age of Employee:");

            ConsoleHelper.WriteLine("Select ExperienceLevel of Employee", ConsoleColor.Cyan);
            var experienceLevel = ConsoleHelper.PickOption(ExperienceLevel.Values);

            var employee = new Employee(age, experienceLevel, 0);

            Print.Employee(employee);

            var prediction = SalaryPredictionService.GetPrediction(Program.TrainedModel, employee);

            Print.PredictedSalary(prediction);
        }