public void RefineStyle(classificationReportStyleDefinition style, IEnumerable <classificationReportExpanded> reports) { local_style = style.CloneViaXML(); if (local_style.AutoNewDataColumns || local_style.AutoHideDataColumnsWithSameData) { aceDictionarySet <String, String> knownValues = new aceDictionarySet <string, string>(); var expData = reports.Select(x => x.data); foreach (var cd in expData) { foreach (var cl in cd) { if (local_style.AutoNewDataColumns) { if (!local_style.dataColumns.Any(x => x.key == cl.key)) { local_style.dataColumns.Add(cl); } } if (!knownValues[cl.key].Contains(cl.value)) { knownValues.Add(cl.key, cl.value); } } } if (local_style.AutoHideDataColumnsWithSameData) { List <String> columnsToHide = new List <string>(); foreach (var pair in knownValues) { if (pair.Value.Count < 2) { columnsToHide.Add(pair.Key); } else if (pair.Value.Count == 0) { columnsToHide.Add(pair.Key); } } var toRemove = local_style.dataColumns.Where(x => columnsToHide.Contains(x.key)).ToList(); toRemove.ForEach(x => local_style.dataColumns.Remove(x)); } } }
public static classificationReportStyleDefinition GetDefault(ExperimentRunNameGroups _groups = null) { classificationReportStyleDefinition output = new classificationReportStyleDefinition(); if (_groups == null) { _groups = new ExperimentRunNameGroups(); _groups.CheckForDefault(); } output.layerNeedleByName.Add("Trashold", @"([\d]+)#([\d]*)", "Experiments with document selection controled by trashold"); output.groups = _groups; output.dataFlags.Add("Render", "LinkText,LinkContent,LINCAPT", "A", "Content from link anchor text"); output.dataFlags.Add("Render", "Tokens,TKN", "TKN", "Tokens extracted from URL"); output.dataFlags.Add("Render", "PageText,PageContent", "B", "Page body text, page description and title tag"); output.dataFlags.Add("Scope", "category,InCategory,Category", "C", "Items in the category"); output.dataFlags.Add("Scope", "page", "P", "Pages"); output.dataFlags.Add("Scope", "Dataset,InDataset", "D", "Items in the complete dataset"); output.dataFlags.Add("Scope", "Link", "L", "Links"); output.dataFlags.Add("Function", "selfCentric", "SC", "Compares items with web site / document set"); output.dataFlags.Add("Function", "Inverse", "I", "Score value is inversed at the end of computation"); output.dataFlags.Add("Function", "ENT", "*", "Score value is inversed at the end of computation"); output.dataFlags.Add("Function", "LNG", "*", "Score value is inversed at the end of computation"); output.dataFlags.Add("Function", "DST", "*", "Score value is inversed at the end of computation"); output.dataFlags.Add("Function", "Divergence", "DIV", "Promotes diversity, items are at greater distance in vector space"); output.dataFlags.Add("Function", "Convergence", "CON", "Promotes convergence of the items, ones at smaller distance are promoted"); output.dataFlags.Add("Function", "Variance", "VAR", "Promotes variance of the items"); output.dataFlags.Add("Function", "Offset", "OFF", "Measures difference between similarity with true label and average similariy with other labels"); //output.dataColumns.Add("Render", "", "Source of the rendered"); //output.dataColumns.Add("Scope", "", "Scope of analysis, performed by the function"); //output.dataColumns.Add("Function", "", "Function performing the analysus"); //output.dataColumns.Add("WeightModel", "", "Model used for term weighting"); return(output); }
/// <summary> /// Builds the report space from report collection /// </summary> /// <param name="reports">The reports.</param> /// <param name="dataset">The dataset.</param> /// <param name="SELECT_REPORT_NAME_PARTS">The select report name parts.</param> /// <returns></returns> public static classificationReportSpace BuildReportSpace(IEnumerable <classificationReportExpanded> reports, String dataset, Regex SELECT_REPORT_NAME_PARTS, classificationReportStyleDefinition style, String _layer = "") { classificationReportSpace space = new classificationReportSpace() { dataset = dataset, name = _layer.or(classificationReportExpanded.LAYER_MAIN) }; foreach (var rep in reports) { String nm = rep.Name; if (nm.StartsWith(dataset)) { rep.data.Add("Dataset", dataset, "Confirmed dataset name"); nm = nm.Substring(dataset.Length); } Match mc = SELECT_REPORT_NAME_PARTS.Match(nm); if (mc.Groups.Count > 1) { String runName = mc.Groups[1].Value.Trim('_'); Int32 size = 0; if (mc.Groups.Count > 2) { String sizeString = mc.Groups[2].Value; if (sizeString.isNullOrEmpty()) { size = 0; } else { size = Int32.Parse(sizeString); } } runName = style.dataFlags.ProcessRunName(runName, rep.data); String nRunName = space.SetF1(runName, size, rep); } } space.RefineStyle(style, reports); space.Complete(); return(space); }
public static Dictionary <String, List <classificationReportExpanded> > GetSpaceLayers(this IEnumerable <classificationReportExpanded> reports, classificationReportStyleDefinition style, Dictionary <String, List <classificationReportExpanded> > output = null) { if (output == null) { output = new Dictionary <string, List <classificationReportExpanded> >(); } style.Prepare(); foreach (classificationReportExpanded rep in reports) { foreach (var pair in style.layerNeedleByNameCompiled) { if (pair.Key.IsMatch(rep.Name)) { Match mc = pair.Key.Match(rep.Name); String nm = rep.Name; var splits = pair.Key.Split(nm); nm = ""; foreach (String sp in splits) { nm += sp; } rep.layer = pair.Value; } } if (!output.ContainsKey(rep.layer)) { output.Add(rep.layer, new List <classificationReportExpanded>()); } output[rep.layer].Add(rep); } return(output); }