コード例 #1
0
        public void HeatMapTest()
        {
            HeatMapModel heatMap = HeatMapModel.CreateRandom(10, 10, 0, 100);

            folderResults.SaveText(heatMap.GetDataTable("HeatMap_Random", "").textTable(4), "HeatMapData.txt", imbSCI.Data.enums.getWritableFileMode.overwrite, "Values from random heat map");

            HeatMapRender heatMapRender = new HeatMapRender();

            Svg.SvgDocument svg = heatMapRender.RenderAndSave(heatMap, folderResults.pathFor("heatmap_render.svg", imbSCI.Data.enums.getWritableFileMode.overwrite));

            var jpg = folderResults.pathFor("heatmap_render.jpg", imbSCI.Data.enums.getWritableFileMode.overwrite);

            svg.SaveJPEG(jpg);


            heatMapRender = new HeatMapRender();
            heatMapRender.style.LowColor  = Color.Blue;
            heatMapRender.style.HighColor = Color.Red;

            Svg.SvgDocument svgbr = heatMapRender.RenderAndSave(heatMap, folderResults.pathFor("heatmap_render_bluered.svg", imbSCI.Data.enums.getWritableFileMode.overwrite));

            jpg = folderResults.pathFor("heatmap_render_bluered.jpg", imbSCI.Data.enums.getWritableFileMode.overwrite);


            svgbr.SaveJPEG(jpg);
        }
コード例 #2
0
        public void Publish(Dictionary <HtmlNode, HtmlSourceAndUrl> documentNodeDictionary, folderNode folderWithResults, List <HtmlNode> reportOn = null)
        {
            if (reportOn == null)
            {
                reportOn = GetDocuments();
            }

            folderWithResults.generateReadmeFiles(null);

            builderForText reporter = new builderForText();

            foreach (var item in items)
            {
                if (item.IsRelatedTo(reportOn))
                {
                    reporter.AppendLine("Pair [" + items.IndexOf(item) + "]");
                    item.Publish(documentNodeDictionary, folderWithResults, reporter);
                }
            }

            Report(StructureSimilarityRange, reporter, "Structure similarity", "SS");
            Report(ContentSimilarityRange, reporter, "Content similarity", "CS");

            String reporterPath = folderWithResults.pathFor("report.txt");

            File.WriteAllText(reporterPath, reporter.GetContent());



            DataSet output = PublishDataSet(documentNodeDictionary, reportOn);

            HeatMapRender hmRender = new HeatMapRender();

            foreach (DataTable table in output.Tables)
            {
                HeatMapModel heatMap = new HeatMapModel(table);


                var heatMapSVG = hmRender.Render(heatMap, folderWithResults.pathFor(table.TableName + ".svg", imbSCI.Data.enums.getWritableFileMode.overwrite, "Headmap render for " + table.TableName));
                heatMapSVG.SaveJPEG(folderWithResults.pathFor(table.TableName + ".jpg", imbSCI.Data.enums.getWritableFileMode.overwrite, "Headmap render for " + table.TableName));
            }

            output.GetReportAndSave(folderWithResults, null, "");
        }
コード例 #3
0
        private static imbSCI.Core.math.range.matrix.HeatMapModel PublishMatrix(ILogBuilder log, folderNode folder, string name_selected, List <WeightDictionary> sfs)
        {
            imbSCI.Core.math.range.matrix.HeatMapModel model = sfs.GetHeatMapMatrix();
            model.DetectMinMax();

            model.GetDataTable(name_selected, "Overlaping terms and their frequencies").GetReportAndSave(folder, null, name_selected);

            try
            {
                HeatMapRender heatMapRender = new HeatMapRender();
                heatMapRender.style.accronimLength = 3;
                heatMapRender.style.BaseColor      = Color.Black;
                heatMapRender.style.fieldHeight    = 50;
                heatMapRender.style.fieldWidth     = 50;

                heatMapRender.RenderAndSave(model, folder.pathFor(name_selected, imbSCI.Data.enums.getWritableFileMode.overwrite, "Heat map showing overlaping terms and their frequencies"));
            }
            catch (Exception ex)
            {
                log.log(ex.Message);
            }

            return(model);
        }
