Hello Folks,
We all know that SAP (NYSE:SAP) is expanding its business intelligence application offerings with new predictive analysis software that helps businesses tap into big data.
The SAP BusinessObjects Predictive Analysis package includes predictive analysis algorithms, and development and visualization tools for building predictive data models used by analytical applications. SAP is making the software available to select customers now with general availability expected in September.
I thank SAP HANA Team for keeping the PAL Library reference guide, which is self explanatory and a very good guide to start with.
For PAL guide, refer to https://www.experiencesaphana.com/docs/DOC-1402
If you are using HANA Sandbox @Cloudshare, you can access PAL Libraries. If you find any problems in accessing these PAL Libraries and if you receive error message “No ScriptServer available" then you need to implement Note: 1650957 as a work around or you can request inmemorydevcenter@sap.com to enable the script server on your Cloudshare account
Well coming to my example, we will discuss about a sample scenario in which I will use “ABC” analysis to classify the data.
For more information, refer to http://en.wikipedia.org/wiki/ABC_analysis
Now let us get back to our example:
The data set on which we are going to examine contains 150 instances, which refers to a type of plant.
4. Missing Attribute Values: None
We will now try to classify/distribute 33.3% for each of 3 classes.
Now I have created a table TESTDT_TAB as shown below:
As per the reference guide given by SAP, below is the required information for using PAL libraries in SAP HANA.
Prerequisites:
Interface (abcAnalysis):
Function: pal::abcAnalysis
This function performs the ABC analysis algorithm.
L Function Signature:
pal::abcAnalysis ( Table<...> target, Table<...> args, Table<...> result)
Input Table:
Parameter Table:
Output Table:
Now basing on the “SepalLengthCM” we will try to classify the data into 3 Classes.
As we have PAL Libraries already installed, now we need to use these Libraries and write a procedure and call it to classify the data. Execute the following SQL Script:
SQL Script:
DROP TYPE DATA_T;
CREATE TYPE DATA_T AS TABLE("PLANT" VARCHAR(100),"SepalLengthCM" DOUBLE,"SepalWidthCM" DOUBLE,"PetalLengthCM" DOUBLE,"PetalWidthCM" DOUBLE);
DROP TYPE CONTROL_T;
CREATE TYPE CONTROL_T AS TABLE("Name" VARCHAR(100), "intArgs" INT, "doubleArgs" DOUBLE,"strArgs" VARCHAR(100));
DROP TYPE RESULT_T;
CREATE TYPE RESULT_T AS TABLE("ABC" VARCHAR(10),"ITEM" VARCHAR(100));
DROP PROCEDURE palAbcAnalysis;
CREATE PROCEDURE palAbcAnalysis( IN target DATA_T, IN control CONTROL_T, OUT results RESULT_T )
LANGUAGE LLANG
AS
BEGIN
export Void main(Table<String "PLANT", Double "SepalLengthCM",Double "SepalWidthCM",Double "PetalLengthCM",Double "PetalWidthCM"> "target" targetTab,
Table<String "Name", Int32 "intArgs", Double "doubleArgs",String "strArgs"> "control" controlTab,
Table<String "ABC", String "ITEM"> "results" & resultsTab) {
pal::abcAnalysis(targetTab, controlTab, resultsTab);
}
END;
DROP TABLE #CONTROL_TBL;
CREATE LOCAL TEMPORARY COLUMN TABLE #CONTROL_TBL ("Name" VARCHAR(100), "intArgs" INT, "doubleArgs" DOUBLE,"strArgs" VARCHAR(100));
INSERT INTO #CONTROL_TBL VALUES ('START_COLUMN',0,null,NULL);
INSERT INTO #CONTROL_TBL VALUES ('END_COLUMN',1,null,null);
INSERT INTO #CONTROL_TBL VALUES ('THREAD_NUMBER',2,null,null);
INSERT INTO #CONTROL_TBL VALUES ('PERCENT_A',null,0.33,null);
INSERT INTO #CONTROL_TBL VALUES ('PERCENT_B',null,0.33,null);
INSERT INTO #CONTROL_TBL VALUES ('PERCENT_C',null,0.33,null);
DROP TABLE RESULT_TBL;
CREATE COLUMN TABLE RESULT_TBL("ABC" VARCHAR(10),"ITEM" VARCHAR(100));
CALL palAbcAnalysis(TESTDT_TAB, "#CONTROL_TBL", RESULT_TBL) with overview;
SELECT * FROM RESULT_TBL;
Execute SQL Script by pressing "F8".
Now we get the RESULT_TBL filled with the data which is classified as per our requirements as shown below:
In this example, I took a data set of 150 records (Very less amount), it took approximately 203ms for SAP HANA to analyze the data and classify it as shown above.
With SAP planning to offer Predictive Analysis tool set as a package combining the predictive analysis software licenses and HANA licenses. With this tool set Companies can spot fraudulent transactions and predict /forecast the sales.
With High processing capabilities coupled with high performance SAP HANA together with Predictive Analysis tool set can revolutionize the market standards and help companies run better.So am looking forward for the general availability of this tool.
Also read my blog on
Thanks for your time for reading this blog. Do comment your views.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |