Example #1
0
        public static void starter()
        {
            ClusterSetting clusterSetting = ClusterSetting.getClusterSettings();

            string filename = AppConfig.getTrainFilename();
            DataSet dataset = DataFileReader.ReadData(filename);

            ClusterFacadeInterface clusterFacade;

            clusterFacade = new MlvqFacade();
            //clusterFacade = new SOclusterFacade();
            //clusterFacade = new RctFacade();
            //clusterFacade = new SrctFacade();

            PoptvrSystem popSystem = new PoptvrSystem(dataset, clusterSetting, clusterFacade);
            popSystem.InitClusters();
            popSystem.PopLearn();

            filename = AppConfig.getTestFilename();
            dataset = DataFileReader.ReadData(filename);
            popSystem.POPTVR = RsPopModel.AttributeReduction(popSystem.POPTVR, dataset);
            popSystem.POPTVR = RsPopModel.RuleReduction(popSystem.POPTVR, dataset);

            popSystem.PopTest(dataset);
        }
 public void setVariables(PoptvrSystem popSystem)
 {
     this.PopSystem = popSystem;       
 }
 public void setVariables(PoptvrSystem popSys)
 {
     this.popSys = popSys;
 }
        private void DoSlowProcess()
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate()
                {
                    this.overallProgress_Label.Content = "Get Cluster Settings ...";
                }
            );
            ClusterSetting clusterSetting = ClusterSetting.getClusterSettings(Settings);

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, 
                (ThreadStart) delegate()
                {
                    this.overallProgress_Label.Content = "Read Trainging Data ...";
                    this.overallProgress_Bar.Value += 1;
                }
            );
            string filename = Settings.TrainingFileAddress;
            DataSet dataset = DataFileReader.ReadData(filename);

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate()
                {
                    this.overallProgress_Label.Content = "Setup Network ...";
                    this.overallProgress_Bar.Value += 1;
                }
            );

            ClusterFacadeInterface clusterFacade = null;
            if (this.Settings.ClusterMethod.Equals("clusterMethod_MLVQ"))
            {
                clusterFacade = new MlvqFacade();
            }
            else if (this.Settings.ClusterMethod.Equals("clusterMethod_RCT"))
            {
                clusterFacade = new RctFacade();
            }
            else if (this.Settings.ClusterMethod.Equals("clusterMethod_SO"))
            {
                clusterFacade = new SOclusterFacade();
            }
            else if (this.Settings.ClusterMethod.Equals("Method_SRCT"))
            {
                clusterFacade = new SrctFacade();
            }
            PopSystem = new PoptvrSystem(dataset, clusterSetting, clusterFacade, this.Settings);
            PopSystem.InitClusters();

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate()
                {
                    this.overallProgress_Label.Content = "Training Network ...";
                    this.overallProgress_Bar.Value += 1;
                }
            );
            PopSystem.PopLearn();

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate()
                {
                    this.overallProgress_Label.Content = "Read Testing Data ...";
                    this.overallProgress_Bar.Value += 1;
                }
            );
            filename = Settings.TrainingFileAddress;
            dataset = DataFileReader.ReadData(filename);

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate()
                {
                    this.overallProgress_Label.Content = "Run Testing Data ...";
                    this.overallProgress_Bar.Value += 1;
                }
            );
            PopSystem.PopTest(dataset);
            
            
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                    (ThreadStart)delegate()
                    {
                        this.overallProgress_Label.Content = "All Finished!";
                        this.overallProgress_Bar.Value += 1;
                        this.cancel_Button.Content = "Done";

                        this.Settings.TraingDone = true;
                        this.Settings.Save();

                        this.done = true;
                    }
                );
        }
 public void setVariables(PoptvrSystem popSystem, Settings settings)
 {
     this.PopSystem = popSystem;
     this.Settings = settings;
 }
Example #6
0
        private void loadNetwork_sim_Button_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            // Configure open file dialog box
            dlg.DefaultExt = ".poptvr"; // Default file extension
            dlg.Filter = "POPTVR Network (*.poptvr)|*.poptvr" +
                         "|" + "All files (*.*)|*.*";
            dlg.Multiselect = false;

            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();
            PoptvrSystem popSys;
            if (result == true)
            {
                FileStream fs = File.OpenRead(dlg.FileName);
                byte[] bytes = new byte[fs.Length];
                fs.Read(bytes, 0, Convert.ToInt32(fs.Length));
                fs.Close();

                popSys = (PoptvrSystem)POPTVR.Utilities.SystemFunctions.ByteArrayToObject(bytes);

                this.fileCreatedTime_sim_Label.Content = File.GetCreationTime(dlg.FileName).ToLongDateString() + " - " + File.GetCreationTime(dlg.FileName).ToLongTimeString();
                displaySimulatorInfo(popSys);

                this.simPopSystem = popSys;
                this.loadNetwork_sim_Button.Visibility = System.Windows.Visibility.Visible;
            }

            isSimReady();
        }
Example #7
0
 private void displaySimulatorInfo(PoptvrSystem popSys)
 {
     this.inputClusterSize_sim_Label.Content = popSys.AppConfig.getInputClusterSize();
     this.outputtClusterSize_sim_Label.Content = popSys.AppConfig.getOutputClusterSize();
     this.clusteringMethod_sim_Label.Content = popSys.AppConfig.getClusteringMethod();
 }
Example #8
0
        private void trained_Simulator_Checked(object sender, RoutedEventArgs e)
        {
            if (!this.settings.TraingDone)
            {
                MessageBox.Show("Cannot use trained network.\nThere is not completed training.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                ((RadioButton)sender).IsChecked = false;
            }
            else
            {
                this.popSystem = this.trainingProgressWindow.PopSystem;
                this.type_sim_Label.Content = ((RadioButton) sender).Content;
                displaySimulatorInfo(this.popSystem);
                this.loadNetwork_sim_Button.Visibility = System.Windows.Visibility.Hidden;

                this.simPopSystem = this.popSystem;
                this.fileCreatedTime_sim_Label.Content = "Just Now.";
            }

            isSimReady();
        }
Example #9
0
        private void ExportNetwork_Button_Click(object sender, RoutedEventArgs e)
        {
            if (!this.settings.TraingDone)
            {
                MessageBox.Show("Cannot export network.\nThere is not completed training.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                this.popSystem = this.trainingProgressWindow.PopSystem;
                byte[] byteStream = POPTVR.Utilities.SystemFunctions.ObjectToByteArray(this.popSystem);
                Microsoft.Win32.SaveFileDialog saveFileDialog = new Microsoft.Win32.SaveFileDialog();

                saveFileDialog.Filter = "POPTVR Network (*.poptvr)|*.poptvr" + "|" + "All File (*.*)| *.*";
                saveFileDialog.Title = "Save a POPTVR Network";
                saveFileDialog.ShowDialog();

                if (saveFileDialog.FileName != "")
                {
                    // Create a new stream to write to the file
                    BinaryWriter Writer = new BinaryWriter(File.OpenWrite(saveFileDialog.FileName));
                    Writer.Write(byteStream);
                    Writer.Flush();
                    Writer.Close();

                    MessageBox.Show(saveFileDialog.FileName + " has been saved.", "File Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }