Plot CreateSilhouetteMeanPlot(List <ModelAnalyzer> analyzers) { Plot silhouetteMeanPlot = new Plot(); int pointsCount = analyzers.Count; double[] xValues = new double[pointsCount]; double[] yValues = new double[pointsCount]; int currentClustersCount = analyzers[0].ClustersCount; for (int i = 0; i < pointsCount; i++) { ModelAnalyzer analyzer = analyzers[i]; xValues[i] = i; yValues[i] = analyzer.SilhouetteCoefMean; if (currentClustersCount != analyzer.ClustersCount) { double value = (i + (i - 1)) / 2.0; string label = $"clusters count {currentClustersCount}"; silhouetteMeanPlot.PlotVLine(value, VerticalDividerColor, label: label); } currentClustersCount = analyzer.ClustersCount; } silhouetteMeanPlot.PlotScatter(xValues, yValues, IntraClusterDistanceColor); return(silhouetteMeanPlot); }
Plot CreateIntraClusterPlot(ModelAnalyzer analyzer) { Plot intraClusterPlot = new Plot(); int pointsCount = analyzer.AnalyzedSongs.Count; double[] xValues = new double[pointsCount]; double[] yValues = new double[pointsCount]; int currentClusterIndex = analyzer.AnalyzedSongs[0].ClusterIndex; for (int i = 0; i < pointsCount; i++) { AnalyzedSong point = analyzer.AnalyzedSongs[i]; xValues[i] = i; yValues[i] = point.CentroidDistance; if (currentClusterIndex != point.ClusterIndex) { double value = (i + (i - 1)) / 2.0; string label = $"cluster {currentClusterIndex}"; intraClusterPlot.PlotVLine(value, VerticalDividerColor, label: label); } currentClusterIndex = point.ClusterIndex; } intraClusterPlot.PlotScatter(xValues, yValues, IntraClusterDistanceColor); intraClusterPlot.PlotHLine(analyzer.IntraClusterMeanDistance, IntraClustersMeanDistanceColor); return(intraClusterPlot); }
Plot CreateIntraClusterCommonPlot(List <ModelAnalyzer> analyzers) { if (analyzers.Count < 1) { throw new ArgumentException(); } Plot intraClusterCommonPlot = new Plot(); int pointsCount = analyzers.Count; double[] xValues = new double[pointsCount]; double[] yValues = new double[pointsCount]; int currentClustersCount = analyzers[0].ClustersCount; for (int i = 0; i < pointsCount; i++) { ModelAnalyzer analyzer = analyzers[i]; xValues[i] = i; yValues[i] = analyzer.IntraClusterMeanDistance; if (currentClustersCount != analyzer.ClustersCount) { double value = (i + (i - 1)) / 2.0; string label = $"clusters count {currentClustersCount}"; intraClusterCommonPlot.PlotVLine(value, VerticalDividerColor, label: label); } currentClustersCount = analyzer.ClustersCount; } intraClusterCommonPlot.PlotScatter(xValues, yValues, IntraClusterDistanceColor); return(intraClusterCommonPlot); }