Friday 15 December 2017

SAP Automated Predictive Library (APL) Installation and configuration for SAP HANA

What is SAP HANA Automated Predictive Library (APL)?

SAP HANA APL is an Application Function Library (AFL) which lets you use the data mining capabilities of the SAP Predictive Analytics automated analytics engine on your customer datasets stored in SAP HANA.

The APL is:
A set of functions that you use to implement a predictive modeling process in order to answer simple business questions on your customer datasets.
A set of simplified APL procedures: SAPL (Simple APL) that you can also use to call the APL functions.
You can create the following types of models to answer your business questions:

– Classification/Regression models
– Clustering models
– Time series analysis models
– Recommendation models
Installing SAP APL v2.5.10.x on SAP HANA SP10

Software Requirements


You must have the following software installed in order to use this version of SAP APL:

1. SAP HANA SPS10 and higher
2. SAP AFL SDK 1.00.090 or greater (this is part of SAP HANA)
3. unixODBC 64 bits

SAP APL 2.0 Software download path in service market place

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

unixODBC 64 bits


APL has a dependency on the libodbc.so.1 library included in unixODBC. In the latest unixODBC versions, this library is available only in version libodbc.so.2 . The workaround in this situation is to create a symbolic link to libodbc.so.2 named libodbc.so.1 in the same folder.

http://www.unixodbc.org/

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

unixODBC installation


SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

cd <unixODBC install folder> (for example /usr/lib64)

ln –s libodbc.so.2 libodbc.so.1

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

Installing SAP APL v2.5.10.x on SAP HANA SP10


SAP APL deployment in the hana server

Note: You need root privileges (sudo) to run the installer.

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

We could check the add-on installation from SAP HANA Studio

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

After the function library has been installed, the HANA script server must be enabled, and the HANA index server should be restarted. The following tables should contain APL entries which show that the APL is available:

— check that APL functions are there

select * from “SYS”.”AFL_AREAS”;

select * from “SYS”.”AFL_PACKAGES”;

select * from “SYS”.”AFL_FUNCTIONS” where AREA_NAME=’APL_AREA’;

select * from “SYS”.”AFL_FUNCTION_PARAMETERS” where AREA_NAME=’APL_AREA’;

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

select “F”.”SCHEMA_NAME”, “A”.”AREA_NAME”, “F”.”FUNCTION_NAME”, “F”.”NO_INPUT_PARAMS”, “F”.”NO_OUTPUT_PARAMS”, “F”.”FUNCTION_TYPE”, “F”.”BUSINESS_CATEGORY_NAME” from “SYS”.”AFL_FUNCTIONS_” F,”SYS”.”AFL_AREAS” A where “A”.”AREA_NAME”=’APL_AREA’ and “A”.”AREA_OID” = “F”.”AREA_OID”;

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

Configuration


This is the script delivered along with software and could find under the samples directory

hostname:/hana/data/HDB/SAP_APL/apl-2.5.0.0-hanasp10-linux_x64/samples/sql/direct # more apl_admin.sql

-- Run this as SYSTEM

connect SYSTEM password manager;


-- Enable script server

alter system alter configuration ('daemon.ini', 'SYSTEM') set ('scriptserver', 'instances') = '1' with reconfigure;

-- Check that APL functions are there

select * from "SYS"."AFL_AREAS";

select * from "SYS"."AFL_PACKAGES";

select * from "SYS"."AFL_FUNCTIONS" where AREA_NAME='APL_AREA';

select "F"."SCHEMA_NAME", "A"."AREA_NAME", "F"."FUNCTION_NAME", "F"."NO_INPUT_PARAMS", "F"."NO_OUTPUT_PARAMS", "F"."FUNCTION_TYPE", "F"."BUSINES

S_CATEGORY_NAME"

from "SYS"."AFL_FUNCTIONS_" F,"SYS"."AFL_AREAS" A

where "A"."AREA_NAME"='APL_AREA' and "A"."AREA_OID" = "F"."AREA_OID";

select * from "SYS"."AFL_FUNCTION_PARAMETERS" where AREA_NAME='APL_AREA';



-- Create a HANA user known as USER_APL, who's meant to run the APL functions

drop user USER_APL cascade;

create user USER_APL password Password1;

alter user USER_APL disable password lifetime;

-- Sample datasets can be imported from the folder /samples/data provided in the APL tarball

-- Grant access to sample datasets

grant select on SCHEMA "APL_SAMPLES" to USER_APL;

-- Grant execution right on APL functions to the user USER_APL

grant AFL__SYS_AFL_APL_AREA_EXECUTE to USER_APL;

grant AFLPM_CREATOR_ERASER_EXECUTE TO USER_APL; 

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

There is one step not shown in the sample SQL, which is creating the APL_SAMPLES schema, this is straightforward such as

create schema APL_SAMPLES;

Create table types by using the stored procedure “apl_create_table_types.sql”

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

Import samples data from the download directory

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

Check the imported content from SAP HANA studio

SAP Automated Predictive Library (APL), SAP HANA APL, SAP HANA Certifications, SAP APL

The samples should now all be configured and available for use directly via SQL or using Predictive Analysis 2.0.

No comments:

Post a Comment