public void Handle(TrainingUpdated @event) { using (var context = new ProjectionContext(ConnectionString.Get())) { var entity = context.GetEntity <TrainingSqlEntity>(@event.AggregateId); entity.Name = @event.Name; entity.Seats = @event.Seats; entity.Color = @event.Color; context.SaveChanges(); } }
public void StartTrain(SymbolCorpus trainSet) { this.trainSet = trainSet; int threadCount = 2; training = true; threadStatus = new List <string>(); for (int i = 0; i < threadCount; i++) { threadStatus.Add(""); } best = new Couppy(target.layerStateSizes, target.layerOutputSizes, target.translator); Couppy.copyInto(target, best); best.outputLayer.reset(); best.bake(trainSet); TrainingUpdated?.Invoke("Layer training started with: " + best.outputLayer.getStats()); for (int i = 0; i < trainSampleCount.Length; i++) { trainSampleCount[i] = 1; trainAccumulatedAccuracies[i] = best.outputLayer.accuracy; } for (int i = 0; i < threadCount; i++) { //Add thread lock readLocks.Add(new object()); trainLocks.Add(new object()); //Create thread resource Couppy tester = new Couppy(best.layerStateSizes, best.layerOutputSizes, best.translator); chatBots.Add(tester); //Create and start thread Thread tt = new Thread(ThreadTrain); threads.Add(tt); } //Start threads after to avoid first cycle conflicts for (int i = 0; i < threadCount; i++) { threads[i].Start(i); } }
private void PushStatus(object status) { TrainingUpdated?.Invoke((string)status); //Breaks thread by locking up on main visual thread in case of training end }