コード例 #1
0
 public void TestClassifierCreateViewTypeIsStdAndClassifierTypeIsSmartView()
 {
     ClassifierName = ClassifierName + "Sync" + RandomNumber;
     ClassifierManager.CreateNewClassifier("Standard", "SmartView", "", false);
     ClassifierManager.SaveClassifier(ClassifierName);
     ClassifierManager.VerifyClassifierTitleAndStatusBar(ClassifierName, "Standard");
 }
コード例 #2
0
 public void TestClassifierCreateViewTypeIsMarkReaderAndClassifierTypeIsSmartView()
 {
     ClassifierName = ClassifierName + "Sync" + RandomNumber;
     ClassifierManager.CreateNewClassifier("Mark reader", "non", "", false);
     ClassifierManager.SaveClassifier(ClassifierName);
     ClassifierManager.VerifyClassifierTitleAndStatusBar(ClassifierName, "Mark reader");
 }
コード例 #3
0
        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
            });;
        }
コード例 #4
0
        //MATLAB REFERENCE. You must add the matlab reference via the project menu before this will work
        //MLApp.MLApp matlab;
        public AdaptiveProvider(RandomizedQueue <StudyTestPair> stp, IArrayView <string> presentation, IArrayView <string> class1, IArrayView <string> class2,
                                AdaptiveSettings settings, IEEGDataSource dataSource, IArray <ClassificationScheme> classifiers)
        {
            this.pres         = stp;
            this.settings     = settings;
            this.dataSource   = dataSource;
            this.presentation = presentation;
            this.class1       = class1;
            this.class2       = class2;
            this.classifiers  = classifiers;
            //NOTE: It will always take the first classification scheme chosen
            //TODO: Make it so that only one classification scheme can be specified
            classifier = new ClassifierManager(classifiers[0]);
            //MATLAB REFERENCE
            //matlab = new MLApp.MLApp();

            blocks = new RandomizedQueue <string> [settings.NumBlocks * 2];
            int limit = 0;

            for (int i = 0; i < settings.NumBlocks * 2; i += 2)
            {
                blocks[i]     = new RandomizedQueue <string>();
                blocks[i + 1] = new RandomizedQueue <string>();

                for (int j = 0 + limit * settings.BlockSize; j < (limit + 1) * settings.BlockSize; j++)
                {
                    blocks[i].Add(this.class1[j]);
                    blocks[i + 1].Add(this.class2[j]);
                }
                limit++;
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        static void PropogateDataAndModels()
        {
            SetUp start = new SetUp();

            start.RunSetup(out List <string> modelPaths, out Dictionary <string, bool> visualizationStatuses);

            GetClassifiersFromPaths(modelPaths,
                                    out List <AbstractClassifier> models);

            GetVisualizers(visualizationStatuses, out Visualizers);

            string      configPath = null;
            XmlDocument config;
            bool        outputStandardModels;

            if (start.FindConfigPath(ref configPath))
            {
                config = new XmlDocument();
                config.Load(configPath);
                outputStandardModels = Convert.ToBoolean(config.DocumentElement.SelectSingleNode("settings").SelectSingleNode("outputStandardisedModels").FirstChild.Value);
            }
            else
            {
                throw new Exception("Config path not found.");
            }

            if (outputStandardModels)
            {
                OutputStandardisedModels(config, models);
            }

            if (start.GetDataPath(config, out string dataPath) == true)
            {
                warehouse = new DataWarehouse(dataPath);
            }
            else
            {
                throw new Exception("No data found.");
            }

            if (start.GetTranslatorPath(config, out string translatorPath) == true)
            {
                Console.ForegroundColor = ConsoleColor.Black;
                Console.BackgroundColor = ConsoleColor.Green;
                Console.WriteLine("Translator file found: " + translatorPath);
                Console.ResetColor();
                translator = DataTranslator.LoadTranslatorFromFile(translatorPath);
            }
            else
            {
                translator = new DataTranslator();
            }

            start.GetVisualizationDirectory(config, out VisualizerOutputDir);

            cm = new ClassifierManager(models.ToArray());
        }
コード例 #7
0
 public void TestClassifierCreateViewTypeIsSynchAndClassifierTypeIsSmartView()
 {
     ClassifierName = ClassifierName + "" + RandomNumber;
     ClassifierManager.CreateNewClassifier("Synchronized", "SmartView", "", false);
     ClassifierManager.SaveClassifier(ClassifierName);
     ClassList.RecordedMethod1(ClassifierName);
     ClassifierManager.VerifyClassifierTitleAndStatusBar(ClassifierName, "Synchronized");
     //  ClassifierManager.LoadOpenClassifierWindw(ClassifierName);
     //  ClassifierManager.VerifyClassifierListedInClassifierListOnOpenClassifierWindow(ClassifierName);
     //  ClassifierManager.ClickOpenButtonInOpenClassifierWindow();
 }
コード例 #8
0
        public JsonResult Get(int id)
        {
            SecurityManager sm = new SecurityManager();

            CoreLogic cr = new CoreLogic();

            ClassifierManager clsm = new ClassifierManager();


            //var clases5 = clsm.GetClassifier_rel(100);
            var        clases = clsm.GetClassifiers();
            Classifier cls    = clsm.GetClassifier(101);

            return(Json(cls));
        }
コード例 #9
0
 public void TestCloseClassiferManager()
 {
     ClassifierManager.CloseClassifierManager(ClassifierName);
 }
コード例 #10
0
 public void TestLaunchClassiferManager()
 {
     ClassifierManager.LaunchClassifierManager();
 }