Пример #1
0
        private async void ButtonSearch_Click(object sender, EventArgs e)
        {
            bool found = false;

            foreach (var item in DataGetter.GetData())
            {
                if (textBoxSearchCountry.Text == item.Name)
                {
                    textBoxCountryNameResult.Text = item.Name;
                    textBoxCapital.Text           = item.Capital;
                    textBoxAlpha3Code.Text        = item.Alpha3Code;
                    textBoxArea.Text       = item.Area.ToString();
                    textBoxPopulation.Text = item.Population.ToString();
                    textBoxRegion.Text     = item.Region;
                    found = true;

                    break;
                }
            }
            if (found == false)
            {
                MessageBox.Show("Страна не была найдена");
            }
            else
            if (MessageBox.Show("Сохранить в базу данных информацию?", "Страна найдена", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                await highLvlSQL.SaveDataInDB(textBoxCountryNameResult.Text, textBoxAlpha3Code.Text, textBoxCapital.Text,
                                              textBoxArea.Text, textBoxPopulation.Text, textBoxRegion.Text); //сохранение найденных полей в базу данных

                dataGridView1.Rows.Clear();
                dataGridView1.Refresh();
                FillDataGrid();
            }
        }
        public ScatterExample()
        {
            InitializeComponent();

            DataGetter      dg    = new DataGetter();
            List <double[]> data  = (List <double[]>)dg.GetData("group_B.csv", ',');
            List <double[]> data1 = (List <double[]>)dg.GetData("group_A.csv", ',');

            Values  = new ChartValues <ObservablePoint>();
            Values1 = new ChartValues <ObservablePoint>();

            Perceptron.learn();

            for (var i = 0; i < 500; i++)
            {
                Values.Add(new ObservablePoint(data[i][0], data[i][1]));
                Values1.Add(new ObservablePoint(data1[i][0], data1[i][1]));
            }

            DataContext = this;
        }
Пример #3
0
        public int GetAnswer()
        {
            _slope = DataGetter.GetData();
            var currentRow = 0;
            var currentCol = 0;
            var treesHit   = 0;

            while (currentRow < _slope.Rows.Count)
            {
                if (IsATree(currentRow, currentCol))
                {
                    treesHit++;
                }

                currentCol += 3;
                currentRow += 1;
            }

            return(treesHit);
        }
Пример #4
0
        public void DataGettingTest()
        {
            DataGetter dg   = new DataGetter();
            var        data = dg.GetData("approximation1.txt", ' ');

            var one = dg.GetTrainingDataWithOneOutput("approximation1.txt", 1);

            var test = dg.GetTrainingDataWithOneOutput("approximation_test.txt", 1);

            var two = dg.GetTrainingDataWithChosenInputs("classification.txt", new bool[] { true, true, true, true });

            { Console.WriteLine("test"); }

            var        distCal = new EuclideanDistance();
            RBFNetwork network = new RBFNetwork(distCal,
                                                new GaussianRadialBasis(),
                                                new KNNWidthCalculator(distCal, 2, 1),
                                                new RandomNeuronPositioner(),
                                                2, one[0].DesiredOutput.Count, one[0].Input.Count);

            network.Train(new BackpropagationTrainingParameters(0.5, 20, 0, -1, 1, one), test);

            var output = network.ProcessInput(test[0].Input);
        }