private async void startMusicGeneration_Click(object sender, EventArgs e) { this.model = TemperaryVariables.Graph; if (null == this.model || null == this.neuralNetwork) { MessageBox.Show("Load neccessary files"); } INGramWeightAssigner <Chord> assi = null; if (this.useWeightAssignerCheckBox.Checked) { NGramLinearSizeVsTimeWeightAssigner <Chord> sizetime = new NGramLinearSizeVsTimeWeightAssigner <Chord>(1F); NGramLinearSizeDistrubutionAssigner <Chord> size = new NGramLinearSizeDistrubutionAssigner <Chord>(this.model); Dictionary <INGramWeightAssigner <Chord>, float> dic = new Dictionary <INGramWeightAssigner <Chord>, float>() { { sizetime, this.sizeVsWeightAssigner.Value / 100F }, { size, this.countDistAssigner.Value / 100F } }; assi = new NGramMetaWeightAssigner <Chord>(dic); } else { assi = new NGramIDWeightAssigner <Chord>(this.model); } this.trainingThread = new Thread(this.GeneticSearch); this.trainingThread.Start(assi); }
public override NGram <Chord>[] RetrieveChain() { INGramWeightAssigner <Chord> sizeTime = new NGramLinearSizeVsTimeWeightAssigner <Chord>((float)this.trackBar.Value / (float)this.trackBar.Maximum); INGramWeightAssigner <Chord> size = new NGramLinearSizeDistrubutionAssigner <Chord>(this.MarkovGraph, 20); Dictionary <INGramWeightAssigner <Chord>, float> assigners = new Dictionary <INGramWeightAssigner <Chord>, float>() { { sizeTime, 0.5F }, { size, 0.5F } }; INGramWeightAssigner <Chord> meta = new NGramMetaWeightAssigner <Chord>(assigners); NGramBaseRandomGraphWalker <Chord> walker = new NGramBaseRandomGraphWalker <Chord>(meta); walker.LoadGraph(this.MarkovGraph); var chain = walker.NextMultiple(this.GetStartingNode().Node.AsEnumerableObject().ToArray(), this.WalkerDepth).ToArray(); return(chain); }
public async virtual Task UpdateThemeListBox() { this.themeListBox.Items.Clear(); INGramWeightAssigner <Chord> sizeTime = new NGramLinearSizeVsTimeWeightAssigner <Chord>((float)this.trackBar.Value / (float)this.trackBar.Maximum); INGramWeightAssigner <Chord> size = new NGramLinearSizeDistrubutionAssigner <Chord>(this.MarkovGraph, 20); Dictionary <INGramWeightAssigner <Chord>, float> assigners = new Dictionary <INGramWeightAssigner <Chord>, float>() { { sizeTime, 0.5F }, { size, 0.5F } }; INGramWeightAssigner <Chord> meta = new NGramMetaWeightAssigner <Chord>(assigners); var chords = this.Themes(new NGramIDWeightAssigner <Chord>(this.MarkovGraph)); foreach (var item in chords) { this.themeListBox.Items.Add(item); } }