public void ClassifySongsTogether()
        {
            string positivitySvmPath = System.IO.Path.Combine(Classifier.ExecutableInformation.getModelsDir(), positiveClassificationMethod);
            string energySvmPath     = System.IO.Path.Combine(Classifier.ExecutableInformation.getModelsDir(), energyClassificationMethod);

            Classifier.SupportVectorMachine svm = new Classifier.SupportVectorMachine(positivitySvmPath, energySvmPath);
            List <string> unclassifiedSongs     = new List <string>();

            foreach (string song in songs)
            {
                if (!ServerDatabase.Instance.DoesSongExist(song))
                {
                    unclassifiedSongs.Add(song);
                }
            }
            //Don't try to reclassify the same song. Waste of time.
            string output = svm.Classify(unclassifiedSongs);

            foreach (ClassifierResult result in JsonDTOMapper.getJsonDTO(output).ClassifierResults)
            {
                Song            classifiedSong = result.song;
                EmotionSpaceDTO point          = new EmotionSpaceDTO(classifiedSong.energy, classifiedSong.positivity);
                ServerDatabase.Instance.addSongToDatabase(classifiedSong.title, point);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            string directory = @"E:\Music\Duran Duran\";

            Classifier.IClassifierType classifier = new Classifier.SupportVectorMachine();
            string[] songPaths = Framework.DirectoryBrowser.getSongs(directory);
            classifier.Train(songPaths);
        }