Skip to Content

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!

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

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Naveen Kumar

    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

    (0) 
    1. Philip MUGGLESTONE Post author

      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

      (0) 
      1. Naveen Kumar

        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!

        (0) 

Leave a Reply