Topics: |
Once you have finalized your model, you can export the model formula as a routine that can be used to score new data outside of RStat.
RStat offers three main types of export options:
The Exportability column in the Model tab displays the main export file types above that apply to each model.
The Model Export dialog box displays all supported file type options: C, Java, PMML, XML, and Teradata UDF. Additionally, the All option allows you to export the model as all available file types simultaneously in a single session.
How to: |
Models can be exported as C code to be compiled as a User Defined Function (UDF) for use with WebFOCUS servers, as Teradata UDF in C with a SQL template for execution directly on the Teradata database, as Java for deployment to Hadoop, and as PMML for consumption by middleware.
RStat generates a User-Defined Function (UDF) with each model that is exported from RStat as Java. The UDF is a Hive wrapper. It calls the Java export. The Java UDF contains calls to import libraries that are needed to run the model in Hive. The UDF may be customized to enable the Java export to work on any device that supports Java. The Java export name and the number of arguments are dynamically entered in the Java UDF template.
You can use this procedure to export using C, Java, or PMML.
Note: Select Teradata UDF to export scoring functions contained within C files to be consumed as a Teradata User Defined Function (UDF). For more information, see RStat Export for Teradata User Defined Function.
Note: Clear the check box next to either of these include options to exclude these from the exported routine.
Note: When saving a file, an Overwrite Alert displays if the file already exists, as shown in the following image. Click Replace to overwrite the original file. Click Cancel to close the Alert without saving your file.
How to: |
As of RStat Version 1.3.1, you can export Scoring functions contained within C files to be consumed as a Teradata User Defined Function (UDF).
For Big Data Analytics, RStat routines can be deployed for in-database execution. This means that the actual scoring of large amounts of data is generated in the database engine, alleviating the need for extracting the data prior to scoring. When scoring large amounts of data, running the predictive model as an in-database function may result in significant performance gains.
After creating the predictive model, click the Export button. Select the Teradata UDF option on the Export dialog box and then Run. A C file is created in Teradata UDF format, along with the SQL template needed to define the C program to Teradata. All the input fields are automatically defined in the SQL template. However, the actual location of the C file that has been uploaded needs to be modified in the SQL template. Once you have the location and the SQL, the UDF creation process defined by Teradata should be followed.
Once defined as a Teradata UDF, the RStat model can then be defined as an in-database function to WebFOCUS, either at the Metadata or the WebFOCUS procedure level.
The power of an RStat predictive model in-database function means that you can easily incorporate the model into ETL, reporting, Dashboard, or any other native Teradata Client application.
RStat opens.
RStat refreshes to display your data.
This creates a C file on your local drive that contains Teradata.
Note: You can save the C file to any location using the Browse for other folders options.
Along with the C file, an SQL template is created. The items in double angle brackets (<<,>>) need to be modified in the line below:
<< ENTER FULL PATH OF UDF C FILE HERE AND PUT IN SINGLE QUOTE >> EXAMPLE 'CS!<<model name>>!/home/testdrive/ibi/apps/<<model name>>.c!F! <<model name>>'
The following image shows an SQL template that has been modified and pasted into a Basic Teradata Query (BTEQ) tool to create a Teradata UDF.
Using the UDF in an SQL Select, note that the custscore function name matches the C file deployment in Teradata.
The following image shows in-database scored values (Arrows) returned in a report.
RStat models are completely integrated with Information Builders tools. Using predictive models in DataMigrator allows you to segment data based on customer market segmentation.
WebFOCUS | |
Feedback |