예제 #1
0
        public static bool Test(this IPatternTest test, double[] distribution, InstanceModel model, Feature classFeature)
        {
            var pattern = new EmergingPattern(model, classFeature, 0);

            pattern.Counts     = distribution;
            pattern.Supports   = EmergingPatternCreator.CalculateSupports(distribution, classFeature);
            pattern.ClassValue = pattern.Supports.ArgMax();
            return(test.Test(pattern));
        }
예제 #2
0
        public void UpdateCountsAndSupport(IEnumerable <Instance> instances, Feature classFeature)
        {
            var matchCount = new double[(classFeature as NominalFeature).Values.Length];

            foreach (var instance in instances)
            {
                if (IsMatch(instance))
                {
                    matchCount[(int)instance[classFeature]]++;
                }
            }

            Counts   = matchCount;
            Supports = EmergingPatternCreator.CalculateSupports(matchCount, classFeature);
        }