/* * public static HeatMapModel GetHeatMap(this OverlapMatrix<WeightDictionaryEntry> matrix) * { * HeatMapModel output = HeatMapModel.Create(matrix.width, matrix.height); * * output.Deploy() * } */ /// <summary> /// Gets the overlap matrix. /// </summary> /// <param name="dictionaries">The dictionaries.</param> /// <returns></returns> public static OverlapMatrix <String> GetOverlapMatrix(this IEnumerable <TokenDictionary> dictionaries) { var collections = new List <List <String> >(); foreach (var dict in dictionaries) { collections.Add(dict.GetTokens()); } OverlapMatrix <String> output = new OverlapMatrix <string>(collections); return(output); }
/// <summary> /// Gets the overlap matrix. /// </summary> /// <param name="dictionaries">The dictionaries.</param> /// <returns></returns> public static OverlapMatrix <WeightDictionaryEntry> GetOverlapMatrix(this IEnumerable <WeightDictionary> dictionaries) { List <List <WeightDictionaryEntry> > collections = new List <List <WeightDictionaryEntry> >(); foreach (var dict in dictionaries) { collections.Add(dict.index.Values.ToList()); } OverlapMatrix <WeightDictionaryEntry> output = new OverlapMatrix <WeightDictionaryEntry>(collections); return(output); }
/// <summary> /// Gets the heat map matrix. /// </summary> /// <param name="dictionaries">The dictionaries.</param> /// <returns></returns> public static HeatMapModel GetHeatMapMatrix(this IEnumerable <WeightDictionary> dictionaries) { OverlapMatrix <WeightDictionaryEntry> matrix = dictionaries.GetOverlapMatrix(); // = new List<List<WeightDictionaryEntry>>(); List <String> dictnames = dictionaries.Select(x => x.name).ToList(); HeatMapModel output = new HeatMapModel(dictnames); for (int i = 0; i < matrix.width; i++) { for (int y = 0; y < matrix.height; y++) { output[i, y] = matrix[i, y].GetWeightSum(); } } output.DetectMinMax(); return(output); }
/// <summary> /// Gets the heat map matrix. /// </summary> /// <param name="dictionaries">The dictionaries.</param> /// <returns></returns> public static HeatMapModel GetHeatMapMatrix(this IEnumerable <SpaceDocumentModel> dictionaries) { OverlapMatrix <String> matrix = dictionaries.Select(x => x.terms).GetOverlapMatrix(); // = new List<List<WeightDictionaryEntry>>(); var terms = dictionaries.Select(x => x.terms).ToList(); List <String> dictnames = dictionaries.Select(x => x.name).ToList(); HeatMapModel output = new HeatMapModel(dictnames); for (int i = 0; i < matrix.width; i++) { for (int y = 0; y < matrix.height; y++) { output[i, y] = terms[i].GetTokenFrequencies(matrix[i, y]); } } output.DetectMinMax(); return(output); }