Beispiel #1
0
        /// <summary>
        /// Runs a custom weight table construction procedure over currently set main context
        /// </summary>
        /// <param name="loadConfig">The load configuration.</param>
        /// <param name="outputName">Name of the output.</param>
        /// <param name="skipIfExists">if set to <c>true</c> [skip if exists].</param>
        /// <remarks>
        /// It will load weight table constructor configuration, check if there is already a table and rebuild it
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase" />
        public void aceOperation_runWTConstruct(
            [Description("--")] String loadConfig    = "*",
            [Description("--")] String outputName    = "*",
            [Description("--")] Boolean skipIfExists = true)
        {
            if (loadConfig != "*")
            {
                wtConstructor.aceOperation_runLoad(loadConfig, true);
            }

            SetupWeightTableConstruction setup = wtConstructor.data.CloneViaXML();

            setup.LearnFrom(mainContext.procedureCommons);

            if (outputName != "*")
            {
                setup.OutputFilename = outputName;
            }
            setup.skipIfExisting = skipIfExists;



            ProceduralFolderFor <ProcedureForWTConstruction, SetupWeightTableConstruction, OperationContext, ExperimentModelExecutionContext> procedures
                = new ProceduralFolderFor <ProcedureForWTConstruction, SetupWeightTableConstruction, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent);

            proceduralStack.Push(procedures);

            //contextSet = procedures.Execute(mainContext.ParallelThreads, output, contextSet, mainContext);
        }
Beispiel #2
0
        /// <summary>Classification procedure with document selection using precompiled ranking file</summary>
        /// <remarks><para>Loads external document selection score table, applies query filter over input dataset and performs classification evaluation</para></remarks>
        /// <param name="outputName">Name for result</param>
        /// <param name="DSFilename">Name of Document Selection ranking file</param>
        /// <param name="DSCount">Number of documents to be selected</param>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_runClassificationWithDS(
            [Description("Name for result")] String outputName = "word",
            [Description("Name of Document Selection ranking file")] String DSFilename = "",
            [Description("Number of documents to be selected")] Int32 DSCount          = 5,
            [Description("Query options")]  DocumentSelectQueryOptions options         = DocumentSelectQueryOptions.none,
            [Description("Skip existing experiment")]  Boolean skipExisting            = true)
        {
            SetupDocumentClassification setup = docClassification.data.CloneViaXML();

            setup.LearnFrom(mainContext.procedureCommons);

            setup.OutputFilename = outputName;

            setup.documentSelectQuery = docSelection.data.ranking.query.CloneViaXML();

            //docClassification.data.documentSelectQuery.

            // setup.documentSelectQuery = docSelection.data.ranking.query.CloneViaXML();

            setup.documentSelectQuery.PrecompiledScoresFilename = DSFilename;

            setup.documentSelectQuery.SizeLimit = DSCount;

            if (options != DocumentSelectQueryOptions.none)
            {
                setup.documentSelectQuery.options = options;
            }

            //setup.reportOptions = mainContext.reportOptions;

            ProceduralFolderFor <ProcedureClassification, SetupDocumentClassification, OperationContext, ExperimentModelExecutionContext> procedures
                = new ProceduralFolderFor <ProcedureClassification, SetupDocumentClassification, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent);

            //  contextSet = procedures.Execute(mainContext.ParallelThreads, output, contextSet, mainContext);

            proceduralStack.Push(procedures);
        }
Beispiel #3
0
        /// <summary>
        /// Combines two or more precompiled document selection ranks
        /// </summary>
        /// <param name="inputNames">comma separated list of DS rank file names, leave empty if search pattern is used</param>
        /// <param name="searchPattern">file search pattern to select source files, leave * if no file search should be performed</param>
        /// <param name="compression">vector dimensions compression operation, i.e. how scores should be combined into single dimension</param>
        /// <param name="outputName">Name of the output.</param>
        /// <param name="doRankingFusion">if set to <c>true</c> [do ranking fusion].</param>
        /// <remarks>
        /// What it will do?
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase" />
        public void aceOperation_makeCombineDSRanks(
            [Description("Space separated list of DS rank file names, leave empty if search pattern is used")] String inputNames = " ",
            [Description("vector dimensions compression operation, i.e. how scores should be combined into single dimension")] operation compression = operation.avg,
            [Description("Name of output Document Selection Rank file. Leave * to assign name as combination of input files")] String outputName     = "*",
            [Description("If true, it will perform ranking fusion instead of simple score fusion")] Boolean doRankingFusion = true,
            [Description("file search pattern to select source files, leave * if no file search should be performed")] String searchPattern = "*"
            )
        {
            SetupDocumentSelection setup = docSelection.data.CloneViaXML();

            ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext> procedures
                = new ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent);

            outputName = DocumentSelectResult.CheckAndMakeFilename(outputName);

            foreach (var p in procedures)
            {
                p.Open();


                DocumentSelectResult resultOut = new DocumentSelectResult();

                var fl = mainContext.resourceProvider.GetResourceFiles(inputNames, p.fold);

                List <DocumentSelectResult> results = DocumentRankingExtensions.LoadDSRankings(fl, p.notes);

                resultOut = results.Fusion(compression, doRankingFusion, true, p.notes);

                String pt = mainContext.resourceProvider.SetResourceFilePath(outputName, p.fold);

                resultOut.saveObjectToXML(pt);

                p.Close();
            }
        }
