Exemplo n.º 1
0
        public static void WriteFeatureStrings(
            TextWriter writer, Classifier classifier, FeatureEncoder featureEncoder,
            EncodingResult encodingResult = null)
        {
            var acceptingFeature      = classifier.GetAllAcceptingFeatureStrings(featureEncoder);
            var rejectingFeatures     = classifier.GetAllRejectingFeatureStrings(featureEncoder);
            var acceptingVectorCounts = encodingResult != null
                    ? classifier.CountAcceptedVectorsOfEachGroup(encodingResult)
                    : Enumerable.Repeat(-1, acceptingFeature.Count).ToList();

            var rejectingVectorCounts = encodingResult != null
                    ? classifier.CountRejectedVectorsOfEachGroup(encodingResult)
                    : Enumerable.Repeat(-1, rejectingFeatures.Count).ToList();

            writer.WriteLine("################ Accepting Features ################");
            for (var i = 0; i < acceptingFeature.Count; i++)
            {
                writer.WriteLine("######## Group: " + (i + 1) + " ("
                                 + acceptingVectorCounts[i] + ") ########");
                writer.WriteLine(Beautify(classifier.GroupPaths[i]));
                if (acceptingVectorCounts[i] != 0)
                {
                    writer.WriteLine();
                    foreach (var featureString in acceptingFeature[i])
                    {
                        writer.WriteLine(Beautify(featureString));
                    }
                }
            }
            writer.WriteLine("################ Rejecting Features ################");
            for (var i = 0; i < rejectingFeatures.Count; i++)
            {
                writer.WriteLine("######## Group: " + (i + 1) + " ("
                                 + rejectingVectorCounts[i] + ") ########");
                writer.WriteLine(Beautify(classifier.GroupPaths[i]));
                if (rejectingVectorCounts[i] != 0)
                {
                    writer.WriteLine();
                    foreach (var featureString in rejectingFeatures[i])
                    {
                        writer.WriteLine(Beautify(featureString));
                    }
                }
            }
            writer.Flush();
        }
Exemplo n.º 2
0
 public static void WriteFeatureStrings(
         TextWriter writer, Classifier classifier, FeatureEncoder featureEncoder,
         EncodingResult encodingResult = null) {
     var acceptingFeature = classifier.GetAllAcceptingFeatureStrings(featureEncoder);
     var rejectingFeatures = classifier.GetAllRejectingFeatureStrings(featureEncoder);
     var acceptingVectorCounts = encodingResult != null
             ? classifier.CountAcceptedVectorsOfEachGroup(encodingResult)
             : Enumerable.Repeat(-1, acceptingFeature.Count).ToList();
     var rejectingVectorCounts = encodingResult != null
             ? classifier.CountRejectedVectorsOfEachGroup(encodingResult)
             : Enumerable.Repeat(-1, rejectingFeatures.Count).ToList();
     writer.WriteLine("################ Accepting Features ################");
     for (var i = 0; i < acceptingFeature.Count; i++) {
         writer.WriteLine("######## Group: " + (i + 1) + " ("
                          + acceptingVectorCounts[i] + ") ########");
         writer.WriteLine(Beautify(classifier.GroupPaths[i]));
         if (acceptingVectorCounts[i] != 0) {
             writer.WriteLine();
             foreach (var featureString in acceptingFeature[i]) {
                 writer.WriteLine(Beautify(featureString));
             }
         }
     }
     writer.WriteLine("################ Rejecting Features ################");
     for (var i = 0; i < rejectingFeatures.Count; i++) {
         writer.WriteLine("######## Group: " + (i + 1) + " ("
                          + rejectingVectorCounts[i] + ") ########");
         writer.WriteLine(Beautify(classifier.GroupPaths[i]));
         if (rejectingVectorCounts[i] != 0) {
             writer.WriteLine();
             foreach (var featureString in rejectingFeatures[i]) {
                 writer.WriteLine(Beautify(featureString));
             }
         }
     }
     writer.Flush();
 }