private void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            var data = (List <object>)e.Argument;

            Metrics.metric metric        = data[0] as Metrics.metric;
            string         choosedMetric = data[1] as string;
            double         precision;
            int            maxK = KChecker.maxK(sampleColection);

            for (int i = 1; i < maxK; i++)
            {
                precision = OneVsRest.precision(sampleColection, i, metric, p);
                kResults.Add("K: " + i + " Metric: " + choosedMetric + "\nPrecision: " + Math.Round(Convert.ToDecimal(precision), 2) + "%\n----------\n");
                double procentage = (double)i / (maxK - 1) * 100;
                bgw.ReportProgress((int)procentage);
            }
        }
        public static bool isCorrectK(RichTextBox kBox, SampleColection sampleColection, out string error)
        {
            int  maxK = KChecker.maxK(sampleColection);
            int  result;
            bool parsed = int.TryParse(kBox.Text, out result);

            if (!parsed)
            {
                error = "K must be an integer\n";
                return(false);
            }
            if (result < 1 || result > maxK)
            {
                error = "K must be an integer between 1 and " + maxK + "\n";
                return(false);
            }
            error = "Ok";
            return(true);
        }
        private void loadData_Click(object sender, EventArgs e)
        {
            dataLoader = new DataLoader(ofd);
            if (!DataValidation.isDataLoaded(dataLoader, out string dataError))
            {
                dataInfo.Text = dataError;
                return;
            }
            sampleColection = new SampleColection(dataLoader.data);
            var samplesAmount    = sampleColection.countSamples();
            var decisionAmount   = sampleColection.possibleDecisions().Count;
            var attributesAmount = sampleColection.samples.First().attributes.Count;
            var maxK             = KChecker.maxK(sampleColection);

            dataInfo.Text        = "File OK\n";
            dataInfo.Text       += "Loaded " + samplesAmount + " samples\n";
            dataInfo.Text       += "There are " + decisionAmount + " decisions possible\n";
            dataInfo.Visible     = true;
            attributesInfo.Text  = "Attributes";
            attributesInfo.Text += "\nEnter " + attributesAmount + " attributes";
            kInfo.Text           = "K";
            kInfo.Text          += "\nK must be between 1 and " + maxK;
        }