Beispiel #4
0
        /// <summary>Generates reports on precompiled resources for each fold</summary>
        /// <remarks><para>What it will do?</para></remarks>
        /// <param name="word">--</param>
        /// <param name="steps">--</param>
        /// <param name="debug">--</param>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_runReportOnResources(
            [Description("--")] String word   = "word",
            [Description("--")] Int32 steps   = 5,
            [Description("--")] Boolean debug = true)
        {
            SetupDocumentSelection setup = docSelection.data.CloneViaXML();

            ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext> procedures
                = new ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent);


            foreach (var p in procedures)
            {
                p.Open();


                //ExperimentDataSetFoldContextPair<OperationContext> o_pair = new ExperimentDataSetFoldContextPair<OperationContext>(p.fold, new OperationContext());
                //o_pair.context.DeployDataSet(p.fold, output);
                FeatureVectorDictionaryWithDimensions dictWithDim = DocumentRankingExtensions.MergeDSRankings(p.fold_notes.folder, "", output, "*_ranking.xml");

                var t = dictWithDim.Values.MakeTable(dictWithDim.dimensions, "Rankings", p.description, mainContext.truthTable.label_index);

                p.fold_notes.SaveDataTable(t);
                //t.GetReportAndSave(p.fold_notes.folder, imbACE.Core.application.)


                var dictFWT = WeightDictionaryTools.MergeWeightDictionaries(p.fold_notes.folder, "", output, "*_wt.xml");

                var tfw = dictFWT.Values.MakeTable(dictFWT.dimensions, "WeightTable", p.description);

                p.fold_notes.SaveDataTable(tfw);

                p.Close();
            }
        }
Beispiel #5
0
        /// <summary>It will perform CWP analysis over specified dataset</summary>
        /// <remarks><para>What it will do?</para></remarks>
        /// <param name="dataset">--</param>
        /// <param name="steps">--</param>
        /// <param name="debug">--</param>
        /// <seealso cref="aceOperationSetExecutorBase"/>
        public void aceOperation_runCWPAnalysis(
            [Description("--")] String dataset = "word",
            [Description("--")] Int32 steps    = 5,
            [Description("--")] Boolean debug  = true)
        {
            SetupFeatureCWPAnalysis setup = analysis.data.CloneViaXML(); //docClassification.data.CloneViaXML();

            setup.LearnFrom(mainContext.procedureCommons);


            //setup.reportOptions = mainContext.reportOptions;

            ProceduralFolderFor <ProcedureFeatureCWPAnalysis, SetupFeatureCWPAnalysis, OperationContext, ExperimentModelExecutionContext> procedures
                = new ProceduralFolderFor <ProcedureFeatureCWPAnalysis, SetupFeatureCWPAnalysis, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent);

            //  contextSet = procedures.Execute(mainContext.ParallelThreads, output, contextSet, mainContext);

            proceduralStack.Push(procedures);
        }
Beispiel #6
0
        /// <summary>
        /// Creates document ranking score table that afterwards may be consumed by document selection procedure
        /// </summary>
        /// <param name="loadConfig">The load configuration.</param>
        /// <param name="outputName">Name of the output.</param>
        /// <param name="skipIfExists">if set to <c>true</c> [skip if exists].</param>
        /// <remarks>
        /// It will deploy current document selector, evaluate folds and create the ranking tables?
        /// </remarks>
        /// <seealso cref="aceOperationSetExecutorBase" />
        public void aceOperation_runCreateDSRanks(
            [Description("--")] String loadConfig    = "*",
            [Description("--")] String outputName    = "*",
            [Description("--")] Boolean skipIfExists = true,
            [Description("--")]  String description  = " ")
        {
            if (loadConfig != "*")
            {
                docSelection.aceOperation_runLoad(loadConfig, true);
            }
            SetupDocumentSelection setup = docSelection.data.CloneViaXML();

            setup.descriptionAppendix.Add(description);
            setup.LearnFrom(mainContext.procedureCommons);

            if (outputName != "*")
            {
                setup.OutputFilename = outputName;
            }
            setup.skipIfExisting = skipIfExists;

            //setup.reportOptions = mainContext.reportOptions;

            ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext> procedures
                = new ProceduralFolderFor <ProcedureCreateScoreSet, SetupDocumentSelection, OperationContext, ExperimentModelExecutionContext>(mainContext.folds, setup, mainContext.notes, parent);

            proceduralStack.Push(procedures);

            // contextSet = procedures.Execute(mainContext.ParallelThreads, output, contextSet, mainContext);
        }