@itty.post('/optimize')
def optimize(request):
    #Parse arguments
    seasonLength = int(request.POST.get('seasonLength', 6))
    valuesToForecast = int(request.POST.get('valuesToForecast', 0))
    data = json.loads(request.POST.get('data', []))

    original = TimeSeries.from_twodim_list(data)
    original.normalize("day") #due to bug in TimeSeries.apply
    original.set_timeformat("%d.%m")

    #optimize smoothing
    hwm = HoltWintersMethod(seasonLength = seasonLength, valuesToForecast = valuesToForecast)
    gridSearch = GridSearch(SMAPE)
    optimal_forecasting, error, optimal_params = gridSearch.optimize(original, [hwm])

    #perform smoothing
    smoothed = optimal_forecasting.execute(original)
    smoothed.set_timeformat("%d.%m")
    result = {  'params': optimal_params,
                'original': original,
                'smoothed': smoothed,
                'error': round(error.get_error(), 3)
                }
    return itty.Response(json.dumps(result, cls=PycastEncoder), content_type='application/json')
Performs Holt Winters Parameter Optimization on the given post data.
dataset/ETHPy150Open T-002/pycast/bin/examples/LivingRoomEnergy/server.py/optimize