Ejemplo n.º 1
0
        private static void RandomForest(AppIdentService appIdentService, AppIdentDataSource appIdentDataSource, AppIdentTestContext context)
        {
            Console.WriteLine($"{DateTime.Now} Running feature elimination with trashold { context.FeatureSelectionTreshold}.");
            var featureSelector = appIdentService.EliminateCorelatedFeatures(appIdentDataSource, context.FeatureSelectionTreshold, context);

            GridSearchParameterCollection bestParameters;

            if (!File.Exists(context.BestParametersFilePath))
            {
                Console.WriteLine($"{DateTime.Now} Looking for best parameters.");
                bestParameters = appIdentService.RandomForestGetBestParameters(appIdentDataSource, featureSelector, context);
            }
            else
            {
                Console.WriteLine($"{DateTime.Now} Loading best parameters.");
                context.Load <GridSearchParameterCollection>(context.BestParametersFilePath, out bestParameters);
            }

            Console.WriteLine($"{DateTime.Now} Running cross validation.");
            var classificationStatisticsMeter =
                appIdentService.RandomForestCrossValidation(appIdentDataSource, context.FeatureSelector, bestParameters, context.CrossValidationFolds, context);

            Console.WriteLine($"{DateTime.Now} Cross validation results:");
            classificationStatisticsMeter.PrintResults();

            var model = context.Model;

            Console.WriteLine($"{DateTime.Now} Running classification");
            appIdentService.AccordClassify(appIdentDataSource, model, context.FeatureSelector, context);

            Console.WriteLine($"{DateTime.Now} Classification results:");
            classificationStatisticsMeter.PrintResults();
            context.Save();
        }
Ejemplo n.º 2
0
        private static void Epi(AppIdentService appIdentService, AppIdentDataSource appIdentDataSource, AppIdentTestContext context)
        {
            Console.WriteLine($"{DateTime.Now} Running feature elimination with trashold { context.FeatureSelectionTreshold}.");
            var featureSelector = appIdentService.EliminateCorelatedFeatures(appIdentDataSource, context.FeatureSelectionTreshold, context);

            Console.WriteLine($"{DateTime.Now} Running classification");
            var classificationStatisticsMeter = appIdentService.EpiClasify(appIdentDataSource, featureSelector, context);

            Console.WriteLine($"{DateTime.Now} Classification results:");
            classificationStatisticsMeter.PrintResults();
        }
Ejemplo n.º 3
0
        private static void Bayesian(AppIdentService appIdentService, AppIdentDataSource appIdentDataSource, AppIdentTestContext context)
        {
            Console.WriteLine($"{DateTime.Now} Running feature elimination with trashold { context.FeatureSelectionTreshold}.");
            var featureSelector = appIdentService.EliminateCorelatedFeatures(appIdentDataSource, context.FeatureSelectionTreshold, context);

            Console.WriteLine($"{DateTime.Now} Running classification.");
            var classificationStatisticsMeter = appIdentService.BayesianClassify(appIdentDataSource, context.TrainingToVerificationRation, 0.99, context);

            Console.WriteLine($"{DateTime.Now} Classification results:");
            classificationStatisticsMeter.PrintResults();
            context.Save();
        }