예제 #1
0
        private void btnMuatFiturTesting_Click(object sender, EventArgs e)
        {
            var openfile     = Tmp.OpenFileDialog("Muat Fitur Datasets", "Feature");
            var dialogResult = openfile.ShowDialog();

            _listFiturUji = new List <double[]>();
            _listKelasUji = new List <double>();
            if (dialogResult == DialogResult.OK)
            {
                foreach (String file in openfile.FileNames)
                {
                    var filecsv = File.ReadAllLines(file);
                    foreach (var row in filecsv)
                    {
                        var temp  = Array.ConvertAll(row.Split(';'), double.Parse);
                        var temp1 = temp.Last();
                        _listFiturUji.Add(temp.Take(temp.Count() - 1).ToArray());
                        _listKelasUji.Add(temp1 + 1);
                    }
                }
                _arrayFiturUji = new double[_listFiturUji.Count, _listFiturUji[0].Length];
                _arrayKelasUji = new double[_listKelasUji.Count];
                Parallel.For(0, _arrayFiturUji.GetLength(0), i =>
                {
                    Parallel.For(0, _arrayFiturUji.GetLength(1), j =>
                    {
                        _arrayFiturUji[i, j] = _util.NormalizedMinMax(_listFiturUji[i][j], 0, 0.15);
                    });
                    _arrayKelasUji[i] = _listKelasUji[i];
                });
                btnLatih.Enabled = true;
            }
        }
예제 #2
0
 private void btnMuatModelBetaHatt_Click(object sender, EventArgs e)
 {
     switch (cbMachineLearning.SelectedIndex)
     {
     case 0:
         var openfile          = Tmp.OpenFileDialog("Muat Model", "betahatt", "MODEL Files (*.betaHatt)|*.betaHatt");
         var dialogResult      = openfile.ShowDialog();
         var listModelbetaHatt = new List <double[]>();
         updateAktivitas("Open File BetaHatt " + openfile.FileNames);
         if (dialogResult == DialogResult.OK)
         {
             foreach (String file in openfile.FileNames)
             {
                 var filecsv = File.ReadAllLines(file);
                 foreach (var row in filecsv)
                 {
                     listModelbetaHatt.Add(Array.ConvertAll(row.Split(';'), double.Parse));
                 }
             }
             _modelbetaHatt = new double[listModelbetaHatt.Count()];
             Parallel.For(0, listModelbetaHatt.Count(), i => {
                 Parallel.For(0, listModelbetaHatt[0].Length, j =>
                 {
                     _modelbetaHatt[i] = listModelbetaHatt[i][j];
                 });
             });
             groupPemakaian.Enabled = true;
             btnUji.Enabled         = true;
             btnUjiDatasets.Enabled = true;
             groupOpsiLatih.Enabled = true;
             enn = new ExtremeNeuralNetwork();
         }
         break;
     }
 }
예제 #3
0
        public FormMuse()
        {
            _nama = "";
            DialogResult dialogres;

            do
            {
                dialogres = Tmp.InputBox("Form Nama", "Masukkan nama anda: ", ref _nama);
                if (dialogres == DialogResult.Cancel)
                {
                    break;
                }
            } while ((_nama == "" && dialogres == DialogResult.OK));
            InitializeComponent();
            if (dialogres.ToString() == "Cancel")
            {
                Environment.Exit(0);
            }
            else
            {
                rcAktivitas.Text += DateTime.Now.ToString("HH:mm:ss") + " : \tSelamat Datang " + _nama + "\n";
                this.Text        += " - " + _nama + " - " + DateTime.Now.ToString("HH:mm:ss");
            }
            string[] folder = { "RAW_HURUF\\", "BPF_HURUF\\", "DFT_HURUF\\", "FEATURE\\", "RAW_GAMBAR\\", "BPF_HURUF\\", "DFT_HURUF\\", "weight\\", "betaHatt\\" };
            foreach (var f in folder)
            {
                if (!Directory.Exists(f))
                {
                    Directory.CreateDirectory(f);
                }
            }
        }
예제 #4
0
 private void btnMuatModel_Click(object sender, EventArgs e)
 {
     switch (cbMachineLearning.SelectedIndex)
     {
     case 0:
         var openfile        = Tmp.OpenFileDialog("Muat Model", "weight", "MODEL Files (*.weight)|*.weight");
         var dialogResult    = openfile.ShowDialog();
         var listModelWeight = new List <double[]>();
         updateAktivitas("Open File Weight " + openfile.FileNames);
         if (dialogResult == DialogResult.OK)
         {
             foreach (String file in openfile.FileNames)
             {
                 var filecsv = File.ReadAllLines(file);
                 foreach (var row in filecsv)
                 {
                     listModelWeight.Add(Array.ConvertAll(row.Split(';'), double.Parse));
                 }
             }
             _modelWeight = new double[listModelWeight.Count(), listModelWeight[0].Length];
             Parallel.For(0, _modelWeight.GetLength(0), i => {
                 Parallel.For(0, _modelWeight.GetLength(1), j =>
                 {
                     _modelWeight[i, j] = listModelWeight[i][j];
                 });
             });
             btnMuatModelBetaHatt.Enabled = true;
         }
         break;
     }
 }
예제 #5
0
        private void ELM()
        {
            this.Invoke((MethodInvoker) delegate {
                groupLatih.Enabled     = false;
                groupOpsiLatih.Enabled = false;
                groupPemakaian.Enabled = false;
            });
            Console.WriteLine(_neuronHidden);
            Console.WriteLine(_minRand);
            Console.WriteLine(_maxRand);
            Network net = new Network(_neuronHidden, _minRand, _maxRand);

            enn    = new ExtremeNeuralNetwork(net, Activation.SigmoidBiner);
            _error = enn.teach(_arrayFitur, _arrayKelas);
            tbMape.Invoke((MethodInvoker) delegate { tbMape.Text = _error + ""; });
            DialogResult dialogres;
            string       _filename = "";

            do
            {
                dialogres = Tmp.InputBox("Form Nama", "Masukkan nama model Training: ", ref _filename);
                if (dialogres == DialogResult.Cancel)
                {
                    break;
                }
            } while ((_filename == "" && dialogres == DialogResult.OK));
            if (dialogres.ToString() == "Cancel")
            {
            }
            else
            {
                saveFile(enn.Weight, "weight", _filename);
                saveFile(enn.BetaHatt, "betaHatt", _filename);
                updateAktivitas("Save File Model");
            }

            this.Invoke((MethodInvoker) delegate {
                groupLatih.Enabled     = true;
                groupOpsiLatih.Enabled = true;
                groupPemakaian.Enabled = true;
            });
        }