private void AlgoritmAccurancy(weka.core.Instances insts, Classifier classifier, string algoritmName, bool?isNominal = null)
        {
            ClassifierManager manager = new ClassifierManager(insts);

            manager.EliminateTargetAttribute();
            if (isNominal == true)
            {
                manager.Discreatization(manager.Instance);
            }
            else if (isNominal == false)
            {
                manager.NominalToBinary(manager.Instance);
                manager.Normalization(manager.Instance);
            }

            manager.Randomize(manager.Instance);

            TrainModel model = manager.Train(manager.Instance, classifier);

            SuccessfulAlgorithm.Add(new AlgorithmModel()
            {
                SuccessRatio = manager.FindAccurancy(),
                AlgorithName = algoritmName,
                TrainModel   = model
            });;
        }
        private void Btn_Click(object sender, EventArgs e)
        {
            bool isValid = true;

            for (int j = 0; j < staticInsts.instance(0).numValues() - 1; j++)
            {
                if (!isValid)
                {
                    break;
                }
                for (int i = 0; i < testValues.Count; i++)
                {
                    if (testValues[i].GetType() == typeof(TextBox))
                    {
                        double res = 0;
                        if (!string.IsNullOrEmpty(((TextBox)testValues[i]).Text) &&
                            !double.TryParse(((TextBox)testValues[i]).Text, out res))
                        {
                            MessageBox.Show("Enter a valid value for " + labelNames[i]);
                            isValid = false;
                            break;
                        }
                        else if (string.IsNullOrEmpty(((TextBox)testValues[i]).Text))
                        {
                            MessageBox.Show("Enter a Value for " + labelNames[i]);
                            isValid = false;
                            break;
                        }
                        else
                        {
                            staticInsts.instance(0).setValue(i, Convert.ToDouble(((TextBox)testValues[i]).Text));
                            isValid = true;
                        }
                    }
                    else if (testValues[i].GetType() == typeof(ComboBox))
                    {
                        staticInsts.instance(0).setValue(i, ((ComboBox)testValues[i]).SelectedItem.ToString());
                    }
                }
            }
            if (isValid)
            {
                ClassifierManager manager = new ClassifierManager(staticInsts);
                if (algoritmName == "Naive Bayes")
                {
                    manager.Discreatization(manager.Instance);
                }
                else if (algoritmName == "KNN with k = 3")
                {
                    manager.NominalToBinary(manager.Instance);
                    manager.Normalization(manager.Instance);
                }
                double a      = predictor.classifyInstance(manager.Instance.firstInstance());
                string result = classes[(int)a];

                MessageBox.Show("Result : " + result);
            }
        }