Exemple #1
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();
            }
        }
Exemple #2
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();
            }
        }
Exemple #3
0
        public override ExperimentDataSetFoldContextPair <OperationContext> Execute(ILogBuilder logger, OperationContext executionContextMain = null, ExperimentModelExecutionContext executionContextExtra = null)
        {
            ExperimentDataSetFoldContextPair <OperationContext> output = new ExperimentDataSetFoldContextPair <OperationContext>(fold, executionContextMain);

            Open();

            Boolean skip = false;

            String fn = setup.OutputFilename;

            // String p_m = fold_notes.folder.pathFor(fn.ensureEndsWith("_ranking.xml"), imbSCI.Data.enums.getWritableFileMode.none);



            if (setup.skipIfExisting)
            {
                String f_n = DocumentSelectResult.CheckAndMakeFilename(fn);

                f_n  = executionContextExtra.resourceProvider.GetResourceFile(f_n, fold); // .folder.findFile(f_n, SearchOption.AllDirectories);
                skip = DocumentRankingExtensions.EvaluateSavedDSRanking(f_n, logger, 0.01);
            }

            if (!skip)
            {
                output.context.DeployDataSet(fold, logger);


                //if (!output.context.IsTextRendered)
                //{
                entityOperation.TextRendering(output.context, notes);

                //entityOperation.TextPreblendFilter(output.context, notes);

                //entityOperation.TextBlending(output.context, notes);
                // }

                //if (!output.context.spaceModel.IsModelReady)
                //{

                corpusOperation.SpaceModelPopulation(output.context, notes);

                corpusOperation.SpaceModelCategories(output.context, notes);


                corpusOperation.FeatureSelection(output.context, notes, requirements.MayUseSelectedFeatures);

                corpusOperation.VectorSpaceConstruction(output.context, notes, requirements.MayUseSpaceModelCategories);



                //    }

                logger.log("Document selection computation");


                DocumentSelectResult drmContext = output.context.PrepareContext(ranking, fold_notes.folder, logger);
                drmContext = ranking.ExecuteEvaluation(drmContext, logger);



                foreach (String l in setup.descriptionAppendix)
                {
                    drmContext.description += Environment.NewLine + l;
                }



                fn = DocumentSelectResult.CheckAndMakeFilename(fn);
                fn = executionContextExtra.resourceProvider.SetResourceFilePath(fn, fold);
                // f_n = executionContextExtra.resourceProvider.folder.pathFor(f_n, imbSCI.Data.enums.getWritableFileMode.overwrite, "");
                String xmlModel = objectSerialization.ObjectToXML(drmContext);
                File.WriteAllText(fn, xmlModel);


                //corpusOperation.weightModel.PrepareTheModel(output.context.spaceModel);


                /*
                 * var dataset = corpusOperation.weightModel.SaveModelDataSet();
                 *
                 *
                 * String fn = setup.OutputFilename;
                 * String p_m = notes.folder.pathFor(fn.ensureEndsWith("_model.xml"), imbSCI.Data.enums.getWritableFileMode.autoRenameThis);
                 *
                 * String p_d = notes.folder.pathFor(fn.ensureEndsWith("_data.xml"), imbSCI.Data.enums.getWritableFileMode.autoRenameThis);
                 *
                 *
                 * String xmlModel = objectSerialization.ObjectToXML(setup.corpusMethod.weightModel);
                 *
                 *
                 * String xmlData = objectSerialization.ObjectToXML(dataset);
                 *
                 *
                 * File.WriteAllText(p_m, xmlModel);
                 *
                 * File.WriteAllText(p_d, xmlData);
                 *
                 * /*
                 * corpusOperation.weightModel.saveObjectToXML(
                 *  notes.folder.pathFor(setup.OutputFilename.ensureEndsWith("_model.xml"), imbSCI.Data.enums.getWritableFileMode.autoRenameThis, "Weight model [" + corpusOperation.weightModel.shortName + "]"));
                 *
                 * dataset.saveObjectToXML(notes.folder.pathFor(setup.OutputFilename.ensureEndsWith("_data.xml"), imbSCI.Data.enums.getWritableFileMode.autoRenameThis, "Weight model [" + corpusOperation.weightModel.shortName + "]"));
                 */



                OperationContextReport reportOperation = new OperationContextReport();
                reportOperation.DeploySettingsBase(notes);

                reportOperation.GenerateReports(output.context, setup.reportOptions, notes);
            }

            Close();

            return(output);
        }