コード例 #1
0
        public void DeployAndRun(ILogBuilder log, SpaceModel _space, folderNode folder)
        {
            filter.Deploy(log, folder);

            weightedFeatures = new WeightDictionary(name + "_weg" + filter.limit.ToString(), "weighted features, before filter");
            selectedFeatures = new WeightDictionary(name + "_sel" + filter.limit.ToString(), "selected weighted featyres");

            var selected = filter.SelectFeatures(_space, log, folder, weightedFeatures);

            foreach (var pair in selected)
            {
                selectedFeatures.AddEntry(pair.Key, pair.Value);
            }

            weightedFeatures.Save(folder, log, WeightDictionary.GetDictionaryFilename(weightedFeatures.name, folder));
            selectedFeatures.Save(folder, log, WeightDictionary.GetDictionaryFilename(selectedFeatures.name, folder));
        }
コード例 #2
0
        /// <summary>
        /// Constructs global weight fictionary using global elements
        /// </summary>
        /// <param name="terms">The terms.</param>
        /// <param name="space">The space.</param>
        /// <param name="label">The label.</param>
        /// <returns></returns>
        public WeightDictionary GetElementFactors(IEnumerable <string> terms, SpaceModel space, SpaceLabel label = null)
        {
            var output = new WeightDictionary();


            output.name = GetSignature() + "_globalOnly";

            foreach (String term in terms)
            {
                Double score = GetElementFactor(term, space, label);
                WeightDictionaryEntry entry = new WeightDictionaryEntry(term, score);

                output.AddEntry(entry, true);
            }

            output.description = "Global weights for [" + output.Count + "] terms.";

            return(output);
        }
コード例 #3
0
        /// <summary>
        /// Builds dictionary of global element factors
        /// </summary>
        /// <param name="terms">The terms.</param>
        /// <param name="space">The space.</param>
        /// <param name="label">The label.</param>
        /// <returns></returns>
        public WeightDictionary GetElementFactors(IEnumerable <String> terms, SpaceModel space, SpaceLabel label = null)
        {
            WeightDictionary output = new WeightDictionary();

            switch (resultType)
            {
            case FunctionResultTypeEnum.numeric:
                output.nDimensions = 1;
                break;

            case FunctionResultTypeEnum.numericVectorForMultiClass:
                output.nDimensions = space.labels.Count;
                break;
            }

            foreach (String term in terms)
            {
                output.AddEntry(GetElementFactorEntry(term, space, label));
            }

            return(output);
        }