void FillTweetInfo() { Analyser analyser = new Analyser(tweetDatas, labels); analyser.Analyse1(); tweetInfo.Text = ""; if (analyser.LabelFreq.Count == 0) { return; } for (int i = 0; i < labels.Length; i++) { if (analyser.LabelFreq.ContainsKey(labels[i]) == true) { tweetInfo.Text += labels[i] + ": " + analyser.LabelFreq[labels[i]] + "\n"; } else { tweetInfo.Text += labels[i] + ": 0" + "\n"; } } tweetInfo.Text += "\nTotal: " + analyser.Tweets.Length + "\n"; }
private void TrainTest(TrainingType type) { if (string.IsNullOrEmpty(filePath)) { MessageBox.Show("you have to choose a file to train...."); return; } btnTest.Enabled = true; progressBar.Value = 0; TweetData[] twData = JsonFileController.ReadDataFromJsonFile <TweetData[]>(filePath); ParseTweets(ref twData, type); Analyser analyser = new Analyser(twData, labels, tbTestCount.Value, chckPickRandomly.Checked); if (type == TrainingType.WORD_TRAINING) { analyser.Analyse1(); } else { analyser.Analyse2(); } progressBar.Maximum = twData.Length; trainer = new Trainer(analyser, tbHiddenNeuronCount.Value, double.Parse(lblLearningRate.Text), type); List <List <Tuple <int, double> > > list; if (type == TrainingType.WORD_TRAINING) { trainer.Train1(progressBar); list = trainer.Test1(progressBar); } else { trainer.Train2(progressBar); list = trainer.Test2(progressBar); } Test(type, analyser); //richtxtAnnResult.Text = ""; //for (int i = 0; i < analyser.TestingTweets.Length; i++) //{ // richtxtAnnResult.AppendText("TWEET:\n\n"); // richtxtAnnResult.AppendText(analyser.TestingTweets[i].tweet + "\n\n"); // richtxtAnnResult.AppendText("PREDICTION:\n\n"); // for (int j = 0; j < list[i].Count; j++) // { // string val = labels[list[i][j].Item1]; // double percentage = list[i][j].Item2 * 100; // richtxtAnnResult.AppendText(val + ":\t" + percentage.ToString("F2") + "%\n"); // } // richtxtAnnResult.AppendText("\nANSWER: " + analyser.TestingTweets[i].users[0].labels[0]); // richtxtAnnResult.AppendText("\n\n"); // richtxtAnnResult.AppendText("#################################################################\n\n"); //} ShowAnalyserInfo(trainer); }