Beispiel #1
0
        private static void PredictIssue()
        {
            ITransformer loadedModel = mL.Model.Load(modelPath, out var modelInputSchema);

            var issue = new GitHubIssue
            {
                Title       = "Entity Framework crashes",
                Description = "When connecting to the database, EF is crashing"
            };

            engine = mL.Model.CreatePredictionEngine <GitHubIssue, IssuePrediction>(loadedModel);
            var prediction = engine.Predict(issue);

            Console.WriteLine($"Single Prediction - Result: {prediction.Area}");
        }
Beispiel #2
0
        public static IEstimator <ITransformer> BuildAndTrainModel(IDataView trainingDataView, IEstimator <ITransformer> pipeline)
        {
            var trainingPipeline = pipeline.Append(mL.MulticlassClassification.Trainers.SdcaMaximumEntropy("Label", "Features"))
                                   .Append(mL.Transforms.Conversion.MapKeyToValue("PredictedLabel"));

            model  = trainingPipeline.Fit(trainingDataView);
            engine = mL.Model.CreatePredictionEngine <GitHubIssue, IssuePrediction>(model);

            var issue = new GitHubIssue()
            {
                Title       = "WebSockets communication is slow in my machine",
                Description = "The WebSockets communication used under the covers by SignalR looks like it is going slow in my development machine."
            };

            var prediction = engine.Predict(issue);

            Console.WriteLine($"Single Prediction just-trained-model - Result: {prediction.Area}");

            return(trainingPipeline);
        }
Beispiel #3
0
        public static IEstimator <ITransformer> BuildAndTrainModel(IDataView trainingDataView, IEstimator <ITransformer> pipeline)
        {
            var trainingPipeline = pipeline.Append(_mlContext.MulticlassClassification.Trainers.SdcaMaximumEntropy("Label", "Features"))
                                   .Append(_mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel"));

            _trainedModel = trainingPipeline.Fit(trainingDataView);
            _predEngine   = _mlContext.Model.CreatePredictionEngine <GitHubIssue, IssuePrediction> (_trainedModel);

            /*
             * Test Here
             */
            GitHubIssue issue = new GitHubIssue()
            {
                Title       = "WebSockets communication is slow in my machine",
                Description = "The WebSockets communication used under the covers by SignalR looks like is going slow in my development machine.."
            };

            var prediction = _predEngine.Predict(issue);

            return(trainingPipeline);
        }
Beispiel #4
0
        private static void PredictIssue()
        {
            ITransformer loadedModel = _mlContext.Model.Load(_modelPath, out var modelInputSchema);
            GitHubIssue  singleIssue = new GitHubIssue()
            {
                Title = "Threads are failed", Description = "When i am use Threads my variables null take strong and not fail to crash."
            };

            _predEngine = _mlContext.Model.CreatePredictionEngine <GitHubIssue, IssuePrediction> (loadedModel);
            var prediction = _predEngine.Predict(singleIssue);

            Console.WriteLine($"=============== Single Prediction - Result: {prediction.Area} ===============");

            GitHubIssue secondIssue = new GitHubIssue()
            {
                Title = "Entity Framework crashes", Description = "When connecting to the database, EF is crashing"
            };

            _predEngine = _mlContext.Model.CreatePredictionEngine <GitHubIssue, IssuePrediction> (loadedModel);
            var prediction2 = _predEngine.Predict(secondIssue);

            Console.WriteLine($"=============== Second Prediction - Result: {prediction2.Area} ===============");
        }