nabeel-oz / qlik-py-tools

Data Science algorithms for Qlik implemented as a Python Server Side Extension (SSE).
https://nabeel-oz.github.io/qlik-py-tools/
MIT License
186 stars 87 forks source link

Manipulate data coming from pytools #87

Closed acabos91 closed 4 years ago

acabos91 commented 4 years ago

Hi,

To start, thank you for your really good job on this tools. It is very useful. My issue is that I cannot made operation on objects calculated with Python. I have some simple cases to explain :

I don't want to do that into the script because main goal of this sheet (for our business) is that the client choose his parameter and see its forecast / decomposition. So pre-calculate induce a very heavy application (without this our apps are an average weight of 1 GB).

So it is possible to do operation such as Pytools.prophet(...) + Pytools.prophet or - Sum() etc ... And also handle data, aggregate data from month (calculate result year, evolution, standard deviation ...) Maybe it is already possible with some tips, but I cannot find it, I try to use Aggr for example but it is not working.

Thank you for your help Best regards, Anthony Cabos

nabeel-oz commented 4 years ago

Hi Anthony,

Thanks, glad you've found this extension useful.

  • I can calculate season, holiday and trend composant thanks to Pytools, I want to calculate noise. It is only (in additive model). Data minus season minus holiday minus trend. But I cannot do that directly in Qlik.

This sounds like you want to calculate the 'residuals' between the predictable components and the actual values, which as mentioned by Prophet's author here can be calculated as y - yhat.

I included a quick change in release 6.4 published today which returns this result for the historical periods. Simply pass return=residual in the additional arguments to the PyTools.Prophet function.

PyTools.Prophet([Month Start], Sum(Attendances), 'freq=MS, return=residual')

The calculation could also be done in Qlik using the Column function. You would need to have Actual and Forecast as measures in the chart, and then use Column(1) - Column(2) to get the residuals.

  • I made a forecast month by month of turnover of a market, and I want to calculate turnover of the next year but I cannot add the future 12 month directly in Qlik.

I don't understand this case. Can't you just add future months to the data model using the forecast calendar approach explained in the usage documentation?

Cheers, Nabeel

acabos91 commented 4 years ago

Hi Nabeel,

Sorry about the delay. And thank you for your precise answer. This change on the return is perfect, this is exactly what I want. For the other, I was not able to made operation of results coming from Pytools. But now I can made operation thanks to Aggr. I misunderstood how to use it with Pytools.

Thanks again for your answer, Regards Anthony

nabeel-oz commented 4 years ago

Great, glad you've got it working.