예제 #1
0
        private static void Evaluation()
        {
            Dictionary <string, List <CsccContextInfo> >[] trainingModels;

            var trainingModel = ContextModel <CsccContextInfo> .Load(Path.Combine(Model.GetModelDirectory(), "training_cscc"));

            var namespaces = trainingModel.Contexts.ToList();

            namespaces.Sort((a, b) => b.Value.Count.CompareTo(a.Value.Count));

            trainingModels = new Dictionary <string, List <CsccContextInfo> > [10];

            for (int i = 0; i < 10; i++)
            {
                trainingModels[i] = new Dictionary <string, List <CsccContextInfo> >();
            }

            for (int i = 0; i < namespaces.Count / 2; i++)
            {
                trainingModels[i % 10].Add(namespaces[i].Key, namespaces[i].Value);
                trainingModels[i % 10].Add(namespaces[namespaces.Count - i - 1].Key, namespaces[namespaces.Count - i - 1].Value);
            }

            var result = 0.0;

            foreach (var training in trainingModels)
            {
                result += new CsccEvaluationModel(training).Evaluate().AverageFmeasure;
                Console.WriteLine(result);
            }

            Console.WriteLine(result / 10);
            Console.ReadKey();
        }
예제 #2
0
        private static void CrossValidate()
        {
            var evaluationModel = new CsccEvaluationModel(LoadModel());
            var result          = evaluationModel.Evaluate();

            Console.WriteLine(result);
            Console.ReadKey();
        }
예제 #3
0
파일: Model.cs 프로젝트: godtopus/GeneCSCC
        public static void EvalCscc()
        {
            //var usageContexts = CombineCscc();
            //var models = MostCommon(usageContexts);
            var models = MostCommon(LoadCsccTrainingModel());

            foreach (var model in models)
            {
                var evaluationModel = new CsccEvaluationModel(model);
                Console.WriteLine(evaluationModel.Evaluate());
            }
            Console.ReadKey();
        }