コード例 #4
0
        public override ExperimentDataSetFoldContextPair <OperationContext> Execute(ILogBuilder logger, OperationContext executionContextMain = null, ExperimentModelExecutionContext executionContextExtra = null)
        {
            ExperimentDataSetFoldContextPair <OperationContext> output = new ExperimentDataSetFoldContextPair <OperationContext>(fold, executionContextMain);

            Open();


            output.context.DeployDataSet(fold, logger);

            entityOperation.TextRendering(output.context, notes, requirements.MayUseTextRender);

            corpusOperation.SpaceModelPopulation(output.context, notes);

            corpusOperation.SpaceModelCategories(output.context, notes);


            FeatureFilterAndWeightModelAnalysis fwmAnalysis = new FeatureFilterAndWeightModelAnalysis(output.context.spaceModel, setup.WeightModels, setup.FilterModels);



            corpusOperation.FeatureSelection(output.context, notes);


            corpusOperation.VectorSpaceConstruction(output.context, notes, true);

            corpusOperation.FeatureVectorConstruction(output.context, notes);



            fwmAnalysis.ExecuteAnalysis(output.context, logger, fold_notes.folder_feature);


            //if (setup.tasks.HasFlag(CWPAnalysisReportsEnum.reportTermDistribution))
            //{

            //    var model = output.context.spaceModel.categories.GetHeatMapMatrix();
            //    HeatMapRender heatMapRender = new HeatMapRender();
            //    heatMapRender.RenderAndSave(model, fold_notes.folder_feature.pathFor("category_overlap_beforeFS", imbSCI.Data.enums.getWritableFileMode.overwrite, "Heat map showing overlaping terms and their frequencies, before feature selection"));

            //}



            if (setup.tasks.HasFlag(CWPAnalysisReportsEnum.reportDatasetStructure))
            {
                DatasetStructureReport datasetStructureReport = DatasetStructureReport.MakeStructureReport(fold, fold.name);

                datasetStructureReport.Compute();
                datasetStructureReport.Publish(fold_notes.folder, true, true, true);
            }

            if (setup.tasks.HasFlag(CWPAnalysisReportsEnum.reportDatasetMetrics))
            {
                ContentAnalytics contentAnalytics = new ContentAnalytics(fold_notes.folder_entity);

                var Metrics = contentAnalytics.ProduceMetrics(fold.name, fold, output.context, logger);
                Metrics.ReportHTMLTags(fold_notes.folder_entity, fold.name);
                Metrics.ReportSample(fold_notes.folder_entity, fold.name, 1000);
                Metrics.ReportTokens(fold_notes.folder_corpus, fold.name, 1000);
                Metrics.GetDataTable(fold_notes.name).GetReportAndSave(fold_notes.folder_entity, null, "Dataset");
            }


            if (setup.tasks.HasFlag(CWPAnalysisReportsEnum.reportTermDistribution))
            {
                imbSCI.Core.math.range.matrix.HeatMapModel model = output.context.spaceModel.categories.GetHeatMapMatrix();


                model.GetDataTable("CategoryFreqOverlap", "Overlaping terms and their frequencies").GetReportAndSave(fold_notes.folder, null, "CategoryOverlap");

                try
                {
                    HeatMapRender heatMapRender = new HeatMapRender();
                    heatMapRender.style.accronimLength = 3;
                    heatMapRender.style.BaseColor      = Color.Black;
                    heatMapRender.style.fieldHeight    = 50;
                    heatMapRender.style.fieldWidth     = 50;
                    var svg = heatMapRender.Render(model);
                    svg.Save(fold_notes.folder_feature.pathFor("category_overlap_afterFS.svg", imbSCI.Data.enums.getWritableFileMode.overwrite, "Heat map showing overlaping terms and their frequencies"));
                    svg.SaveJPEG(fold_notes.folder_feature.pathFor("category_overlap_afterFS.jpg", imbSCI.Data.enums.getWritableFileMode.overwrite, "Heat map showing overlaping terms and their frequencies"));
                }
                catch (Exception ex)
                {
                    logger.log(ex.Message);
                }

                List <histogramModel> models = new List <histogramModel>();

                foreach (var cat in output.context.spaceModel.categories)
                {
                    var hist = cat.GetHistogram(20);
                    models.Add(hist);
                    DataTable dt_hist = hist.GetDataTableForFrequencies();

                    dt_hist.GetReportAndSave(fold_notes.folder, null, "histogram_table_" + cat.name);

                    string h_p = fold_notes.folder_feature.pathFor(cat.name + "_term_distribution.svg", imbSCI.Data.enums.getWritableFileMode.overwrite, "Histogram with term distribution for category [" + cat.name + "]");


                    // File.WriteAllText(h_p, hist.GetSVGChart());
                }

                models.BlendHistogramModels(fold.name).GetReportAndSave(fold_notes.folder, null, "histogram_all");
            }

            if (setup.tasks.HasFlag(CWPAnalysisReportsEnum.reportCWPAnalytics))
            {
                analysis.Prepare(output.context.spaceModel, logger);

                analysis.Analysis(fold_notes);
            }


            Close();

            return(output);
        }