Exemplo n.º 1
0
        public FormTrainMLModel(NeuralNetwork.EntityNetwork nn, Image image)
        {
            InitializeComponent();

            this.nn = nn;

            PopulateListView(nn._state.features);

            sourceImage  = image;
            sourceBitmap = new Bitmap(sourceImage);

            ExtractNextFeature();
        }
Exemplo n.º 2
0
        private void loadMLModelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult res = openFileDialog2.ShowDialog();

            if (res == DialogResult.OK)
            {
                string filename = openFileDialog2.FileName;

                XmlSerializer ser = new XmlSerializer(typeof(EntityNetwork.State));

                using (FileStream fs = new FileStream(filename, FileMode.Open))
                {
                    nn = new EntityNetwork((EntityNetwork.State)ser.Deserialize(fs));
                    toolStripStatusLabel17.Text = Path.GetFileName(filename);
                }
            }
        }
Exemplo n.º 3
0
        private void ComposeModel()
        {
            // Limit between 10 ... 100000

            int hiddenLayer = Math.Min(100000, Math.Max(100, Convert.ToInt32(textBox1.Text)));

            // Learning rate between 0.1 ... 10.0

            float learningRate;

            float.TryParse(textBox2.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out learningRate);
            learningRate = Math.Min(10.0F, Math.Max(0.1F, learningRate));

            nn = new EntityNetwork(ExtractDataGrid(), hiddenLayer, learningRate);

            nn._state.name = textBox3.Text;
        }
Exemplo n.º 4
0
        private void Form_FormCreateMLClosed(object sender, FormClosedEventArgs e)
        {
            FormCreateMLModel form = (FormCreateMLModel)sender;

            if (form.nn == null)
            {
                return;
            }

            if (form.nn._state.features.Count == 0)
            {
                MessageBox.Show("The model is missing features, you need to add at least one for the correct operation of the model.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            nn = form.nn;
            toolStripStatusLabel17.Text = "Not saved!";
        }
Exemplo n.º 5
0
        public FormCreateMLModel(bool showExisting, NeuralNetwork.EntityNetwork nnToShow)
        {
            InitializeComponent();
            ShowMode = showExisting;
            if (ShowMode)
            {
                nn = nnToShow;
                button1.Visible = false;

                textBox1.Text = nn._state._weightHiddenOutput[0].Length.ToString();
                textBox2.Text = nn._state._learningRate.ToString();
                textBox3.Text = nn._state.name;

                textBox1.ReadOnly = true;
                textBox2.ReadOnly = true;
                textBox3.ReadOnly = true;
                Text = "Current ML Model";
            }
            textBox3.Focus();
            InitDataGrid();
        }