docs: def train(self, sweeps=None, cont=0):
          """
          Trains the network on the dataset till a stopping condition is
          met. This stopping condition can be a limiting epoch or a percentage correct requirement.
          """
          # check architecture
          self.complete = 0
          self.verifyArchitecture()
          tssErr = 0.0; rmsErr = 0.0; totalCorrect = 0; totalCount = 1; totalPCorrect = {}
          if not cont: # starting afresh
              self.resetFlags()
              self.epoch = 0
              self.reportStart()
              self.resetCount = 1
              self.epoch = 1
              self.lastLowestTSSError = sys.maxsize # some maximum value (not all pythons have Infinity)
              if sweeps != None:
                  self.resetEpoch = sweeps
          else:
              if sweeps != None:
                  self.resetEpoch = self.epoch + sweeps - 1
          while self.doWhile(totalCount, totalCorrect):
              (tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep()
              self.complete = 1
              if totalCount != 0:
                  rmsErr = math.sqrt(tssErr / totalCount)
              else:
                  self.Print("Warning: sweep didn't do anything!")
              if self.epoch % self.reportRate == 0:
                  self.reportEpoch(self.epoch, tssErr, totalCorrect, totalCount, rmsErr, totalPCorrect)
                  if len(self.crossValidationCorpus) > 0 or self.autoCrossValidation:
                      (tssCVErr, totalCVCorrect, totalCVCount, totalCVPCorrect) = self.sweepCrossValidation()
                      rmsCVErr = math.sqrt(tssCVErr / totalCVCount)
                      self.Print("CV    #%6d | TSS Error: %.4f | Correct: %.4f | RMS Error: %.4f" % \
                                 (self.epoch, tssCVErr, totalCVCorrect * 1.0 / totalCVCount, rmsCVErr))
                      if self.autoSaveWeightsFile != None and tssCVErr < self.lastLowestTSSError:
                          self.lastLowestTSSError = tssCVErr
                          self.saveWeights(self.autoSaveWeightsFile, mode = self.autoSaveWeightsFileFormat)
                          self.Print("auto saving weights to '%s'..." % self.lastAutoSaveWeightsFilename)
                      if self.autoSaveNetworkFile != None:
                          self.saveNetwork(self.autoSaveNetworkFile, mode = self.autoSaveNetworkFileFormat)
                          self.Print("auto saving network to '%s'..." % self.lastAutoSaveNetworkFilename)
                      if totalCVCorrect * 1.0 / totalCVCount >= self.stopPercent and self.useCrossValidationToStop:
                          self.epoch += 1
                          break
              if self.resetEpoch == self.epoch:
                  if self.resetCount == self.resetLimit:
                      self.Print("Reset limit reached; ending without reaching goal")
                      self.epoch += 1
                      self.complete = 0
                      break
                  self.resetCount += 1
                  self.Print("RESET! resetEpoch reached; starting over...")
                  self.initialize()
                  tssErr = 0.0; rmsErr = 0.0; self.epoch = 1; totalCorrect = 0; totalPCorrect = {}
                  continue
              self.epoch += 1
          if totalCount > 0:
              self.reportFinal(self.epoch, tssErr, totalCorrect, totalCount, rmsErr, totalPCorrect)
              if len(self.crossValidationCorpus) > 0 or self.autoCrossValidation:
                  (tssCVErr, totalCVCorrect, totalCVCount, totalCVPCorrect) = self.sweepCrossValidation()
                  rmsCVErr = math.sqrt(tssCVErr / totalCVCount)
                  self.Print("CV    #%6d | TSS Error: %.4f | Correct: %.4f | RMS Error: %.4f" % \
                             (self.epoch-1, tssCVErr, totalCVCorrect * 1.0 / totalCVCount, rmsCVErr))
                  if self.autoSaveWeightsFile != None and tssCVErr < self.lastLowestTSSError:
                      self.lastLowestTSSError = tssCVErr
                      self.saveWeights(self.autoSaveWeightsFile, mode = self.autoSaveWeightsFileFormat)
                      self.Print("auto saving weights to '%s'..." % self.lastAutoSaveWeightsFilename)
                  if self.autoSaveNetworkFile != None:
                      self.saveNetwork(self.autoSaveNetworkFile, mode = self.autoSaveNetworkFileFormat)
                      self.Print("auto saving network to '%s'..." % self.lastAutoSaveNetworkFilename)
          else:
              print("Final: nothing done")