public void TrainNetwork()
        {
            Console.WriteLine("Training Network");

            SampleSet samples = GenerateSamples(category.Compositions);

            ann = RNN();

            ann.rebuffer(samples.maxSequenceLength());
            ann.initializeWeights(rnd);

            GradientDescent trainer = new GradientDescent();
            trainer.setNet(ann);
            trainer.setRnd(rnd);
            trainer.setPermute(false);

            trainer.setTrainingSet(samples);

            trainer.setLearningRate(learningrate);
            trainer.setMomentum(momentum);
            trainer.setEpochs(epochs);

            trainer.train();

            Save();
        }