docs: private int getMinErrorRateWindowSize() {
  
  		int numSamples = this.stm.numInstances();
  		if (numSamples < 2 * this.minSTMSizeOption.getValue()) {
  			return numSamples;
  		} else {
  			List<Integer> numSamplesRange = new ArrayList<>();
  			numSamplesRange.add(numSamples);
  			while (numSamplesRange.get(numSamplesRange.size() - 1) >= 2 * this.minSTMSizeOption.getValue())
  				numSamplesRange.add(numSamplesRange.get(numSamplesRange.size() - 1) / 2);
  
  			Iterator it = this.predictionHistories.keySet().iterator();
  			while (it.hasNext()) {
  				Integer key = (Integer) it.next();
  				if (!numSamplesRange.contains(numSamples - key)) {
  					it.remove();
  				}
  			}
  			List<Double> errorRates = new ArrayList<>();
  			for (Integer numSamplesIt : numSamplesRange) {
  				int idx = numSamples - numSamplesIt;
  				List<Integer> predHistory;
  				if (this.predictionHistories.containsKey(idx)) {
  					predHistory = this.getIncrementalTestTrainPredHistory(this.stm, idx, this.predictionHistories.get(idx));
  				} else {
  					predHistory = this.getTestTrainPredHistory(this.stm, idx);
  				}
  				this.predictionHistories.put(idx, predHistory);
  				errorRates.add(this.getHistoryErrorRate(predHistory));
  			}
  			int minErrorRateIdx = errorRates.indexOf(Collections.min(errorRates));
  			int windowSize = numSamplesRange.get(minErrorRateIdx);
  			if (windowSize < numSamples) {
  				this.adaptHistories(minErrorRateIdx);
  			}
  			return windowSize;
  		}
  	}