Skip to Content

Using the Predictive Service (Forecast) in the SAP Cloud Platform on a subset of data

We are trying to use the Predictive Service (Forecast) in the SAP Cloud Platform. We have a table with the fields,

a. Segment ID

b. Date

c. Amount

We want to predict the next 6 values (Amount) for a particular segment ID only and not for the entire table. However, we could not find anyway to register a dataset (from a table) with a filter criteria. Neither did we find a way to use the Forecast api on a subset of the data.

How can we do this? All tutorials use the entire table to forecast data. It seems to be a basic functionality which should be available from the beginning.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 04, 2018 at 02:32 PM

    Hi Kumar,

    For (1) and (4), you should refer to HANA programming. There are a lot of documentation in SAP help portal to explain this in detail. Here is one: https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.01/en-US/20d5fa9b75191014a33eee92692f1702.html

    For (2) and (3), the SAP help of Predictive Service details also how to proceed. SAP Predictive Service is a REST API and you should find easily how to consume REST services inside a Java application (if you are using Java).

    Best regards

    Thierry

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 18, 2018 at 07:53 AM

    Hi,

    The dataset API does not allow to filter a table HANA based on segment ID. It is the responsability of your cloud application to do that. My suggestion will be to implement in your application the creation of a view for the segment you need to analyze. Then you could register this view as a dataset and run a forecast on it.

    I don't know your data and the number of segment you have. But if you have a small number of segment, it will be better to cerate the view in advance. If you have a lot of segments, it will certainly be faster to create a view on the fly.

    Note also 2 things:

    1) the minimum granularity of the time for the forecast is the second.

    2) in a dataset it is important to have only one row for a time value.

    I hope this answer to your question.

    Best regards

    Thierry

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Thierry,

      Thank you for taking time to answer this question. The blog you have mentioned shows how to create an information view using the HANA Studio. I was looking for a way to (1) create a temporary view by calling an api, (2) register the view using the dataset/sync api, (3) call the required predictive service api and finally (4) delete the temporary view by using another api call. I would want to do these because I want to use only a sub-set of data in my HANA table. But I guess this is not possible.

      If I have a HANA table with a 1000 segment ids, I would not want to create 1000 classic HANA views.