Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
PhilipMugglestone
Product and Topic Expert
Product and Topic Expert
12,876
The recent release of SAP HANA 2.0 SPS 02 introduces a major new innovation in the area of machine learning and predictive analytics.

HANA already has the Predictive Analysis Library (or PAL) which provides HANA- optimized in-database training and scoring of predictive models (around 80 machine learning and statistical functions) and there are other HANA components such as the Automated Predictive Library (APL) licensed as part of SAP BusinessObjects Predictive Analytics which also enables in-database predictive processing in HANA.

For scenarios where neither of these approaches provides the desired function or algorithm there's always been R integration with SAP HANA which has also been around for some time. Effectively you create a stored procedure in HANA which contains embedded R script and this script along with any input (eg: data, parameters) are transferred to a registered R server for remote processing. Once complete any output (eg: results) are returned and loaded into into HANA tables. This means that thousands of functions including custom functions are available to the HANA user via open-source R.

But the world doesn't stand still. In the meantime Google introduced TensorFlow - an extremely popular and quite fashionable open-source Machine Learning library based on connected data-flow graphs that makes heavy use of Python as a scripting language. Learn more about TensorFlow here: https://www.tensorflow.org/

Wouldn't it be cool if you could access TensorFlow models from HANA?

HANA 2.0 SPS02 includes the External Machine Learning library which makes this possible. The External Machine Learning library (or EML) is packaged as an Application Function Library (AFL) component so if you've used PAL in the past you'll be pretty familiar with how to work with it. Models served by TensorFlow are registered in HANA via remote sources and then accessed through SQL-script.

At this stage it's only possible to perform scoring on models that have already been created in TensorFlow and are being served by TensorFlow serving. As for training a TensorFlow model from HANA - that's not currently possible - but we can always dream.

So now you're raring to get started with HANA and TensorFlow?

The SAP HANA Academy has produced a short series of hands-on video tutorials to show you the ropes:

SAP HANA Academy - EML Playlist

UPDATE 20th Sept. 2017: Please see my more recent blog for latest video tutorials

There are 5 videos covering the following topics with more to be added in the near future:

As always all code snippets are available on GitHub.

The tutorials focus on the "MNIST" example which is the "Hello World" of TensorFlow. It's always good to show integration working with the standard example - so anyone who already knows TensorFlow will be on familiar ground. However this does mean that the HANA SQL-script is not quite as elegant as it one might like - so if you want to make the HANA code cleaner (this does involve tweaking the model in TensorFlow somewhat) then you'll find detailed instructions here. Thanks frank.gottfried!

Have fun!



The SAP HANA Academy provides free online video tutorials for the developers, consultants, partners and customers of SAP HANA.

Topics range from practical how-to instructions on administration, data loading and modeling, and integration with other SAP solutions, to more conceptual projects to help build out new solutions using mobile applications or predictive analysis.

For the full library, see SAP HANA Academy Library – by the SAP HANA Academy

For the full list of blogs, see Blog Posts – by the SAP HANA Academy
8 Comments
NaveenKumarKaus
Participant
0 Kudos
Hello Phillip,

 

Nice blog and cool videos.

 

However many people including me has no knowledge of installing tensorflow serving server and those crucial steps to set up the environment is missing.

 

As you have setup the environment , can you please share the informaiton/document also.

Thanks,

Naveen
PhilipMugglestone
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Naveen,

Thanks for the nice feedback!

For installing TensorFlow Serving, Frank's excellent blog has some details.

As well as the main installation instructions here you can also can also get a pre-built RPM for SLES12 here which avoids the need to build TensorFlow Serving from scratch.

Thanks,

Philip
NaveenKumarKaus
Participant
0 Kudos
Hello Phillip,

 

Great help, was able to install TensorFlow Model. However it did not install Tensor Flow Server and also the directory as you have created , /tfserving/serving' is also not created.

 

One feedback , can we include rpm provided by you in our library and details about it in standard documentation?

Thanks!
PhilipMugglestone
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi,

I was not involved in creating or sharing the RPM myself.

Perhaps frank.gottfried can comment?

Thanks,

Philip
PhilipMugglestone
Product and Topic Expert
Product and Topic Expert
0 Kudos
UPDATE 20th Sept. 2017: Please see my more recent blog for latest video tutorials

 
PhilipMugglestone
Product and Topic Expert
Product and Topic Expert
Hi Naveen,

Just added a video tutorial showing how to install TensorFlow and TensorFlow serving from scratch on Ubuntu in GCP.

Hopefully this will help you get up and running?

Thanks,

Philip
Former Member
0 Kudos

I went through your blog and I must say that you have done a great job in explaining all aspects of SAP HANA External Machine Learning clearly. Would highly appreciate if you could spare some time and take a look at my page.

PhilipMugglestone
Product and Topic Expert
Product and Topic Expert
0 Kudos
The SAP HANA Academy YouTube channel has been closed on December 31, 2023. Selected videos have been moved to microlearning.openSAP.com. See the former SAP HANA Academy playlists

All blogs related to SAP HANA Academy content will no longer be supported / updated. 

The closure of the SAP HANA Academy YouTube channel follows SAP's strategy to consolidate learning sites, unify learning, and simplify the user experience. The future learning platform will be the SAP Learning site (learning.sap.com). You’ll find there free online training, including ~190 SAP Learning Journeys. Here is a short introduction to the SAP Learning site. 

Thanks.