public void TrainSet(EncogOCR_SketchData[] sketches, bool shouldGenerateGarbage = true)
            {
                // Assign a token so that only the latest result will be used
                long token = TokenGenerator.NextToken();
                _currentToken = token;

                _parent.lblTraining.Content = "training...";

                // Kill existing tasks
                //NOTE: Removing from the list is done in the continue
                foreach (var runningTask in _currentTasks)
                {
                    runningTask.Item2.Cancel();
                }

                // Group the sketches by name
                var groupedSketches = sketches.ToLookup(o => o.Name).
                    Select(o => Tuple.Create(o.Key, o.Select(p => p).ToArray())).
                    ToArray();
                if (groupedSketches.Length == 0)
                {
                    _parent._network = null;
                    _parent.lblTraining.Content = "";
                    return;
                }

                TrainNetwork(groupedSketches, token, shouldGenerateGarbage);
            }