Skip to Content
0

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

Apr 14 at 03:58 AM

92

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Thierry BRUNET
May 04 at 02:32 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Thierry BRUNET
Apr 18 at 07:53 AM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Thierry,

Thanks for your answer. Can you please let me know how it is possible to 'create a view on the fly' by a SAP UI5 application. Is there any API that can be called that will create such a HANA view? Is there a link to any tutorial?

Secondly, the existing tutorials on the SAP Predictive Services only show how to register a table through the dataset/sync API. Can you confirm that the same api can be used to register a HANA view?

Best Regards,

Somnath.

0

Hi,

The answer to your 1st question is yes it is. I have found this blog in which you could find inspiration: Step-By-Step process to develop UI5 Application on HANA DB.

Now there is the SAP HANA Acameny team which publish a lot videos to guide users to use SAP products arround SAP HANA. You could also certainly find useful videos for your project.

For the 2nd question, the answer is also yes. It the same API to register a dataset from a HANA table or from a HANA view. Now I would like to underline one point: with HANA there is a specific kind of views called "calculated views". These views cannot be registed as a dataset ; only classic HANA views can.


Best regards

Thierry


0

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.

0