public static void SaveAnalysis(AnalysisDrawer drawer, DateTime dateTime) { CheckAnalysisFolder(); string date = GetFormattedDate(dateTime); for (int i = 0; i < drawer.IntraClusterPlots.Count; i++) { string intraClusterPlotName = $"(model_intra_cluster_dist)(ord_{i})(date_{date}).png"; SavePlot(drawer.IntraClusterPlots[i], intraClusterPlotName); } for (int i = 0; i < drawer.IntraClusterPlots.Count; i++) { string silhouetteCoefPlotName = $"(model_silhouette)(ord_{i})(date_{date}).png"; SavePlot(drawer.SilhouetteCoefPlots[i], silhouetteCoefPlotName); } string intraClusterMeanPlotName = $"(intra_cluster_mean)(date_{date}).png"; SavePlot(drawer.IntraClusterCommonPlot, intraClusterMeanPlotName); string interClusterMeanPlotName = $"(inter_cluster_mean)(date_{date}).png"; SavePlot(drawer.InterClusterPlot, interClusterMeanPlotName); string silhouetteMeanPlotName = $"(silhouette_mean)(date_{date}).png"; SavePlot(drawer.SilhouetteCoefMeanPlot, silhouetteMeanPlotName); }
public static void Main(string[] args) { AppConfig appConfig = FileSystemHelper.GetAppConfig(); DateTime runDate = GetRunDate(); List <Song> songs = GetPreparedTrainingData(); int experimentIndex = 0; foreach (ExperimentConfig config in appConfig.ExperimentConfigs) { for (int i = 0; i < config.ModelsCount; i++) { DynamicKMeans trainedKMeans = TrainModel(songs, config.ClustersCount); FileSystemHelper.SaveKMeansModel(trainedKMeans.Model, runDate, experimentIndex); experimentIndex += 1; } } List <StaticKMeans> models = ReadAllModels(songs); List <ModelAnalyzer> analyzers = models.Select(model => { ModelAnalyzer analyzer = new ModelAnalyzer(model); analyzer.Analyze(); return(analyzer); }).ToList(); AnalysisDrawer drawer = new AnalysisDrawer(analyzers); drawer.CreatePlots(); FileSystemHelper.SaveAnalysis(drawer, runDate); List <Song> analyzingSongs = GetAnalyzingSongs(); FileSystemHelper.ClearPredictions(); for (int i = 0; i < models.Count; i++) { StaticKMeans model = models[i]; List <Prediction> predictions = MakePredictions(model, analyzingSongs); FileSystemHelper.SavePredictions(predictions, runDate, i); } }