public void trainFromDB()
 {
     DBProgressBar.ForeColor = Color.Blue;
     for (int i = 0; i < rawTables.Length; i++)
     {
         FetchFromDB Fetch = new FetchFromDB();
         UtilityFunctions UF = new UtilityFunctions();
         DataTable dt = Fetch.getTrainingDataFor(rawTables[i], 1);
         Hashtable ht = UF.TableToHashSumAdded(dt);
         InsertIntoDB insertToDB = new InsertIntoDB();
         insertToDB.InsertDataFor(freqTables[i], ht);
         DBProgressBar.Value = DBProgressBar.Value + 100 / rawTables.Length;
     }
 }
 public void testFromDB()
 {
     NaiveBayesClassifier NB;
         RegexDataParser RDP;
         FetchFromDB fetchFromDb;
         UtilityFunctions utilityFunction = new UtilityFunctions();
         Hashtable Vocabulary = utilityFunction.TableToHashSumAdded((new FetchFromDB()).getVocabulary());
         DBProgressBar.ForeColor = Color.Blue;
         DBProgressBar.Value = 0;
         DBProgressBar.Visible = true;
         for (int i = 0; i < freqTables.Length; i++)
         {
             NB = new NaiveBayesClassifier(freqTables);
             RDP = new RegexDataParser();
             fetchFromDb = new FetchFromDB();
             DataTable dataTable = fetchFromDb.getTrainingDataFor(rawTables[i], 0);
             foreach (DataRow row in dataTable.Rows) // Loop over the rows.
                 foreach (var item in row.ItemArray) // Loop over the items.
                 {
                     String Lyrics = RDP.StripTagsRegexCompiled(item.ToString());
                     String[] lyric = Lyrics.Split(' ');
                     List<string> containinginVocab = new List<string>();
                     for (int l = 0; l < lyric.Length; l++)
                     {
                         if (Vocabulary.ContainsKey(lyric[l]))
                             containinginVocab.Add(lyric[l]);
                     }
                     Double[] classification = NB.ApplyBayes(containinginVocab.ToArray());
                     int indx = NB.getMaxConfidence(classification);
                     confusionMatrix[i, indx] = confusionMatrix[i, indx] + 1;
                 }
             dataTable = null;
             DBProgressBar.Value = DBProgressBar.Value + 100 / freqTables.Length;
         }
         Double[] rowFrequency = utilityFunction.getRowCount(confusionMatrix);
         Double[,] PercentageMatrix = new Double[rawTables.Length, rawTables.Length];
         for (int i = 0; i < 5; i++)
             for (int j = 0; j < 5; j++)
                 PercentageMatrix[i, j] = (confusionMatrix[i, j] * 100) / rowFrequency[i];
         String[] Genres = { "Rap", "Country", "Religion", "Rock", "Reggae" };
         InsertIntoDB insertMatrix = new InsertIntoDB();
         insertMatrix.insertConfusionMatrix(PercentageMatrix, Genres);
         ReportForm rf = new ReportForm();
         rf.Show();
 }
示例#3
0
        void InterfacePicture.updatePicture(Picture p)
        {
            InsertIntoDB iidb = new InsertIntoDB();

            iidb.editPicture(p);
        }
示例#4
0
        void InterfacePicture.insertPicture(Picture p)
        {
            InsertIntoDB iidb = new InsertIntoDB();

            iidb.insertPicture(p);
        }
示例#5
0
        void InterfacePerson.addPerson(Person p)
        {
            InsertIntoDB iidb = new InsertIntoDB();

            iidb.addPerson(p);
        }
示例#6
0
        void InterfaceLocation.addLocation(Location l)
        {
            InsertIntoDB iidb = new InsertIntoDB();

            iidb.addLocation(l);
        }
示例#7
0
        void InterfaceEvent.addEvent(Event e)
        {
            InsertIntoDB iidb = new InsertIntoDB();

            iidb.addEvent(e);
        }