Exemplo n.º 1
0
        static void Main(string[] args)
        {
            #region Combine path

            string folder   = ".\\..\\..\\..\\Data";
            string fileName = "example.xlsx";
            string path     = Path.Combine(folder, fileName);

            #endregion

            IKMeansBuilder kMeansBuilder = new KMeansBuilder();
            IKMeans        kMeans;

            kMeans = kMeansBuilder
                     .Init(new KMeansInitialization())
                     .SetNumberOfClusters(2)
                     .Build();

            IDataView data = DataReaderExcel.ReadDataFromExcel(
                path: path,
                hasHeader: true,
                worksheet: 3,
                startColumn: 2);

            var clustered = kMeans.FitPredict(data);

            IQualityMeasurement qualityMeasurementAlgorithm = new IndexC();

            var res = qualityMeasurementAlgorithm.EvaluateQuality(clustered, new EuclideanDistance());

            Console.WriteLine(res);

            Console.Read();
        }
        public ActionResult <float> EvaluateClustering(DataViewClustered dataViewClustered)
        {
            IQualityMeasurement evaluator = new IndexC();
            var res = evaluator.EvaluateQuality(dataViewClustered, new EuclideanDistance());

            return(Ok(res));
        }