code: def optimize_forecasting_method(self, timeSeries, forecastingMethod):
          
          tuneableParameters = forecastingMethod.get_optimizable_parameters()
  
          remainingParameters = []
          for tuneableParameter in tuneableParameters:
              remainingParameters.append([tuneableParameter, [item for item in self._generate_next_parameter_value(tuneableParameter, forecastingMethod)]])
  
          # Collect the forecasting results
          forecastingResults = self.optimization_loop(timeSeries, forecastingMethod, remainingParameters)
  
          # Debugging GridSearchTest.inner_optimization_result_test
          #print ""
          #print "GridSearch"
          #print "Instance    /    SMAPE / Alpha"
          #for item in forecastingResults:
          #    print "%s / %s / %s" % (
          #    str(item[0])[-12:-1],
          #    str(item[0].get_error(self._startingPercentage, self._endPercentage))[:8],
          #    item[1]["smoothingFactor"]
          #)
          #print ""
  
          # Collect the parameters that resulted in the smallest error
          bestForecastingResult = min(forecastingResults, key=lambda item: item[0].get_error(self._startingPercentage, self._endPercentage))
  
          # return the determined parameters
          return bestForecastingResult
docs: Optimizes the parameters for the given timeSeries and forecastingMethod.
  
          :param TimeSeries timeSeries:    TimeSeries instance, containing hte original data.
          :param BaseForecastingMethod forecastingMethod:    ForecastingMethod that is used to optimize the parameters.
  
          :return: Returns a tuple containing only the smallest BaseErrorMeasure instance as defined in
              :py:meth:`BaseOptimizationMethod.__init__` and the forecastingMethods parameter.
          :rtype: tuple