/// <summary>
        /// Merges the ds rankings - searches folder for specified input names or search pattern
        /// </summary>
        /// <param name="folder">The folder.</param>
        /// <param name="inputNames">The input names.</param>
        /// <param name="output">The output.</param>
        /// <param name="searchPattern">The search pattern.</param>
        /// <returns></returns>
        public static FeatureVectorDictionaryWithDimensions MergeDSRankings(folderNode folder, String inputNames, ILogBuilder output, String searchPattern = "DS_*_ranking.xml")
        {
            List <string> filepaths = folder.GetOrFindFiles(inputNames, searchPattern);

            DocumentSelectResult resultOut = new DocumentSelectResult();

            List <DocumentSelectResult> results = new List <DocumentSelectResult>();
            List <String> existingNames         = new List <string>();

            String tmpOutputName = "";

            foreach (var fp in filepaths)
            {
                var    lr = DocumentSelectResult.LoadFromFile(fp, output);
                String fn = Path.GetFileNameWithoutExtension(fp);
                if (existingNames.Contains(lr.name))
                {
                    lr.name = fn;
                }
                existingNames.Add(lr.name);

                results.Add(lr);
                tmpOutputName += lr.name;
            }


            FeatureVectorDictionaryWithDimensions featureDict = DocumentRankingExtensions.TransformToFVDictionary(results);

            return(featureDict);
        }
예제 #2
0
        /// <summary>
        /// Fusions the specified operation.
        /// </summary>
        /// <param name="scoreSet">The score set.</param>
        /// <param name="operation">The operation.</param>
        /// <param name="doRankingFusion">if set to <c>true</c> [do ranking fusion].</param>
        /// <param name="doDomainNormalization">if set to <c>true</c> [do domain normalization].</param>
        /// <param name="log">The log.</param>
        /// <returns></returns>
        public static DocumentSelectResult Fusion(this IEnumerable <DocumentSelectResult> scoreSet, operation operation, Boolean doRankingFusion, Boolean doDomainNormalization, ILogBuilder log)
        {
            List <DocumentSelectResultEntry> fusioned = null;


            if (doDomainNormalization)
            {
                log.log("Performing domain-level normalization over [" + scoreSet.Count() + "] document score sets");
                foreach (DocumentSelectResult set in scoreSet)
                {
                    DocumentRankingExtensions.NormalizeWithinDomain(set.items, log);
                }
            }



            if (doRankingFusion)
            {
                log.log("Ranking fusion over [" + scoreSet.Count() + "] document score sets");

                fusioned = rankFusion(scoreSet.Select(x => x.items), log);
            }
            else
            {
                log.log("Score fusion over [" + scoreSet.Count() + "] document score sets");

                fusioned = ScoreFusion(scoreSet.Select(x => x.items), operation, log);
            }


            DocumentSelectResult output = new DocumentSelectResult(); // scoreSet.First();

            output.name        = "ScoreFusionBy" + operation.ToString();
            output.description = "Sets fusioned: ";

            foreach (var s in scoreSet)
            {
                output.description = s.name + " ";
            }

            output.items.AddRange(fusioned);


            return(output);
        }