Oracle® Real-Time Decisions: Platform Developer's Guide Release 3.2
Oracle® Real-Time Decisions: Platform Developer's Guide Release 3.2
Oracle® Real-Time Decisions: Platform Developer's Guide Release 3.2
June 2014
Explains how to develop adaptive solutions with Oracle
Real-Time Decisions (Oracle RTD). Includes a tutorial,
information about integrating with Oracle RTD, and details
about Inline Services.
Oracle Real-Time Decisions Platform Developer's Guide, Release 3.2
E52404-02
Copyright © 2009, 2014, Oracle and/or its affiliates. All rights reserved.
Contributors: Oracle Business Intelligence development, product management, and quality assurance teams
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it
on behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data
delivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of
the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software
License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software or hardware is developed for general use in a variety of information management
applications. It is not developed or intended for use in any inherently dangerous applications, including
applications that may create a risk of personal injury. If you use this software or hardware in dangerous
applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other
measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages
caused by use of this software or hardware in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks
of their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks
are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,
Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced
Micro Devices. UNIX is a registered trademark of The Open Group.
This software and documentation may provide access to or information on content, products, and services
from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and
its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of
third-party content, products, or services.
Contents
Preface ............................................................................................................................................................... xv
Audience..................................................................................................................................................... xv
Documentation Accessibility ................................................................................................................... xv
Related Documents ................................................................................................................................... xvi
Conventions ............................................................................................................................................... xvi
iii
2.5.3 Mapping the Entity to the Data Source ............................................................................ 2-9
2.6 Adding an Informant ................................................................................................................. 2-9
2.6.1 Creating an Informant...................................................................................................... 2-10
2.6.2 Adding Testing Logic to the Informant......................................................................... 2-10
2.7 Testing the Inline Service........................................................................................................ 2-11
2.8 Adding Functionality .............................................................................................................. 2-12
2.8.1 Creating a Call Entity ....................................................................................................... 2-13
2.8.2 Creating the Call Begin Informant ................................................................................. 2-14
2.8.3 Creating the Service Complete Informant .................................................................... 2-15
2.8.4 Creating the Call End Informant .................................................................................... 2-16
2.8.5 Testing the Informants ..................................................................................................... 2-18
2.9 Analyze Call Reasons .............................................................................................................. 2-19
2.9.1 About Using Choices for Analysis ................................................................................. 2-19
2.9.2 Adding a Choice Group................................................................................................... 2-20
2.9.3 Adding an Analytical Model .......................................................................................... 2-21
2.9.4 Adding Logic for Selecting Choices............................................................................... 2-22
2.9.5 Testing It All Together ..................................................................................................... 2-24
iv
5.1.5 Creating the Feedback Informant...................................................................................... 5-5
5.1.6 Testing the Feedback Informant ........................................................................................ 5-8
5.1.7 Updating the Load Generator Script ................................................................................ 5-9
5.2 Using the Predictive Power of Models ................................................................................. 5-12
5.2.1 Adding a Base Revenue Choice Attribute..................................................................... 5-13
5.2.2 Adding a Second Performance Goal (Maximize Revenue) ........................................ 5-13
5.2.3 Calculating Score Value for the Maximize Revenue Performance Goal .................. 5-14
5.2.4 Updating the Select Offer Decision to Include the Second Performance Goal........ 5-15
5.2.5 Adding a Choice Attribute to View Likelihood of Acceptance ................................. 5-15
5.2.6 Checking the Likelihood Value ...................................................................................... 5-16
5.2.7 Introducing Offer Acceptance Bias for Selected Customers ...................................... 5-20
5.2.8 Running the Load Generator Script ............................................................................... 5-21
5.2.9 Studying the Results......................................................................................................... 5-23
v
9 Using the .NET Smart Client
9.1 Before You Begin......................................................................................................................... 9-1
9.2 Integrating with an Inline Service Using the .NET Smart Client......................................... 9-2
9.3 .NET Integration Example ......................................................................................................... 9-2
vi
12.3.7 Opening Decision Studio Version 1.2 Files ................................................................. 12-11
12.4 Inline Service Directory Structure ....................................................................................... 12-12
12.5 Configuring Inline Services .................................................................................................. 12-12
12.5.1 Observer Inline Services ................................................................................................ 12-12
12.5.2 Advisor Inline Services .................................................................................................. 12-13
vii
13.5.13 Session APIs..................................................................................................................... 13-16
13.5.14 Entity APIs ....................................................................................................................... 13-16
13.5.15 About Entity Classes ...................................................................................................... 13-17
13.5.16 Referencing Entities in Oracle RTD Logic................................................................... 13-17
13.5.17 Adding Entity Keys ........................................................................................................ 13-17
13.5.18 Accessing Entity Attributes........................................................................................... 13-17
13.5.19 Resetting and Filling an Entity ..................................................................................... 13-18
13.5.20 About Cached Entities ................................................................................................... 13-18
13.5.21 Enhanced Entity Attribute Logging............................................................................. 13-19
13.6 Performance Goals................................................................................................................. 13-20
13.6.1 Adding a Performance Metric ...................................................................................... 13-20
13.6.2 Calculating a Normalization Factor ............................................................................. 13-21
13.7 Choice Groups and Choices ................................................................................................. 13-22
13.7.1 About Choice Groups and Choices.............................................................................. 13-23
13.7.2 About Choice Group and Choice Attributes .............................................................. 13-24
13.7.3 Choice Attribute Characteristics................................................................................... 13-26
13.7.4 Using Choice Attributes for Learning ......................................................................... 13-27
13.7.5 About Choice Scoring .................................................................................................... 13-27
13.7.6 About Eligibility Rules................................................................................................... 13-27
13.7.7 Evaluating Choice Group Rules and Choice Eligibility Rules ................................. 13-28
13.7.8 Determining Eligibility .................................................................................................. 13-28
13.7.9 Choice Group APIs......................................................................................................... 13-28
13.7.10 Choice APIs ..................................................................................................................... 13-29
13.8 Filtering Rules......................................................................................................................... 13-29
13.9 Scoring Rules .......................................................................................................................... 13-30
13.10 Using Rule Editors ................................................................................................................. 13-32
13.10.1 Oracle RTD Rule Terms and Statements ..................................................................... 13-33
13.10.2 Adding Statements to Rules.......................................................................................... 13-37
13.10.3 Selecting an Operator ..................................................................................................... 13-38
13.10.4 Editing Boolean Statements........................................................................................... 13-39
13.10.4.1 Using Type-Restricted Objects in Rules ............................................................... 13-39
13.10.5 Editing Rule Properties.................................................................................................. 13-39
13.10.6 Inverting Rule Elements ................................................................................................ 13-40
13.11 About Decisions ..................................................................................................................... 13-40
13.11.1 Segmenting Population and Weighting Goals ........................................................... 13-42
13.11.2 Using a Custom Selection Function ............................................................................. 13-44
13.11.3 Pre/Post-Selection Logic ............................................................................................... 13-44
13.11.4 Selection Function APIs for Custom Goal Weights ................................................... 13-44
13.11.5 Adding Imported Java Classes and Changing the Decision Center Display......... 13-44
13.12 About Selection Functions .................................................................................................... 13-44
13.12.1 Selection Function Scriptlets ......................................................................................... 13-45
13.12.2 Adding Imported Java Classes and Changing the Decision Center Display......... 13-46
13.13 About Models ......................................................................................................................... 13-46
13.13.1 Model Types .................................................................................................................... 13-47
13.13.2 Model Common Parameters ......................................................................................... 13-48
13.13.3 Model Attributes............................................................................................................. 13-49
13.13.4 Model APIs ...................................................................................................................... 13-51
viii
13.13.4.1 Querying the Model ................................................................................................ 13-51
13.13.4.2 Recording the Choice with the Model.................................................................. 13-52
13.13.4.3 Obtaining Model Object by String Name............................................................. 13-52
13.13.4.4 Recording Choice Events for Choice Event Models ........................................... 13-53
13.13.4.5 Recording Choices for Choice Models ................................................................. 13-54
13.13.4.6 Obtaining Model Choice Likelihood .................................................................... 13-55
13.14 About Integration Points ...................................................................................................... 13-55
13.14.1 About Informants ........................................................................................................... 13-56
13.14.1.1 Adding a Session Key ............................................................................................. 13-57
13.14.1.2 Identifying the External System and Order......................................................... 13-57
13.14.1.3 Adding Request Data.............................................................................................. 13-57
13.14.2 Adding Imported Java Classes and Changing the Decision Center Display......... 13-57
13.14.3 Informant APIs................................................................................................................ 13-57
13.14.4 Informant Logic............................................................................................................... 13-58
13.14.4.1 Logic .......................................................................................................................... 13-58
13.14.4.2 Asynchronous Logic ............................................................................................... 13-58
13.14.4.3 Accessing Request Data From the Informant...................................................... 13-58
13.14.5 About Advisors ............................................................................................................... 13-58
13.14.6 About the Advisor Decisioning Process...................................................................... 13-59
13.14.7 Adding Imported Java Classes and Changing the Decision Center Display......... 13-59
13.14.8 Adding a Session Key .................................................................................................... 13-59
13.14.9 Identifying the External System and Order ................................................................ 13-59
13.14.10 Adding Request Data ..................................................................................................... 13-60
13.14.11 Adding Response Data .................................................................................................. 13-60
13.14.12 Logic in Advisors............................................................................................................ 13-61
13.14.12.1 Logic .......................................................................................................................... 13-61
13.14.12.2 Asynchronous Logic ............................................................................................... 13-61
13.14.13 Accessing Request Data from the Advisor ................................................................. 13-61
13.15 About External Systems ........................................................................................................ 13-61
13.16 About the Categories Object................................................................................................. 13-62
13.17 About Functions..................................................................................................................... 13-62
13.17.1 Functions to Use with Choice Event History Table................................................... 13-63
13.17.2 About Maintenance Operations ................................................................................... 13-63
13.17.3 Adding Imported Java Classes and Changing the Decision Center Display......... 13-64
13.18 About Type Restrictions ....................................................................................................... 13-64
13.18.1 Managing Type Restrictions ......................................................................................... 13-65
13.18.1.1 Creating and Editing "List of Values" Type Restrictions ................................... 13-65
13.18.1.2 Creating and Editing "List of Entities" Type Restrictions.................................. 13-65
13.18.1.3 Creating and Editing Other Restrictions.............................................................. 13-66
13.18.1.4 Associating Type Restrictions with Inline Service Objects................................ 13-66
13.18.1.5 Using Type Restrictions in Rules .......................................................................... 13-67
13.18.1.6 Examples of Type Restrictions............................................................................... 13-67
13.19 About Statistic Collectors...................................................................................................... 13-69
13.19.1 Creating a Custom Statistics Collector ........................................................................ 13-70
13.20 About Decision Center Perspectives ................................................................................... 13-70
ix
14 Deploying, Testing, and Debugging Inline Services
14.1 Deploying Inline Services ....................................................................................................... 14-1
14.2 Connecting to Real-Time Decision Server............................................................................ 14-3
14.3 Redeploying Inline Services ................................................................................................... 14-4
14.4 Testing and Debugging Inline Services ................................................................................ 14-5
14.4.1 About the Problems View ............................................................................................... 14-5
14.4.2 Using the Test View.......................................................................................................... 14-5
14.4.2.1 Using logInfo() ........................................................................................................... 14-6
14.4.2.2 Testing for Incoming Request Data ........................................................................ 14-6
14.4.3 Using System Logs for Testing and Debugging Inline Services ................................ 14-7
x
16.3.2.1 Notes on Batch Console Commands .................................................................... 16-11
16.3.2.2 Running Jobs Sequentially ..................................................................................... 16-12
16.3.2.3 Running Jobs Concurrently.................................................................................... 16-13
xi
17.3 Example of End to End Development Using Dynamic Choices and External Rules... 17-39
17.3.1 Database Driven Dynamic Choices.............................................................................. 17-40
17.3.2 Evaluating External Rules ............................................................................................. 17-41
17.3.3 Embedding an External Rule Editor in a Third Party Interface............................... 17-41
17.3.4 DC_Demo External Rules Deployment Helper.......................................................... 17-44
17.3.5 Pushing External Rules To a Production Environment ............................................ 17-45
17.3.6 Viewing Reports for Dynamic Choices ....................................................................... 17-46
17.4 Externalized Performance Goal Weighting........................................................................ 17-46
xii
C.1.1.1 Overview of Oracle R Enterprise Architecture ....................................................... C-1
C.1.1.2 Joint Implementation Architecture for Oracle RTD with ORE............................. C-2
C.1.2 Setting up ORE for Use by Oracle RTD........................................................................... C-3
C.1.2.1 Obtaining R................................................................................................................... C-3
C.1.2.2 Users, Roles, and Privileges ....................................................................................... C-3
C.1.2.3 Special Considerations for Data Sources.................................................................. C-3
C.1.3 Integration Example ........................................................................................................... C-3
C.1.3.1 Steps for Making Use of R Scripting in Oracle RTD Inline Services .................... C-4
C.1.3.2 Creating a Script Launching Function...................................................................... C-4
C.1.3.3 Mapping an Entity Attribute to the New Function ................................................ C-5
C.1.3.4 Using the New Entity Attribute in Decision Logic................................................. C-6
C.1.3.5 Creating a Deployment Function .............................................................................. C-6
C.1.3.6 Creating a Deployment Informant............................................................................ C-7
C.1.3.7 Building and Saving a Linear Regression Model in R ........................................... C-8
C.1.3.8 Updating the Script ..................................................................................................... C-8
C.1.3.9 Testing the Inline Service ........................................................................................... C-9
C.1.4 Performance and Scalability Considerations.................................................................. C-9
xiii
xiv
Preface
Oracle Real-Time Decisions (Oracle RTD) enables you to develop adaptive enterprise
software solutions. These adaptive solutions continuously learn from business process
transactions while they execute and optimize each transaction, in real time, by way of
rules and predictive models.
This document is divided into four parts:
■ Part I, "Getting Started" is a tutorial that provides information and examples to
help you get started using Oracle RTD.
■ Part II, "Integration with Oracle RTD" provides information about integrating with
Oracle RTD, including information about Oracle RTD Smart Clients, Web services,
and directly messaging Real-Time Decision Server.
■ Part III, "Decision Studio Reference" identifies each of the elements used to
configure Inline Services, including the properties of each Inline Service and the
available APIs.
■ Part IV, "Miscellaneous Application Development" provides an in-depth look at
the concepts, components, and processes involved in Oracle RTD application
development that require special processing, such as batch framework and
external editors that enable modification of Oracle RTD application objects.
Audience
Part I of this document is designed to help technical users of Oracle RTD get
acquainted with the capabilities, terminology, tools, and methodologies used to
configure Inline Services.
Part II of this document is intended for developers who will use the Java-based API,
.NET component, or Web services to integrate enterprise applications with Oracle RTD
Inline Services.
Part III of this document is designed for technical users configuring Inline Services
using Decision Studio.
Part IV of this document is designed for technical users who will develop batch jobs or
external editors that interface with Oracle RTD application objects.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
xv
Access to Oracle Support
Oracle customers have access to electronic support through My Oracle Support. For
information, visit
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are
hearing impaired.
Related Documents
For more information, see the following documents in the Oracle RTD Release 3.2
documentation set:
■ Oracle Real-Time Decisions Release Notes
■ Oracle Real-Time Decisions Installation and Administration Guide
■ Oracle Real-Time Decisions Decison Center User's Guide
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
xvi
Part I
Part I Getting Started
The chapters in Part I are a tutorial that provide an introduction to using Oracle RTD.
The examples in these chapters assume the reader has installed Oracle RTD on a
Windows system.
Part I contains the following chapters:
■ Chapter 1, "About Oracle Real-Time Decisions"
■ Chapter 2, "Creating an Inline Service"
■ Chapter 3, "Simulating Load for Inline Services"
■ Chapter 4, "Enhancing the Call Center Inline Service"
■ Chapter 5, "Closing the Feedback Loop"
1
1 About Oracle Real-Time Decisions
This chapter introduces the components of Oracle Real-Time Decisions (Oracle RTD),
with particular emphasis on the development tool Decision Studio and the Web-based
application Decision Center. This chapter also introduces Inline Services, which are
created to model business processes, gather statistics, and make recommendations,
and describes how Inline Services are used in the development cycle. Decision Studio
is used to configure Inline Services, and Decision Center enables business analysts to
monitor and optimize deployed Inline Services.
Oracle Real-Time Decisions (Oracle RTD) provides a new generation of enterprise
analytics software solutions that enable companies to make better decisions in real
time at key, high-value points in operational business processes.
Oracle RTD easily integrates with enterprise applications both on the front end (such
as CRM applications) and on the back end (such as enterprise data stores). Oracle RTD
also includes other helpful load testing and debugging tools.
This chapter contains the following topics:
■ Section 1.1, "Terminology"
■ Section 1.2, "About Decision Studio"
■ Section 1.3, "About Decision Center"
■ Section 1.4, "About the Inline Service Lifecycle"
1.1 Terminology
Oracle RTD consists of five components:
■ Decision Studio
■ Real-Time Decision Server
■ Decision Center
■ Administration (JMX)
■ Load Generator
Inline Service refers to the configured application that is deployed.
Inline Services are configured and deployed using Decision Studio and analyzed and
updated using Decision Center. Inline Services run on Real-Time Decision Server.
An Inline Service can gather data and analyze characteristics of enterprise business
processes on a real-time and continuous basis. It also leverages that data and analysis
to provide decision-making capability and feedback to key business processes.
Note: The following terms are referenced throughout the Oracle RTD
documentation:
■ RTD_HOME: This is the directory into which Oracle RTD is
installed. For example, C:\OracleBI\RTD.
■ RTD_RUNTIME_HOME: This is the application server specific
directory in which the application server runs Oracle RTD.
For more information, see the section "About the Oracle RTD
Run-Time Environment" in Oracle Real-Time Decisions Installation and
Administration Guide.
Tip: You may want to close the Cheat Sheets View to give more
editor space. The Cheat Sheets are not used in this tutorial.
To show additional views or open views that were closed, click the Window menu in
Decision Studio and choose Show View, then choose from the list of available views.
The following steps outline the overall process by which Inline Services are created,
deployed, and downloaded:
1. Create: Using Decision Studio, elements are configured to align with the business
process into which Oracle RTD is to be integrated. Examples of elements are:
Choice Groups, Performance Goals, Decisions, Informants, Advisors, Entities, and
Data Sources.
Some elements allow the use of Java scriptlets in Logic and Asynchronous Logic
attributes. For instance, an Informant element is shown in Figure 1–4. This element
is named 'Call Begin.' In addition to the Description and the Advanced button,
there are three tabs, each with a set of attributes for the Informant.
In the Logic tab of this 'Call Begin' Informant, we can write optional Java code to
perform specific tasks, as shown in Figure 1–5.
As elements are created and saved, XML metadata is created in memory that
describes the object.
2. Save: By saving the Inline Service in Decision Studio, the metadata is written to an
Inline Service directory on the local file system, in XML files with the extension
*.sda. The metadata that follows is an example of the content saved for the
Informant 'Call Begin', in a file called CallBegin.sda.
<?xml version="1.0" encoding="UTF-8"?>
<sda:RTAPType xmlns:sda="http://www.sigmadynamics.com/schema/sda"
internalName="CallBegin" lastModifiedTime="1133228616435" name="Call Begin"
schemaVersion="20050818" forcesSessionClose="false" order="1.0">
<sda:description>The Call Begin Informant starts the session after the
customer's call enters the IVR system. Logic could be added here to pre-
populate certain values (example: customer profile) that may be used later
on.</sda:description>
<sda:system ref="Ivr"/>
<sda:sessionKey path="customer.customerId" relativeTo="session"/>
<sda:requestMapper internalName="RequestMapper">
<sda:entity type="ApplicationSession" var="session"/>
<sda:dataSource type="RequestDataSource" var="result">
<sda:arg>
<sda:path localVarName="session" path="request" relativeTo="local"/>
</sda:arg>
</sda:dataSource>
</sda:requestMapper>
<sda:requestData internalName="RequestDataSource">
<sda:param internalName="message" dataType="object"
objectType="com.sigmadynamics.client.wp.SDRequest"/>
<sda:request>
<sda:resultSet/>
</sda:request>
</sda:requestData>
<sda:body>
<sda:java order="0">/* Trigger data retrieval
*/
session().getCustomer().fill(); </sda:java>
</sda:body>
<sda:postOutputBody/>
</sda:RTAPType>
The attributes that were assigned to the element in Decision Studio, such as
Session Key and External System, are represented here. Note that the Java
scriptlet is also inserted into the body of the XML file.
As Inline Service elements are added, configured, and saved, Decision Studio
automatically generates the necessary Java code and compiles them into Java class
files. Two classes of Java code are generated. The first set is the base Java files used
by the Inline Service; these files are named the element id preceded by GEN. For
example, the CallBegin element will produce a file called GENCallBegin.java.
The second set of Java files is created to allow overriding of the generated code.
These files are named the same as the element ID. For instance, the CallBegin
element will produce a file named CallBegin.java. Note that by default, the
Java class CallBegin simply extends the class GENCallBegin.
When the Inline Service is compiled, the generated code is used unless we
specifically instruct that the override code be used. To do this, update and move
the override Java file (for example, CallBegin.java) from the generated source
files folder:
Inline_Service_project_root_folder\gensrc\com\sigmadynamics\sdo
Decision Studio will now compile using the override Java file instead of the
generated Java file.
Tip: The XML for any Inline Service object can be viewed with
Decision Studio's built-in Text Editor. Right-click an Inline Service
object in the Inline Service Explorer View, then select Text Editor from
the Open With menu. To switch back to normal editor format, select
the option Inline Service Editor.
Note that you should not edit the XML (*.sda) files directly to
modify the Inline Service objects; instead, use the corresponding Inline
Service Editors.
5. Redeploy: If updates are made to the Inline Service in Decision Center, the
changes can be made available for use by redeploying the Inline Service in
Decision Center. The Management Service will regenerate all necessary metadata
and Java files, recompile the Inline Service, store the Inline Service in the database,
and load it in memory.
6. Download: Using Decision Studio, you can download a deployed Inline Service
from the server. Downloading involves copying the Inline Service that resides in
the database and placing all of the metadata, Java, and class files into a Decision
Studio project on the hard drive. This is useful if you were not the original
developer of the Inline Service and thus do not have the metadata files. Even if
you had originally developed and deployed the Inline Service from Decision
Studio, if your business process allows other users to make changes and redeploy
the Inline Service through Decision Center, then to make additional changes to the
Inline Service in Decision Studio, you would first need to download the latest
version from the server.
This is the introductory chapter in a tutorial section which describes, step by step, how
to create and configure an Inline Service. It introduces the main Inline Service elements
- data sources, entities, informants, advisors, choice groups, models, decisions - and
shows how to create and test them in Decision Studio.
The tutorial section is designed to demonstrate how to build an Inline Service that acts
as an Observer. Observer Inline Services are aimed at analyzing characteristics of
target process on a real-time and continuous basis. An Observer Inline Service guides
business users in their analysis of those various business events and how they change
over time.
The Inline Service for this tutorial is based around a credit card company's call center.
The Inline Service will collect data about the customer and the call center operational
system and will analyze information about the call and its resolution.
The goal of this Inline Service is to analyze the patterns about calls, reasons for calling,
and customers. In later sections, we will extend the capability of this Inline Service to
provide recommendations to the CRM system on cross selling offers and then to add
feedback to the service on the success of its recommendations.
This chapter contains the following topics:
■ Section 2.1, "About the Inline Service Tutorial"
■ Section 2.2, "About Deployment and Decision Center Security"
■ Section 2.3, "About Naming and Descriptions"
■ Section 2.4, "Accessing Data"
■ Section 2.5, "About the Session Entity"
■ Section 2.6, "Adding an Informant"
■ Section 2.7, "Testing the Inline Service"
■ Section 2.8, "Adding Functionality"
■ Section 2.9, "Analyze Call Reasons"
■ Logic is added in the form of Java scriptlets to certain elements that perform
operations.
■ The Inline Service is deployed to Real-Time Decision Server, where it runs.
■ Reports generated from the use of the Inline Service are viewed through Decision
Center.
In this tutorial the following elements are added and configured:
1. Application: The Application element establishes any application level settings
that are needed, as well as defines security for the Inline Service. An Application
element is automatically created for every Inline Service.
2. Performance Goals: Performance Goals represent organizational goals composed
of metrics that are optimized using scoring. For instance, revenue and call
duration are performance metrics. An organizational goal would be to maximize
revenue while minimizing call duration.
3. Data source: The data source element acts as a provider of data from an outside
data source. The structure and format of data from data sources can vary. For
example:
■ Rows and columns of a RDBMS table
■ Output values and result row sets from a stored procedure
A data source is a provider of data that you can map to Entity elements to supply
the data for those elements.
For example, in this tutorial we add a data source that connects to a table in the
database. This table contains customer data.
4. Entity: The Entity is a logical representation of data that can be built from one or
more data sources. Entities serve the following purposes:
■ To organize the data into objects for organizational, analytical, and modeling
purposes.
■ To allow relatively easy and intuitive access from Java code of data from
various sources.
■ To hide the details by which the data is obtained so that those details can
change without requiring the logic to change.
■ To hide the mechanisms by which the data is obtained to save the user of this
data from needing to deal with the APIs that are used to obtain the data.
■ To support sharing of objects when objects need to be shared. For example, an
object representing a service agent could be used in multiple sessions.
Attributes of an entity can be key values. The entity key is used to identify an
instance of an entity.
For example, in this tutorial we create an entity to represent a customer. The
attributes of that entity are mapped to the data source for values. The customer ID
is chosen as the key for the customer entity.
Later we will also create an entity that represents a Call.
5. Session Entity: The Session entity is a special entity of an Inline Service. The
Session entity represents a container for attributes that are specific to a particular
defined Session. The Session key uniquely identifies each individual session.
Entities that have been defined can be associated with the session by being made
attributes of the Session Entity. Only Entities that are Session attributes can have
their keys marked as session keys.
For example, in this tutorial we add the Customer entity to the Session entity as an
attribute, and then we choose the Customer key value, Customer ID, as a Session
key.
6. Informant: An Informant is an Integration Point within the Inline Service that
identifies the business interactions as they occur and triggers business logic that
continuously identifies relevant statistical patterns in the data. Informants watch a
process; they do not interact with it.
In this tutorial, we first create a testing Informant, and then create an Informant
that gathers completion of service data from a CRM system.
Later in the tutorial, we create an Informant that provides feedback to the Inline
Service on the success or failure of the predictions of the model.
7. Choice Groups: Choice Groups are useful for organizing choices. Choice Groups
can be used in one of two ways: they provide a way to organize the observations
that are collected and analyzed; they are also a way to organize the feedback we
will give to the business process through the Advisor Integration Points.
For example, in this tutorial we first create Choice Group that organizes the reason
for calls. When we extend the Inline Service to include an Advisor, a Choice Group
is used to organize cross sell offers that are recommended to the service center
agent.
8. Models: Built-in analytical models allow self-learning and automatic analysis.
Models can be used to simply analyze data, or to make recommendations to the
business process.
In this tutorial, we create a model that analyzes the reasons for calls, and then later
a model which helps to determine the most likely cross sell offer to be accepted by
the customer.
9. Decision: A Decision is used by an Advisor to determine eligible Choices, score
those Choices dynamically, weight the scoring according to segments of the
population and its designated performance goals, and present to best-fit choice.
10. Advisors: An Advisor is an integration point that returns information back to the
business process that calls it. Advisors call Decisions in the Inline Service that
returns one or many ranked choices.
In this tutorial, we will create a Choice Group of offers that can be made to callers
to the credit card service center. The Advisor calls on a Decision to determine the
best offer for the caller based on information about the call and caller. The Advisor
passes that cross sell recommendation to the front end application, so that the call
center agent can make the offer.
If necessary, contact the administrator responsible for installing and setting up your
Oracle RTD system.
Note: This tutorial assumes you are using a new installation, with
the original preferences set. If Decision Studio or Eclipse has been
used in the past, you may want to switch to a new workspace. To
switch to a new workspace, choose File > Switch Workspace and
choose a new workspace folder.
2. Enter the name for the project, Tutorial, and choose the Basic template. Click
Finish. If you are asked about upgrading the Inline Service, select Yes. The Inline
Service project is created in the Inline Service Explorer. By default, the files for the
project/Inline Service are stored in the Decision Studio workspace, in a folder with
the same name as the project (for example, C:\Users\Windows_user\Oracle
RTD Studio\Tutorial).
3. In Decision Studio, expand the Tutorial > Service Metadata folder. Double-click
the Application element to bring up the element editor. In the element editor, type
a description for the Tutorial Inline Service.
Note: You may notice that there are some other data sources already
defined. These are part of the Inline Service framework and are not
used in this tutorial.
4. All of the columns of the table are imported into the Output columns table.
5. Set the input column for the data source. The input is the column on which you
will be matching to retrieve the data record. In this case, we can select the column
name Id from the Output columns table and click the right arrow to move Id to
the Input columns table. The data type is Integer.
6. Set the output columns for the data source. In the Output columns table, select
and use Remove to remove all except the columns listed in Table 2–1.
7. Save your work by choosing File > Save All. If there are errors in your work, you
will receive notification in the Problems View.
Note: You can use Import to import the column names and data
types to the Outputs for the data source. Remove any columns you
will not be using with Remove.
2. Click Import to import the attributes names and data types from Customer Data
Source. Leave the option Build data mappings for the selected data source
selected.
3. In the column Default Value of the Definition tab, click to get an insertion point
and add a default value for each of the attributes listed in Table 2–2. Values for
String data types will be automatically surrounded by double quotes.
2. Save your work using File > Save All. You may see several errors in the Problems
View - this is expected because the mapping definition of the Customer entity
attributes to its data source is incomplete. Proceed to the next section in order to
complete the mapping definition.
for more information). We need to now map the input column value for the Customer
Data Source in the Customer entity.
To map the input column value for the Customer Data Source:
1. Open the Customer Entity and select the Mapping tab. Entity editors are identified
by an E icon:
2. Because we used Import, the Customer Data Source attributes are already mapped
to the Customer entity attributes. For attribute Age, the Source value should look
like Customer Data Source / Age (or Customer Data Source.Age if the
Show Object ID icon is selected). If you had added additional attributes beyond
the import, they are mapped by clicking the ellipsis under Source and locating the
data source attribute.
3. We need to identify the input column values for each Data Source (in this case,
Customer Data Source) in the Attributes table. The input columns for the data
source are the identifier (the WHERE clause in a SQL select statement) by which
records are retrieved. In the Customer Data Source, we had only one input
column, Id, thus in the Mapping tab, we will see only one entry in the Data
Source Input Values table, located below the Attributes table. In the Input Value
cell of this entry, click the ellipsis to open the Edit Value dialog.
4. For this Inline Service, we will select the Customer entity's key. Choose Attribute
or Variable. Expand Customer, select customerId, then click OK.
1. In the Inline Service Explorer, go to Integration Points and then select Informants.
Right-click and select New Informant from the menu. Enter an object name,
Testing, then click OK.
2. In the Testing Editor, add a description under Description.
3. Click Advanced next to Description. Deselect Show in Decision Center. This will
make this Informant invisible to the business users of Decision Center. Click OK.
2. To add a session key, click Select under Session Keys. Choose customerId from
Customer. Click OK.
3. Choose the Logic tab. Under Logic, add the following scriptlet:
logInfo("Customer age = " + session().getCustomer().getAge() );
The logInfo call allows us to output information to the Log subtab of the Test view
and also the server log file (usually in RTD_HOME\log). We will use the session
to access the Customer object and get the contents of the age attribute.
4. Now we should be ready to deploy. Save the configuration by choosing File >
Save All.
Figure 2–3 shows how the Testing Informant will access customer data when the
Informant is called and a session created.
You can also use the menu item Project > Deploy to deploy your Inline Service.
2. Click Select to select the server where you want to deploy. Deploy to the location
of your Real-Time Decision Server. This defaults to localhost, as does the
default configuration of the installation. Enter the user name and password
provided for you, as described in Section 2.2, "About Deployment and Decision
Center Security." Use the drop-down list to select a deployment state,
Development. Select Terminate Active Sessions (used for testing). Click Deploy.
Deployment takes anywhere from about 10 seconds to a few minutes. A message
'Tutorial deployed successfully' will appear below the Inline Service Explorer
when deployment is complete.
3. In the Test View at the bottom of the screen, select Testing as the Integration Point
to test. Enter a value for customerId by typing 7 in the field. Click the Send icon:
4. Select the Log tab within Test View to see the results. Every printout coming from
a logInfo command will be printed out with a timestamp.
Your results should look similar to the following:
11:53:54,102 Customer age = 38
Using this entity, we will explore the factors related to the reasons for calls, like the call
lengths for each call reason, the most likely customer characteristics for these calls, and
so on. In order to gather and analyze the call reasons gathered by the Informant, a
self-learning analytical model will be added and reports will be displayed in Decision
Center.
This section contains the following topics:
■ Section 2.8.1, "Creating a Call Entity"
■ Section 2.8.2, "Creating the Call Begin Informant"
■ Section 2.8.3, "Creating the Service Complete Informant"
■ Section 2.8.4, "Creating the Call End Informant"
■ Section 2.8.5, "Testing the Informants"
■ On the Definition tab of the Entity Editor, click Add Attribute. Add Attribute
appears. Enter the values from the table and click OK.
■ Click in Type. Choose the proper data type for each attribute using the
drop-down list.
the Inline Service, the Integration Map in Decision Center will look like the one
shown in Figure 2–5.
7. Save the changes to the Inline Service by choosing File > Save All.
5. While still in the Request tab, choose CRM from the External System drop-down
list and enter 2 in the Order box. Do not select Force session close.
6. To add the additional pieces of data to the Informant, do the following for each
incoming parameter listed in Table 2–4:
■ On the Request tab of the Informant Editor, click Add. Enter the name and
then select the data type using the drop-down list. Click OK.
■ Under Session Attribute, click the ellipsis to use Assignment. Expand the
Session folder, then expand call and then the select the call attribute that
matches the incoming item.
Table 2–4 Data Types and Session Attributes for Incoming Parameters
Incoming Parameter Name Type Session Attribute
agent String call / agent (or call.agent if the Show Object
ID icon is selected)
length Integer call / length (or call.length if the Show
Object ID icon is selected
reason code Integer call / reason code (or call.reason code if the
Show Object ID icon is selected)
8. Save the changes to the Inline Service by choosing File > Save All.
7. Save the changes to the Inline Service by choosing File > Save All.
Figure 2–6 shows how the three Informants access and update the same session.
In the Log tab within the Test View, you should see a message indicating that the
Call Begin integration point was called.
3. Repeat the process for the other two integration points, Service Complete and
Call End, in order and with the input values as shown in Table 2–5. Examples of
what you should see in the Log tab are also shown in Table 2–5.
Table 2–5 Input Values for Integration Points with Log Results
Integration Point Request Inputs Log Tab
Call Begin customerId: 7 09:15:41,753 Integration Point - CallBegin:
Start Session for customerID = 7
Service Complete customerId: 7 09:17:51,845 Integration Point - Service
agent: John Complete
09:17:51,845 Reason Code: 18
length: 21 09:17:51,845 Agent: John
reason code: 18 09:17:51,845 Call Length: 21
Call End customerId: 7 09:20:17,342 Integration Point - CallEnd
09:20:17,342 ***************************
Note that you could have called the Informants in any order. The Call Begin
Informant is not needed to start a session and Call End is not needed to end the
session. If we had called only the Service Complete Informant, the session would
still be started correctly and the response would have been the same, although the
session would then remain open. We are working with three Informants in this
tutorial to demonstrate the different locations of a call center process that could
make calls to Real-Time Decision Server.
3. To create choices underneath the group, right-click the Call Reason choice group
in the Inline Service Explorer and select New Choice. Add a Choice called Check
Balance.
Repeat this step for the choices Make Payment, Rate Inquiry, and Other.
Add a description for each.
4. In the Inline Service Explorer, under Choices, expand the Call Reason group to
show the choices.
5. For each of the four choices, select the Choice in the Inline Service Explorer. In the
Editor for that choice, under the Attribute Values tab, for the attribute code, set
the Attribute Value as shown in Table 2–6.
6. Save the changes to the Inline Service by choosing File > Save All.
int code=session().getCall().getReasonCode();
switch (code) {
case 17:
ReasonAnalysis.addToChoice("CheckBalance");
logInfo (" CheckBalance was added to the model");
break;
case 18:
ReasonAnalysis.addToChoice("MakePayment");
logInfo (" MakePayment was added to the model");
break;
case 19:
ReasonAnalysis.addToChoice("RateInquiry");
logInfo (" RateInquiry was added to the model");
break;
default:
ReasonAnalysis.addToChoice("Other");
logInfo (" Other was added to the model");
break;
}
When this Informant with the shown input values is called, the Call entity, which
is an attribute of the Session, is populated with information about the agent,
length of call, and reason code. The Informant logic then determines that since the
reason code was 18, then the Make Payment choice will be added to the Reason
Analysis model. That is, the count for the Make Payment choice will have been
increased by one. Along with the count, the model also tracks all of the session
attributes and correlation with the choices.
4. Change the values and test a few times to see that the correct Object ID is being
added to the model for other reason codes.
This chapter of the tutorial contains step-by-step instructions for utilizing Load
Generator to simulate the run-time operation of the system.
In general, Load Generator is used in three situations:
■ Performance: To characterize the performance of the system under load,
measuring response time and making sure the whole system, including back-end
data feeds, can cope with the expected load.
■ Initialize: To initialize the learnings and statistics with some significant data for
demonstration purposes.
■ Process: To process off-line batch sources - for example, when exploring
previously collected data at the initial stages of a project.
This chapter contains the following topics:
■ Section 3.1, "Performance Under Load"
■ Section 3.2, "Resetting the Model Learnings"
In the path names, make sure to replace RTD_HOME with the path where you
installed Real-Time Decision Server (for example, C:\OracleBI\RTD).
Note that parameters related to sessions cannot be changed in the middle of
execution. More precisely, they can be changed, but their changes will not affect
execution until the Load Generator script is stopped and restarted.
3. Save the configuration. It is customary to save Load Generator scripts in a folder
named etc within the inline service project folder. If you had created the Tutorial
Inline Service in the default workspace, the path would be similar to:
C:\Users\Win_User\Oracle RTD Studio\Tutorial\etc. Name the script
(an xml file) anything you like (for example, TutorialLoadgen.xml).
4. To define the values for the parameters to the Integration Point, click the Variables
tab. Variables allow an Integration Point's parameter values to be drawn from
different sources.
Note: It is possible that not all the tree is visible on the left. To make
it all visible, you can drag the bar dividing the two areas.
5. Right-click the Script folder and select Add Variable. Name it var_customerId.
In Contents, select Integer Range from 1 to 2000, sequential. This definition will
create a variable that is computed once per session and goes from 1 to 2000
sequentially, that is, the first session will have var_customerId = 1 and the last
one will be 2000. Right-click Script and select Add Variable three more times for a
Table 3–2 Variable Names and Values for Load Generator Script
Parameter Name Content Type Value
var_customerId Integer Range Minimum = 1, Maximum = 2000, Access type
= Sequential
var_reasonCode Integer Range Minimum = 17, Maximum = 20, Access type
= Random
var_agent String Array To add a string to the array, right-click on the
table area and select Add Item. Then select
(double-click) the newly created row to get a
cursor and type the name to be used. Press
the Enter key to register the value for that
row. Add a few sample values of agent
names (for example, John, Peter, Mary, and
Sara).
var_length Integer Range Minimum = 75, Maximum = 567, Access type
= Sequential.
This will be used as the length of the call in
seconds.
6. Select the Edit Script tab, then right-click the left area and select Add Action. We
will add three actions, each corresponding to an integration point. We need the
actions to be in the right order - CallBegin, ServiceComplete, and finally CallEnd.
7. For the first action, set the type to Message and the Integration Point name to
CallBegin. In Input Fields, right-click and choose Add item to add an input field.
Double-click in the space under Name and enter the value customerId; press
Enter to register the new value. In the Variable column for customerId, choose
var_customerId from the drop-down list. Select Session Key to identify this field
as the session key.
8. For the action ServiceComplete, add three additional fields, as shown in
Table 3–3.
Again, the names here must match exactly with the incoming parameter IDs for
the ServiceComplete Informant as seen in Decision Studio. Use the Toggle icon on
the Inline Service Explorer task bar in Decision Studio to toggle between the label
of the object and its object ID:
Figure 3–1 shows what the completed Input Fields section for ServiceComplete
should look like.
9. In the Edit Script tab, right-click the left area and select Add Action. Set the type
to Message and the Integration Point name to CallEnd. In Input Fields, right-click
and chose Add item to add an input field. Set the Name to customerId, the
Variable to var_customerId, and select Session Key.
10. Once again, save the Load Generator configuration script. Our Load Generator
script now contains calls to three integration points. Make sure the order of the
actions in the Edit Script tab is correct: CallBegin, ServiceComplete, and CallEnd.
If not in this order, right-click the actions to move items up or down. Then, save
the script again.
11. Go to the Run tab and press the Play button. Allow Load Generator to complete.
Note that there is a Pause button and a Stop button. The difference between these
two is that Pause remembers the sequences and will continue from the point it
was paused, whereas Stop resets everything.
Tip: If you encounter problems, look at the Total Errors in the Run
tab. If the number is above 0, look at the server output window. There
may be an indication of the problem. Common mistakes are:
■ The Inline Service has not been deployed.
■ There is a spelling or case mistake in the name of the Inline
Service or the Integration Point.
■ The server is not running.
If the Total Requests stays at 1 and does not grow, there may be a
mistake in the definition of the loadgen script. Some things to look for
include:
■ In Integer Range variables, make sure the Minimum is below the
Maximum.
■ Make sure that the mapping of values sent in messages to
variables is correct. For example, if a variable name is changed,
the mapping needs to be redone.
■ Make sure the Client Configuration file is correct.
2. Click Open Inline Services. The Select Inline Service window appears. Select
Tutorial, then expand Call Reason and select one of the Choices, such as Make
Payment. In the right pane, navigate to the Analysis tab and then the Best-fit
subtab. This report summarizes the number of times this call reason was seen, and
correlations between this call reason and attribute values.
You will see something interesting. The call reason code has an unexpectedly
strong correlation to Make Payment, as shown in Figure 3–2.
Since we generated the call data randomly with Load Generator variables, we
would not expect to have any significant correlations. In this case, however, the
call reason code (sent by the ServiceComplete Informant) absolutely determines
the call reason (see Section 2.9.5, "Testing It All Together" for a discussion of this
logic).
To remove this induced correlation, we should exclude this attribute from being
used as an input to the model. Another type of attribute we might exclude from
models is a customer's full telephone number. After all, it is unlikely that
correlations can be found between unique telephone numbers and the reason
he/she called. On the other hand, there may be correlations between the area
codes of customers and the call reasons, so this would be an attribute that we
would not exclude from the model. In the next section, you will exclude the
'reason code' attribute from the model and re-run the Load Generator script.
If you use Decision Center now to look at the counts, you will notice that they include
the events from both runs of Load Generator. This happens because we did not reset
the models between the two times we ran the Load Generator script.
This chapter of the tutorial contains instructions for creating and configuring Inline
Service elements - specifically, performance goals, scoring rules, advisors, and
decisions - that together enable Oracle RTD to recommend the best offer to present to a
customer.
In Chapter 2, we created an Inline Service that tracks and analyzes incoming data
related to the reason for calls to a credit card call center. In Chapter 3, we used Load
Generator to simulate client requests (through Informant calls) to our Inline Service.
In this chapter, we will enhance the Tutorial Inline Service to provide cross-selling
advice to the CRM application. The process enhancement is this: after the agent has
finished processing the customer's call in the normal way (Service Complete Informant
called), the agent then takes the opportunity to present an offer to the customer. In
Chapter 5, we will track the customer's response to the offer, and then use what was
learned from the responses in presenting offers to other customers.
This chapter contains the following topics:
■ Section 4.1, "About Using Choice Groups and Scoring to Cross Sell"
■ Section 4.2, "Creating an Offer Inventory Using Choice Groups"
■ Section 4.3, "Configuring Performance Goals"
■ Section 4.4, "Scoring the Choices"
■ Section 4.5, "About Advisors"
■ Section 4.6, "Creating the Decisions"
■ Section 4.7, "Creating the Advisor"
■ Section 4.8, "Viewing the Integration Map"
■ Section 4.9, "Testing the Advisor"
Note: These attributes are sent to the client because they are needed
by the client (call center agent) to present the offer.
The attributes should be overridable because their values will be
different for each actual offer. Cross Selling offers will be represented
by choices in this choice group.
In a real Inline Service, we are likely to see several levels of choice
groups before we get to actual offers. Each choice group provides a
logical group for offers, and may have attributes or business rules that
apply uniformly to a group of offers.
4. In the Inline Service Explorer, under Choices, select the Cross Selling Offer choice
group and add five choices with their attributes, as shown in Table 4–2. To add
each of the choices, follow these steps:
a. Right-click Cross Selling Offer in the Inline Service Explorer and select New
Choice. Add the following choices: Credit Card, Savings Account, Life
Insurance, Roth IRA, and Brokerage Account.
b. In the Inline Service Explorer, under Choices, expand the Cross Selling Offer
Group to show the choices. For each choice, follow these steps to add
attributes:
– Select the Choice in the Inline Service Explorer. In the Editor for that
choice, add a description.
– On the Attribute Values tab, you will see three attributes: Agent Script,
Offer Description, and URL. Using Attribute Value, add the attribute
values shown in Table 4–2.
Note: If you have more than one performance metric, you must use
the Normalization Factor to normalize the values. For instance, if you
had another metric called "Minimize hold time" measured in seconds,
the normalization factor would be how many minimized seconds are
worth a dollar (revenue) to your organization.
performance metric Cost, then click OK. This sets up the choice group with a Cost
score. The actual score values will be set on a per-choice basis.
Score values do not have to be constants. In many cases, score for one type of
customer can differ by a significant amount from another customer type. We can
express such differences through the use of formulas or scoring rules. For
example, the Cost to maintain a credit card account may be less for customers who
are age 40 or under. We will define this logic in a Scoring Rule and then assign
this rule to the Cost score for the Credit Card offer.
2. In the Inline Service Explorer, right-click the folder Scoring Rules and select New
Scoring Rule. Name the scoring rule Credit Card Score. The editor for this
new rule opens.
3. Click the Add conditional value icon to set up a rule condition in addition to the
default:
A new row will appear, where the left cell is a two-sided rule and the right cell is
the score value. The logic is as follows: "If the left cell evaluates to true, then the
value in the right cell will be returned, otherwise use the value in the second row
of the rule."
Click the left side of the rule and then on the ellipsis. An Edit Value dialog
appears. Select Attribute, expand session attributes > customer and select Age,
then click OK. Click the condition operator icon, then click the lower-right corner
triangle:
Select the less than or equal to symbol (<=). Click in the right half of the rule and
type the number 40. In the Then cell, type the number 130. In the second row,
select and type in the number 147 for the value. The full rule should look like the
one shown in Figure 4–2.
Save the Credit Card Score scoring rule. For the other offers, we will set constant
values for the Cost score.
4. For each of the choices under the choice group Cross Selling Offer, open the
Scores tab. In the Score column for the Cost metric, enter the values shown in
Table 4–3. To set the Cost score for the Credit Card choice, click the ellipsis in the
Score column, then select Function or rule call as the Value Source. In the
Function to Call drop-down list, select Credit Card Score.
Since our Performance Goal is to minimize costs, it is clear that the Savings
Account offer (score =135) will be chosen unless the customer's age is 40 or below
(score = 130), in which case the Credit Card offer will be chosen. In later sections of
the tutorial, we will add another Performance Goal, Maximize Revenue, to see
how these two competing performance metrics are optimized by the platform.
5. Save the configuration by choosing File > Save All.
Note: The Control Group acts as a baseline so that the business user
can compare the results of the predictive model against the
pre-existing business process. It is important to correctly define the
Control Group decision to truly reflect the decision as it would have
been made if Oracle RTD was not installed. For example, in a
cross-selling application for a call center, if agents randomly selected
an offer before Oracle RTD was introduced, then the Control Group
Decision should return a random selection.
If we had entered the code in the Logic tab, it would have been executed before
the decision was made on which offer to return, and we would not be able to print
the name of the offer returned. In the preceding code, we print the customer's age
and the presented offer name. Recall that because we are minimizing on Cost, only
the offers Savings Account and Credit Card will be presented, depending on the
age of the customer.
7. Save the Inline Service. Click the Deploy button. Select Terminate Active Sessions
(used for testing) to remove any session that is still currently active. Deploy.
Figure 4–4 shows how the Get Cross Sell Offer Advisor retrieves an offer from the
Cross Selling Offer choice group, based on the performance goal Cost.
Figure 4–4 Get Cross Sell Offer Advisor Retrieving an Offer from Cross Selling Offer
Choice Group
The symbols shown in Table 4–4 are used on the Integration Map to indicate
integration points, processing, entities, and information flow.
Advisor call
Informant Call
Then, confirm in the Log subtab that the message was sent. This Informant call
creates a new session based on the customer ID and registers the customer's call
reason, agent's name, and call length.
3. Now select the Get Cross Sell Offer Advisor, leaving the customerId as it is, as we
want to continue with the same session. Click Send.
The selected offer and its attributes are returned and displayed in the Response
pane in the Test View.
In the Log subtab in the Test View, for customerId = 7, you should see something
similar to the following:
00:24:40,764 Integration Point - Get Cross Sell Offer
00:24:40,764 Customer age = 38
00:24:40,764 Offer presented: 'Credit Card'
4. Repeat steps 1 to 3 with different values for customerId and other parameters.
Notice that the Credit Card offer is returned if the customer's age is 40 or below,
and the Savings Account offer is returned for all other ages. This is expected
because so far, we have only optimized on the Cost performance metric, thus the
lowest cost offer is either Savings Account or Credit Card, depending on the
customer's age (see the Credit Card Score scoring rule in "Scoring the Choices" on
page 4-3).
5. In the Trace subtab of the Test View, you will find a description of the sequence
taken to arrive at the offer, from determining which offers are eligible to
computing scores for each offer, and finally choosing the offer that met the
performance goal (minimize Cost).
This chapter concludes the tutorial section by describing how choice group events and
choice event models are configured to provide feedback information on the
effectiveness of choices recommended by Oracle RTD. The chapter also shows how the
feedback information appears in several Decision Center reports.
In the previous chapter, we added an Advisor that returns an offer to the CRM
application so the call center agent can present it to the customer. Once presented to
the customer, we want to track whether the customer has accepted the offer and thus
close the loop on the offer presentation/acceptance process. The feedback loop can be
closed in different ways and at different times. It is not unusual to know the results
only days or weeks after a decision or offer is made. Even then, in many cases, only the
positive result is seen, but not the negative. Feedback can come directly from
customers, from the agents handling the call, from operational systems that handle
service, fulfillment or billing, or even from batch processes.
The way the feedback loop is closed with an Inline Service is by notifying the
Real-Time Decision Server through the use of Informants.
This chapter contains the following topics:
■ Section 5.1, "Using Events to Track Success"
■ Section 5.2, "Using the Predictive Power of Models"
degree of interest shown by the customer. For an offer presented in a Web site, a
click-through may be the indicator of interest.
Events further down the life of an offer may be much more difficult to track and
decide on the right offer. Therefore, it is not unusual to begin a project having only the
immediate feedback loop closed, and adding events further down the road as the
system matures. Nevertheless, even with only immediate feedback, Oracle RTD can
provide significant lift in marketing decisions.
This section contains the following topics:
■ Section 5.1.1, "Defining Events in Choice Groups"
■ Section 5.1.2, "Defining a Choice Event Model"
■ Section 5.1.3, "Additional Model Settings"
■ Section 5.1.4, "Remembering the Extended Offer"
■ Section 5.1.5, "Creating the Feedback Informant"
■ Section 5.1.6, "Testing the Feedback Informant"
■ Section 5.1.7, "Updating the Load Generator Script"
between the characteristics of the customers, calls and agents, and the success or
failure of offers. This knowledge is useful in two ways:
■ It is useful for providing insight and understanding to the marketing and
operations people.
■ It is useful to provide automatic predictions of the best offer to present in each
situation.
In this tutorial, we will show both usages.
To define a choice event model:
1. In the Inline Service Explorer, right-click the Models folder and select New Choice
Event Model. Call the new model Offer Acceptance Predictor and click
OK.
2. In the Editor, deselect Default time window and set Time Window to a week.
3. Under Choice Group, select Cross Selling Offer.
This is the group at the top of the choice hierarchy for which we will track offer
acceptance using this model.
4. Under Base Event, select presented. Recall that you had defined these event
names in the choice group in the previous section.
This is the event from which we want to measure the success. We want to track
whether an offer was accepted after it was presented.
5. In Positive Outcome Events, click Select, choose accepted, and click OK. For the
tutorial, this is the only positive outcome. If more events were being tracked, we
would add them here also.
6. Optionally, you can change the labels to be more offer-centric.
This will assign the SDOId of the selected choice to the OfferExtended attribute of
the session entity. The SDOId is a unique identifier. Every object in an Oracle RTD
configuration has a unique SDOId. It will also record the Presented event for the
selected offer. Note the event name is in lowercase and corresponds to the choice
event id for Presented. To see the id, go to Inline Service Explorer, expand Choices,
double-click on Cross Selling Offer, click on the Choice Events tab, and click the
label/id Toggle icon:
At this point of the decision, the session knows which offer has been chosen to be
presented to the customer by the call center agent (through the Get Cross Sell
Offer Advisor). We do not yet know the response from the customer. The response
will be sent through a feedback Informant described in the next section.
}
}
7. Save all and redeploy the Inline Service. On the Deploy dialog, check Terminate
Active Sessions (used for testing).
The following diagram shows how the Get Cross Sell Offer Advisor retrieves and
presents an offer, and then the Offer Feedback Informant accepts or rejects the
offer. When the Call End Informant closes the session, the Offer Acceptance
Predictor model is updated with the offer Presented/Accepted events.
1. In Test View, select the Integration Point Get Cross Sell Offer. Enter a value for
the customerId, such as 10.
2. Click the Send icon:
Then, confirm in the Response subtab that an offer was retrieved. In the Log
subtab, you should see something similar to the following:
00:45:28,466 Integration Point - Get Cross Sell Offer
00:45:28,466 Customer age = 38
00:45:28,466 Offer presented: 'Credit Card'
Note that even if you tried different values for customerId, the offer presented is
always Savings Account or Credit Card. This is because we have only one
performance goal at this point - to minimize cost, and Savings Account or Credit
Card is the lowest cost, depending on the age of the customer.
3. Now select the Offer Feedback Informant from the Integration Point drop-down
list. Leave the customerId as it is, as we want to continue with the same session.
Enter a value for input Positive, such as yes.
4. Click Send and confirm in the Log subtab that the offer retrieved by the Get Cross
Sell Offer Advisor is accepted. You should see something similar to the following:
00:46:01,418 Integration Point - Offer Feedback
00:46:01,418 Offer 'Credit Card' accepted
5. Change the input Positive value to no and re-Send the Offer Feedback Informant.
The Log subtab will look something similar to the following:
00:47:31,494 Integration Point - Offer Feedback
5. After we add this action to the script, it is placed at the bottom of the actions list.
We need to adjust the order so that GetCrossSellOffer is called after
ServiceComplete. In the left side of the Edit Script tab, right-click
GetCrossSellOffer and select Move Up or Move Down so that the order is
CallBegin, ServiceComplete, GetCrossSellOffer, and CallEnd.
6. Save the Load Generator script.
To add the OfferFeedback Informant to the Load Generator script:
1. Before we add the call to OfferFeedback in the Edit Script tab, we need to create a
new variable in the Variables tab. Recall in the definition of the OfferFeedback
Informant, the parameter positive is used to indicate offer acceptance. In Load
Generator, we will set the value of this parameter to randomly be yes 30% of the
time and no 70% of the time. We do this by using a weighted string array.
2. In the Variables tab, in the left side, right-click on the folder Script and select Add
Variable. Enter var_positive for Variable name, then set the Contents type to
Weighted String Array. Add two items to the array (right-click in the space below
the content type and select Add Item). For the first item, double-click in the
Weight cell to make it editable and type the value 30, and in the corresponding
String cell, type the value yes. The second item should have the weight value of
70 and string value of no. Note that the weights do not have to add up to 100,
because they are normalized automatically. Weight values of 6 and 14 would have
the same desired effect.
3. Select the Edit Script tab, then right-click the left tree view and select Add Action.
The action is of type Message and the Integration Point name should be
OfferFeedback.
4. In Input Fields, right-click and chose Add item to add an input field. Click in the
space under Name and add customerId. In the Variable column, select the
matching variable, var_customerId (see Section 3.1.1, "Creating the Load
Generator Script" for more information). Mark customerId as a session key by
selecting Session Key.
5. Again in Input Fields, right-click and chose Add item to add an input field. Click
in the space under Name and add positive. In the Variable column, select the
matching variable, var_positive.
6. After we add this action to the script, it is placed at the bottom of the actions list.
We need to adjust the order so that OfferFeedback is called after GetCrossSellOffer.
In the left side of the Edit Script tab, right-click OfferFeedback and select Move
Up or Move Down so that the order is CallBegin, ServiceComplete,
GetCrossSellOffer, OfferFeedback, and CallEnd.
Figure 5–3 Adding the OfferFeedback Informant to the Load Generator Script
Figure 5–4 Decision Center Performance Counts for Cross Selling Offer
Notice that only two offers were presented - Credit Card and Savings Account, and
each one had an acceptance rate of about 30%. This is entirely expected due to the logic
we have set up so far: 1) Only one performance goal - minimizing Cost - was to be
met, and the Cost is lowest for Savings Account or Credit Card, depending on the age
of the customer (see Section 4.4, "Scoring the Choices"). In the Load Generator script,
we specified that 30% of the time, a positive response to an offer is registered through
the OfferFeedback Informant. If we drill down into the analysis reports of individual
offers, we will not see much correlation between the acceptance of an offer and session
attributes. This is because we are using random customer profile data and forcing the
acceptance rate to be 30%, regardless of customer or other attributes (such as call
length, call agent name, call reason, and so on).
We have now demonstrated how to use performance goal to decide which offer to
present and how to use a choice event model to record how often presented offers are
accepted. We have only used the model for analysis so far. In the next section, we will
add a second performance goal (Maximize Revenue) and use what the model has
learned in order to influence which offer is to be presented. We will also introduce an
artificial bias that increases the likelihood of customers who have two or more children
to accept the Life Insurance offer if it is presented. We will then be able to see how the
bias affects the model results.
3. For each choice under the Cross Selling Offer Choice Group, set the value of the
Revenue attribute as shown in Table 5–1.
5.2.3 Calculating Score Value for the Maximize Revenue Performance Goal
To calculate the score value for the Maximize Revenue goal, we need the base Revenue
and the likelihood of acceptance value as determined by the Offer Acceptance
Predictor choice event model. This can be retrieved using the edit value dialog by
changing the value source to Model Prediction.
To calculate the score value for the Maximize Revenue goal:
1. In the Inline Service Explorer, under Choices, double-click the Cross Selling Offer
choice group. In the Scores tab, click in the Score column for the Maximize
Revenue metric, then click the ellipsis to bring up the Edit Value dialog.
2. For the Value Source, select Function or rule call. Under Function to Call, choose
the function Multiply. In the Parameters table, click in the Value cell for
parameter a. Click the ellipsis and choose Attribute or variable, then expand the
Choice folder, select Revenue, and click OK. In the Parameters table, click in the
Value cell for parameter b. Click the ellipsis and choose Model Prediction. Choose
the likelihood predicted by the Offer Acceptance Predictor model and the
Accepted event, then click OK. Click OK again in the Edit Value dialog.
The actual value of the likelihood is from 0 to 1, 1 being 100% likely to accept. It is
also possible for the value to be NaN (Not a number), which means the model did
not have enough data to compute a likelihood value. In such situations, the
Maximize Revenue score cannot be computed and the offer selection by the Select
Offer decision will be based on built-in score comparison logic, which depends on
whether the score is or is not required.
3. By defining the score for Maximize Revenue on the choice group level, all of the
choices within this group will inherit the definition and apply choice-specific
values for Revenue and likelihood of acceptance during run time.
5.2.4 Updating the Select Offer Decision to Include the Second Performance Goal
We have so far defined a new performance metric and how to calculate its value. We
will now update the Select Offer decision to consider both performance metrics when
choosing an offer to present.
To update the Select Offer Decision:
1. In the Inline Service Explorer, expand the Decisions folder and double-click Select
Offer.
2. In the Selection Criteria tab, you should see only one Performance Goal in the
Priorities for the "Default" Segment table, Cost, with a Weight value of 100%. Click
Goals, then select the goal Maximize Revenue and click OK.
The priorities table now shows two performance goals, each with a Weight of 50%.
The default is to evenly split weighting between all selected metrics. If you wanted
the Maximize Revenue performance goal to take precedence over Cost, you could
adjust the percentages so that it had more weight. We will use the default Weight
of 50% in this tutorial.
Table 5–2 shows an example of how the Select Offer decision calculates a total
score for a particular offer, assuming the offer's Cost score is 150 and its Maximize
Revenue score is 215.
The Total Score based on the values in Table 5–2 is 32.5. The weighted Cost score
is negative because the optimization is Minimize. The total score of the offer is the
sum of the two weighted scores. The total score is calculated for each offer, and the
offer with the highest value will be selected.
3. To see the effect of the changes to the Advisor, save all and deploy the Inline
Service.
4. In Test view, select the Get Cross Sell Offer Integration Point and input a value
for customerId, such as 8. Click Send. In the Response subtab in Test View, you
should see something similar to the image shown in Figure 5–6.
In the Log subtab, you should see something similar to the following:
14:07:37,908 Integration Point - Get Cross Sell Offer
14:07:37,908 Customer age = 57
14:07:37,908 Offer presented: 'Savings Account'
14:07:37,908 Likelihood of Acceptance = 0.30354643094453865
If you are getting a value of NaN (Not A Number) for Likelihood Of Acceptance,
this means the model did not have enough data to compute the likelihood value
for this offer. The number of iterations necessary to reach model convergence
(likelihood numbers no longer NaN) depends on the application and quality of the
data.
In our case, we had imposed a definite offer acceptance rate of about 30% (see
Section 5.1.7, "Updating the Load Generator Script"), and since we are using
random customer profile data, the Offer Acceptance Predictor model should
converge quickly and be able to compute likelihood of acceptance values within
just a few hundred iterations. Before the model has reached convergence, the offer
selection process is based on built-in score comparison logic, which depends on
whether the score is required.
The following diagram shows the Get Cross Sell Offer Advisor retrieving an offer
from the Cross Selling Offer choice group, where the total score of each offer is a
weighted sum of two scores - Cost and Maximize Revenue.
to see clear correlations between the number of children and the acceptance rate of this
offer.
To introduce the Offer Acceptance bias:
1. In the Inline Service Explorer, double-click Offer Feedback under Integration
Points > Informants.
2. In the Logic tab, update the existing code by adding several lines to add offer
acceptance bias for customers who have two or more children and who were
presented the Life Insurance offer. The completed code should appear as follows:
logInfo("Integration Point - Offer Feedback");
//"yes" or "no" to accept offer.
String positive = request.getPositive();
positive = positive.toLowerCase();
2. Click the Remote tab. Then, enter the appropriate port number (typically 12345)
and the administrator credentials you created during installation and click
Connect.
3. Click the MBean tab, then go to the OracleRTD > InlineServiceManager >
Tutorial > Development > Loadable MBean.
4. Click the Operations tab, then use the deleteAllOperationalData() operation to
remove all operational data, including the study, for this Inline Service.
5. Start Load Generator and open the Load Generator script previously defined.
There should be no changes necessary.
6. Start the Load Generator script. After about 200 total finished scripts, click the
Pause icon to temporarily stop sending requests to the server:
Then, view the server's output in the server.log file, which is in the RTD_
RUNTIME_HOME\log directory.
You will see that the printed Likelihood Of Acceptance values are NaN for all
sessions. This is an indication that the model has not yet learned enough data to be
able to compute the likelihood of acceptance. Note that offers are still being
presented despite the lack of likelihood values. Offers are being selected using
built-in scores comparison logic.
7. Un-pause the Load Generator script and let it finish running for 2000 total finished
scripts. In the server output, you should now see actual values for Likelihood Of
Acceptance, varying around 0.3 for all offers except Life Insurance, which has
higher values because of the bias introduced.
8. It is important to note that the model-predicted Likelihood Of Acceptance values
for a given offer will differ for different customer profiles. For example, suppose
we have two customers John and Tom, who only differ in the number of children
they have. If we printed the Likelihood Of Acceptance values for the Life
Insurance offer for these two customers (at a snapshot in time), we will see a
higher value for Tom, as shown in Table 5–3. This is because Tom has three
children, and is therefore more likely to accept the Life Insurance offer, if it is
presented to him.
Figure 5–8 Performance Counts for Cross Selling Offer Choice Group
The Decision Center table shows the distribution of the offers - how many were
presented and how many were accepted for each offer. Except for Life Insurance, all of
the other offers had acceptance rate of about 30%, as shown in Figure 5–8. This is
expected because of how we set up the Load Generator script (see Section 5.1.7,
"Updating the Load Generator Script"). The acceptance rate for Life Insurance is higher
than 30% because of the artificial bias we introduced in Section 5.2.7, "Introducing
Offer Acceptance Bias for Selected Customers." The bias dictated that in addition to
30% of the customers accepting any offer, customers who had two or more children
and were offered Life Insurance will always accept the offer.
Given the artificial bias, the model results should show that for the Life Insurance
offer, the NumberOfChildren attribute will be an excellent predictor for whether or not
the offer will be accepted. This is exactly what we see in the Decision Center reports:
click the Cross Selling Offer Choice Group and click on the Analysis tab, then the
Drivers subtab. In the Report Settings section, change the Minimum Predictiveness
value to 0 and then click Go. You will see a list of attributes, ordered by the maximum
predictiveness value. The highest value for Max Predictiveness should be for the
NumberOfChildren attribute, since it is the only artificial bias we added. The
corresponding offer should be Life Insurance, similar to the image shown in
Figure 5–9.
We can further analyze the importance of the NumberOfChildren attribute for the Life
Insurance offer by viewing reports specific to this offer. In the navigation box in
Decision Center, expand the Cross Selling Offer Choice Group and click the choice
Life Insurance, then click the Analysis tab and finally the Drivers tab. This report
shows the important drivers for acceptance of this particular offer (Life Insurance).
In the Report Settings section, change the Minimum Predictiveness value to 0 and
then click Go. You will see a list of attributes, ordered by the Predictiveness value. The
NumberOfChildren attribute should have the highest predictiveness value. Click the
attribute name to display more detailed reports, one of which should look similar to
Figure 5–10.
The graph shown in Figure 5–10 shows that for NumberOfChildren values of 2 and
above, there is a strong positive correlation for offer acceptance. This means that the
number of acceptances of this offer for these attribute values (2 or more) is much
higher than expected. Similarly, for values of 0 or 1, the correlation is also very strong,
but is negative, meaning that customers with 0 children or 1 child did not accept Life
Insurance as much as expected.
The chapters in Part II explain how to use the Java Smart Client, Java Smart Client JSP
tags, and the .NET Smart Client to integrate with Oracle RTD. They also explain how
to use the Oracle RTD Web services.
Part II contains the following chapters:
■ Chapter 6, "About Integrating with Oracle RTD"
■ Chapter 7, "Using the Java Smart Client"
■ Chapter 8, "Using Java Smart Client JSP Tags"
■ Chapter 9, "Using the .NET Smart Client"
■ Chapter 10, "Web Service Client Example"
■ Chapter 11, "Using the Oracle RTD PHP Client"
6
About Integrating with Oracle RTD
6
This chapter introduces the components - Smart Clients, PHP client, and web services -
by which Oracle RTD can integrate with enterprise operation systems. It also
highlights the elements in the CrossSell Inline Service that are used to demonstrate the
various means of integration in the more component-specific chapters.
Oracle RTD features several robust and easy-to-use ways to integrate with enterprise
operational systems:
■ Smart Clients: For Java and .NET environments, these components manage
communication to Integration Points on Real-Time Decision Server.
■ Zero Clients: Access to Integration Points is available through Web services as a
zero client approach.
This chapter, and the following chapters in Part II, outline how to use these ways to
integrate with deployed Inline Services running on Oracle RTD.
See Part I, "Getting Started" for information about using Decision Studio to deploy
Inline Services. For information about the integration APIs, see the Decision Studio
online help.
Note: The following terms are referenced throughout the Oracle RTD
documentation:
■ RTD_HOME: This is the directory into which Oracle RTD is
installed. For example, C:\OracleBI\RTD.
■ RTD_RUNTIME_HOME: This is the application server specific
directory in which the application server runs Oracle RTD.
For more information, see the section "About the Oracle RTD
Run-Time Environment" in Oracle Real-Time Decisions Installation and
Administration Guide.
performance needs and the additional functionality offered by RTD Smart Client over
other methods of integration.
This section contains the following topics:
■ Section 6.1.1, "About the Java Smart Client"
■ Section 6.1.2, "About the .NET Smart Client"
■ Section 6.1.3, "About the JSP Smart Client"
■ Section 6.1.4, "About Web Services"
These default responses are configured at the granularity of the individual integration
points; each integration point relies on its own specialized default response. When any
default responses are reconfigured on the server, the changes are propagated
automatically to the client's out-of-band data, bundled together with normal
integration point responses.
The Java Smart Client automatically keeps track of any HTTP cookies that are returned
by the Web Container of Real-Time Decision Server. The next time the same Inline
Service key is used in a request, its cookies are included in the HTTP request so that
the external load balancer can route the request to the server instance that is already
handling that Inline Service key.
To achieve clustering using other methods of integration, the application must track
the Inline Service keys itself.
5. Use the Object ID Toggle icon to show the Object ID in the Inline Service Explorer:
When the Toggle icon is highlighted, the Object IDs show in the Inline Service
Explorer; when the Toggle icon is not highlighted, the display label is shown.
Note: The Object ID of the Integration Point may or may not be the
same as the label. Object IDs are used to reference Integration Points
in method calls.
2. On the Response tab, under Decision, look up the Decision that OfferRequest uses
to return a response. It should be OfferDecision.
3. Double-click OfferDecision under Decisions to view its detail pane.
4. On the Selection Criteria tab, under Number of Choices to Select, find the
number of responses that OfferRequest provides.
5. On the Selection Criteria tab, under Choice Group, find the Choice Group that
OfferRequest uses. It should be Offers.
6. Under Choices, double-click Offers to see the choice attributes associated with
this Choice Group. These attributes will be returned when a call to the Advisor is
made.
Tip: In Decision Studio, use the Test view to call the Advisor and see
what is returned. That way, you can see the offer returned and the
attributes that come with it. To access the Test view, click the Test tab
next to the Problems tab. Click the Send icon to send the request to
the server:
Note: If the session key is not displayed in object format, use the
Object ID Toggle icon to change the display settings:
Only the final object ID is necessary for the session key. For example,
in the case shown above, only the final string, customerId, is used.
2. To identify the arguments of the Integration Point, use the detail pane of to view
the Incoming Attribute column of the Request tab. The CallStart incoming
argument is channel.
This chapter explains how to integrate an Inline Service with the Java Smart Client,
using the CrossSell Inline Service as an example.
For full information about the Java Smart Client API, see the Decision Studio online
help.
This chapter contains the following topics:
■ Section 7.1, "Before you Begin"
■ Section 7.2, "Integrating with an Inline Service Using the Java Smart Client"
7.2 Integrating with an Inline Service Using the Java Smart Client
In general, integration using the Java Smart Client includes the following steps:
1. Prepare a properties file.
2. Create a connection to the Inline Service.
3. Create a request that identifies the Integration Point to connect to and the
parameters to identify the session and any other information the Integration Point
needs to determine an outcome.
4. Invoke the request.
5. Gather and parse any response information from Advisors.
6. Close the connection.
This section contains the following topics:
■ Section 7.2.1, "Preparing the Java Smart Client Example"
■ Section 7.2.2, "Creating the Java Smart Client Properties File"
■ Section 7.2.3, "Creating the Java Smart Client"
■ Section 7.2.4, "Creating the Request"
■ Section 7.2.5, "Examining the Response"
■ Section 7.2.6, "Closing the Loop"
■ Section 7.2.7, "Closing the Client"
10. Place the cursor after the colon, then enter a customer ID (such as 5) and press
Enter. The response appears similar to the following:
Here are the deals we've got for you:
1: ElectronicPayments
Electronic payments eliminate the complications of handling checks.
Enter the line number of the offer that catches your interest, or zero if none
do:
11. Place the cursor after the final colon, then enter 1 to select the offer. The server
responds with a final message.
12. The process repeats. Enter a customer ID greater than 1000 to stop the program.
You can find the source code for this example in the following file:
RTD_HOME\client\Client Examples\Java Client Example\src\com\sigmadynamics\
client\example\Example.java
Tip: This example source code can be used as a template for your
Java Smart Client implementation.
In the main method, the Example application demonstrates several techniques for
using SDClientFactory to create an implementation of SDClientInterface,
based on the arguments supplied to the Example application.
These arguments are passed to getClient, where the proper factory method is
identified.
SDClientInterface client = getClient(args);
There are several factory methods used to create a Java Smart Client. By examining
getClient, we see the various methods:
private static SDClientInterface getClient(String[] args ){
try{
if ( args.length == 0 )
return getClientWithDefaultPropertiesFile();
This creates a Java Smart Client with the default properties file using
create(java.lang.String). The default properties file is referenced.
if ( "-h".equals(args[0])){
if ( args.length < 2 )
return getClientWithDefaultHttpAddress();
This creates a Java Smart Client with the default HTTP address of
http://localhost:8080. This is the default installation URL and port of
Real-Time Decision Server. Uses createHttp(java.lang.String, int,
boolean).
return getClientWithHttpAddress( args[1]);
}
This creates a Java Smart Client with a supplied HTTP address. This is the address and
port of your Real-Time Decision Server, if it is not at the default address. Uses
createHttp(String).
if ( "-u".equals(args[0])){
if ( args.length < 2 )
{
System.out.println("Missing properties file URL argument" );
System.exit(-1);
}
return getClientWithPropertiesFileURL( args[1] );
}
This creates a Java Smart Client with the information supplied in the properties file at
the address specified. Uses createFromProperties.
if ( "-f".equals(args[0])){
if ( args.length < 2 )
{
System.out.println("Missing properties filename argument" );
System.exit(-1);
}
return getClientWithPropertiesFileName( args[1] );
}
This creates a Java Smart Client with the information supplied in the properties file.
Uses createFromPropertiesURL.
System.out.println("Unrecognized argument");
}catch (SDClientException e ){
e.printStackTrace();
}
System.exit(-1);
return null;
}
These methods are summarized in the Java Smart Client API section of the Decision
Studio online help.
After the request to the CallStart Integration Point is invoked, a new request is
prepared and invoked for CallInfo.
// Supply some additional information about the telephone call.
// Apparently the CrossSell service expects very little here --
// just the channel again, which it already knows. Hence this message
// could be left out with no consequences.
request = client.createRequest(INLINE_SERVICE_NAME, "CallInfo");
request.setSessionKey( SESSION_KEY, sCustID );
request.setArg( "channel", "Call");
client.invoke(request);
Knowing the number of responses expected allows you handle them accurately. The
responses are read from the array and displayed to the customer.
if ( response.size() > 0 ){
// Since I know that CrossSell's OfferDecision returns only
// one Choice, I could get that choice from the response with
// response.get(0); Instead, I'll pretend that
// multiple offers could be returned instead of just one.
System.out.println();
System.out.println("Here are the deals we've got for you:");
ResponseItemInterface[] items = response.getResponseItems();
for ( int i = 0; i < items.length; i++ ){
System.out.println(" " + (i+1) + ": " + items[i].getId());
String message = items[i].getValue("message");
if ( message != null )
System.out.println(" " + message );
}
System.out.println();
System.out.println("Enter the line number of the offer that catches your
interest, or zero if none do: " );
// "Interested" is one of the Choice Events defined for the choice group, Offers.
To identify the Choice Event model and Choices, see Section 6.2.3, "Knowing How to
Respond to the Server."
request.setArg( "choiceOutcome", "Interested" );
client.invoke(request);
Finally, the session is closed by invoking the CallResolution Informant in the server,
which in the CrossSell example has been designed to terminate the session.
// Close the server's session.
request = client.createRequest(INLINE_SERVICE_NAME, "CallResolution");
request.setSessionKey( SESSION_KEY, sCustID );
client.invoke(request);
This chapter explains how to integrate an Inline Service with the Java Smart Client JSP
tags, using the CrossSell Inline Service as an example.
A convenient way to integrate a Web application with a deployed Inline Service is to
use the JSP client integration tags. JSP allows you to generate interactive Web pages
that use embedded Java. The JSP tags provided are based on the Java Smart Client
discussed in the previous chapter.
There is negligible overhead when using the JSP tags. In addition, the tags incorporate
automatic reuse of Smart Clients for same session to enhance performance. When a
Java Smart Client is created using the JSP tag, a check is performed to see if a client
already exists with the same name and properties and has not been closed. If it does, it
automatically reuses that client; if not it will create a new one.
For full information about the JSP Smart Client tags, see the Decision Studio online
help.
This chapter contains the following topics:
■ Section 8.1, "Before You Begin"
■ Section 8.2, "Integrating with an Inline Service Using Java Smart Client JSP Tags"
■ Section 8.3, "Deploying the JSP Smart Client Example"
4. Start Real-Time Decision Server. For more information, see Oracle Real-Time
Decisions Installation and Administration Guide.
8.2 Integrating with an Inline Service Using Java Smart Client JSP Tags
In general, integration using the Java Smart Client includes the following steps:
1. Prepare a properties file.
2. Use an Invoke or AsyncInvoke tag to create a request to the server.
3. Gather and parse any response information from Advisors.
4. Close the connection.
A working example of using the Smart Client JSP tags for integration can be found at
RTD_HOME\client\Client Examples\JSP Client Example\example.jsp.
4. Change the URL localhost:8080 to match the host and port of the
Real-Time Decision Server that you are using.
5. Save the file back into sdclient-test.war.
For this example, the CrossSell Inline Service has been integrated to a simple
command-line application to demonstrate how to use the Smart Client for integration.
You need to deploy the JSP Smart Client example to your application server, as
described in the following sections.
This section contains the following topics:
■ Section 8.3.1, "Deploying the JSP Smart Client Example to WebSphere"
■ Section 8.3.2, "Deploying the JSP Smart Client Example to WebLogic"
4. In the Path to the new application section, enter or browse to the path RTD_
HOME/client/Client Examples/JSP Client
Example/sdclient-test.war.
5. For Context root, enter sdclient-test.
6. Click Next, then click Next again, then click Next again.
7. Click Finish, then click Save.
8. On the Enterprise Applications page, select the sdclient-test application and click
Start.
9. To access the application, open a Web browser and go to:
http://websphere_host:port/sdclient-test/example.jsp
A Web page appears that simulates a service call, as shown in Figure 8–1.
10. Enter a customer ID (such as 5) and click OK. A response page appears,
displaying an offer and an option to end the call, as shown in Figure 8–2
6. On the Optional Settings page, enter JSPClientExample for Name. Then, click
Next.
7. Review your settings and click Finish.
8. Click Save, then click Activate Changes.
9. Start the application by selecting JSPClientExample application in the
Deployments table, then clicking Start > Servicing all Requests. When prompted,
click Yes. The application is now running.
10. To access the application, open a Web browser and go to:
http://weblogic_host:port/sdclient-test/example.jsp
A Web page appears that simulates a service call, as shown in Figure 8–3.
11. Enter a customer ID (such as 5) and click OK. A response page appears,
displaying an offer and an option to end the call, as shown in Figure 8–4.
This chapter explains how to integrate an Inline Service with the .NET Smart Client,
using the .NET Integration as an example.
The .NET Smart Client provides a very similar client to the Java API to make calls from
your application. With the current implementation, the .NET Smart Client does not
have some of the advanced features of the Java Smart Client, including session affinity
management and default response handling.
For full information about the .NET Smart Client API, see the Decision Studio online
help.
This chapter contains the following topics:
■ Section 9.1, "Before You Begin"
■ Section 9.2, "Integrating with an Inline Service Using the .NET Smart Client"
■ Section 9.3, ".NET Integration Example"
9.2 Integrating with an Inline Service Using the .NET Smart Client
In general, the following are the steps for integration:
1. Create the Oracle RTD Smart Client within your application code.
2. Create a request directed at an Inline Service and an Integration Point.
3. Populate the request with arguments and session keys.
4. Invoke the request using the Smart Client.
5. If the request is invoked on an Advisor, examine the response.
6. Close the Smart Client when finished.
The .NET Smart Client is located at RTD_HOME\client\Client Examples\Dot
Net Client Example\sdclient.dll. This file should be co-located with your
application in order to be accessible.
6. Place the cursor after the colon, then enter a customer ID (such as 5) and press
Enter. The response appears similar to the following:
Here are the deals we've got for you:
1: ElectronicPayments
Electronic payments eliminate the complications of handling checks.
Enter the line number of the offer that catches your interest, or zero if none
do:
7. Place the cursor after the final colon, then enter 1 to select the offer. The server
responds with a final message.
8. The process repeats. Press Enter at the Customer ID prompt, without entering a
number, to stop the program.
This chapter explains how to integrate Oracle RTD web services with enterprise
operation systems, using NetBeans IDE and the Oracle RTD DecisionService.wsdl as
an example.
Real-Time Decision Server Integration Points are available through a Zero Client
approach. Integration Points on a deployed Inline Service are exposed through a Web
services definition.
The ability to invoke and asynchronously invoke a deployed Integration Point is
exposed as a Web service by Real-Time Decision Server. The definition of these
operations are available in a WSDL file, located at:
RTD_HOME\deploy\DecisionService\DecisionService.wsdl
The WSDL file defines all complex types and operations available.
Some slight structural changes were introduced in Oracle RTD Version 2.2 to bring the
Decision Service up to the WS-I Basic level of compliance. The previous version of the
WSDL file is named:
RTD_HOME\deploy\DecisionService\DecisionServiceLegacy.wsdl
Although implementors should develop new clients using the new WSDL, the server
still understands the protocol defined by DecisionServiceLegacy.wsdl, and
existing clients should experience no loss of functionality.
The instructions in this chapter detail how to use Oracle's NetBeans IDE to create a
Java WSDL Web service client using the RTD DecisionService WSDL file. The code
content for the Web service project main class is also provided.
This chapter contains the following topics:
■ Section 10.1, "Before You Begin"
■ Section 10.2, "Creating a New NetBeans Java Application Project"
■ Section 10.3, "Installing the JAX-RPC Web Services Plug-in"
■ Section 10.4, "Creating an Oracle RTD Web Service Client"
■ Section 10.5, "Adding the Provided Java Code and Testing the Client"
10.5 Adding the Provided Java Code and Testing the Client
To add the provided Java code and to test the client, perform the following steps:
1. In the Projects explorer, locate the generated Main.java file and open it.
It should be under PROJECT_NAME > Source Packages > PROJECT_NAME >
Main.java.
2. In the main() method, add the code content in the file main-content.txt and
save Main.java.
3. Select Run > Run Main Project from the top menu.
4. View the output in the Output tab at the bottom of the IDE.
This chapter explains how to integrate an Inline Service with the Oracle RTD PHP
Client, using the CrossSell Inline Service as an example.
A convenient way to integrate a Web application with a deployed Inline Service is to
use the PHP client integration classes. PHP allows you to generate interactive Web
pages. The PHP classes provided offer functionality similar to the Java Smart Client
discussed in Oracle Real-Time Decisions Platform Developer's Guide.
This chapter contains the following topics:
■ Section 11.1, "Before You Begin"
■ Section 11.2, "Integrating with an Inline Service Using the Oracle RTD PHP Client"
■ Section 11.3, "Deploying the PHP Client Examples"
11.2 Integrating with an Inline Service Using the Oracle RTD PHP Client
In general, integration using the Oracle RTD PHP Client includes the following steps:
1. Prepare an Oracle RTD PHP Client .ini file.
2. Prepare Client objects.
3. Create a request that identifies the following:
■ The Integration Point to connect to
■ The parameters to identify the session
■ Any other information the Integration Point needs to determine an outcome
4. Use Oracle RTD PHP method syntax to create requests for Informants.
5. Use Oracle RTD PHP method syntax to parse responses from Advisors.
6. Close the connection.
Note: The Oracle RTD PHP Client API reference may be found in
RTD_HOME\client\Client Examples\PHP Client
Example\docs.
Two working examples of using the PHP Client may be found at RTD_
HOME\client\Client Examples\PHP Client Example:
■ example_nusoap.php demonstrates the use of the Oracle RTD PHP Client with
NuSoap
■ example.php implements the same functionality but uses PHP Soap
Example of rtd_client_conf.ini
The following is an example of rtd_client_conf.ini:
# RTD integration service wsdl file path
wsdl=rtd/DecisionService.wsdl
clientClass=Oracle_Rtd_Client_Impl
appsCacheClass=Oracle_Rtd_Client_File_Cache
Example of rtd_client_nusoap_conf.ini
The following is an example of rtd_client_nusoap_conf.ini:
# client class name
clientClass=Oracle_Rtd_Client_Nu
3. Change the URL localhost:8080 to match the host and port of the Real-Time
Decision Server that you are using.
4. Save the file.
If no argument is given, the Client factory derives its settings by applying parse_
ini_file to rtd_client_conf.ini.
The factory method uses the settings to connect to the server. When the Oracle RTD
PHP Client has connected to the server, it downloads a more complete set of
configuration information, such as the request timeout duration. It will also maintain
locally the set of default responses that the client should use if it ever needs to run
when the server is unavailable.
The detailed client configuration is saved in a local file, the Oracle RTD PHP Client
configuration cache, and is updated automatically whenever the server's configuration
changes.
The following include is used to support Oracle RTD integration with PHP Soap:
include_once "rtd/rtd.client.phpsoap.php";
In example_nusoap.php, the settings are parsed from a .ini file that has been
placed in the same directory as the example PHP script, and may be found in RTD_
HOME\client\Client Examples\PHP Client Example\rtd\rtd_client_
nusoap_conf.ini:
$config = parse_ini_file("rtd_client_nusoap_conf.ini");
$client = Oracle_Rtd_Client_Factory::createClient($config);
The selection of an Inline Service may be further specialized with a Deployment State.
If omitted then the Inline Service deployed in the highest State receives the Request
(Production is higher than QA, which is higher than Development):
$request->setDeploymentState("Development");
The details of a Request are specific to each Inline Service. In this example, the
CallStart Informant requires a Session Key named customerId and an additional
parameter named channel:
$request->setIntegrationPointName("CallStart");
$request->setSessionKey("customerId", 3);
$request->setArg("channel", "Call");
After populating the request, the client application calls the invoke method of the
Client, sending the Request to the RTD Server:
$client->invoke($request);
In the PHP example scripts, the response items are each printed to the Web page in the
order given by the RTD server:
$items = $response->getResponseItems();
foreach ($items as $item) {
echo "<h1>" . $item->getId() . "</h1>";
foreach ($item->getAttributes() as $key => $value) {
echo $key . ': '.$value."<br>";
}
}
For an example of the Web page output, see Section 11.3.8, "Testing the PHP Client
Example."
$request->setArg("choiceOutcome", "Interested");
$client->invoke($request);
}
For more information about Choice Event models and Choices, see Section 6.2.3,
"Knowing How to Respond to the Server" in Oracle Real-Time Decisions Platform
Developer's Guide.
Finally, the session is closed by invoking the CallResolution Informant, which in the
CrossSell example has been designed to terminate the session, freeing resources and
triggering tasks to run that wait for the end of a session.
$request->setIntegrationPointName("CallResolution");
$client->invoke($request);
The chapters in Part III provide an in-depth look at the concepts, components, and
APIs needed to use Decision Studio to develop Inline Services.
Part III contains the following chapters:
■ Chapter 12, "About Decision Studio"
■ Chapter 13, "About Decision Studio Elements and APIs"
■ Chapter 14, "Deploying, Testing, and Debugging Inline Services"
12
About Decision Studio
12
Decision Studio is a tool used to define and manage Inline Services. All aspects of
Inline Services are exposed in Decision Studio. The target user of Decision Studio is an
IT professional with a basic knowledge of Java and a general understanding of
application development and lifecycle issues. This chapter introduces the two broad
categories of Inline Service - Observer and Advisor - and describes how the various
aspects and components of an Inline Service appear in Decision Studio and associated
external file directories
Decision Studio is a rich-client application that follows an integrated development
environment (IDE) paradigm. Decision Studio makes use of an Inline Service Explorer
view on the left, and an editor view on the right. The navigator view displays a
predefined Inline Service folder structure. Items within each folder are Inline Service
metadata elements. Using Decision Studio, metadata elements may be added, edited,
and deleted. When a metadata element is double-clicked, the details of the element are
shown in the object editor. Each metadata element type has its own editor. The
elements are first represented as XML metadata, and then later, Java classes are
generated from which the running Inline Service is compiled.
Decision Studio is based on the Eclipse IDE. It combines features that are specific to
managing Inline Services with the features of the Eclipse IDE, which include general
purpose Java development tools, integration with Software Configuration
Management (SCM) systems, and so on.
Note: The following terms are referenced throughout the Oracle RTD
documentation:
■ RTD_HOME: This is the directory into which Oracle RTD is
installed. For example, C:\OracleBI\RTD.
■ RTD_RUNTIME_HOME: This is the application server specific
directory in which the application server runs Oracle RTD.
For more information, see the section "About the Oracle RTD
Run-Time Environment" in Oracle Real-Time Decisions Installation and
Administration Guide.
Inline Services created in previous versions of Oracle RTD may need to have their Java
compiler compliance level manually changed to 5.0.
To change the Java compiler compliance level at the individual Inline Service level,
right-click the Inline Service name, select Properties > Java Compiler, then select 5.0 for
the Compiler compliance level.
The contents of the Inline Service folder are described in Table 12–1.
Tip: The Object ID is created as you name the object. Object IDs are
shown in the text box below the name of the object for which they are
created. The Object ID may be different from the label to conform to
Java standards. To look up an Object ID, toggle between showing
labels and showing Object IDs using the Toggle icon:
Table 12–2 Menu and Toolbar Items for Inline Service Perspective
Menu or Toolbar Item Name Description
File > New Inline Service Project Creates a new Inline Service project in the workspace
you choose.
Project > Download Downloads an already deployed Inline Service from
Real-Time Decision Server to make changes.
Project > Deploy Deploys an Inline Service to Real-Time Decision Server.
Window > Open Perspective > Opens an Inline Service perspective.
Inline Service Perspective
Window > Show View > Inline Shows the current Inline Service View.
Service Explorer View
Window > Display Object IDs Toggles between showing labels and Object IDs.
Help > About Displays version information about Decision Studio.
Table 12–2 (Cont.) Menu and Toolbar Items for Inline Service Perspective
Menu or Toolbar Item Name Description
Deploy icon: Deploys an Inline Service to Real-Time Decision Server.
The Inline Service Explorer View also has toolbar items. These items are described in
Table 12–3.
Link with Editor icon: Finds the proper editor for the selected element type and links
so that when you select an element, the editor adjusts
accordingly.
Menu icon: Provides access to Link with Editor, View Metadata Only, and
Always Show Object IDs. This last option shows both the
Object ID and label of elements in the Inline Service Explorer
and the editors.
The Java perspective combines views that you would commonly use while editing
Java source files, while the Debug perspective contains the views that you would use
while debugging Java programs.
To work directly with the generated Java code, use the Java perspective. To debug an
Inline Service at the Java code level, use the Debug perspective.
on perspectives, editors, and views, see the online documentation provided in the
Workbench User Guide, contained in the Eclipse online help.
Your code must fall between the start and end comments of the method. Any code that
falls outside of the commented areas risks being overwritten. The code added directly
to a generated Java file will be lost when the file is regenerated. To preserve the code, it
has to be copied back to the corresponding metadata element.
2. You should always lock an Inline Service when you download, so that additional
changes cannot be made by business users while you are enhancing it.
3. Make enhancements in Decision Studio.
4. Redeploy the Inline Service, releasing the locks.
During the period that you have the Inline Service locked, business users will be able
to view, but not edit, the deployed Inline Service.
When an Inline Service is deployed from Decision Studio, you chose a deployment
state from the deploy dialog. Three deployment states are packaged with Decision
Studio: Development, QA, and Deployment. Your system administrator may add
additional deployment states through JConsole.
When you test your Inline Service through the Test View, the last deployment state is
tested.
Table 12–4 (Cont.) Features of the Cross Sell Example Inline Service
Feature Element Name Description
Weighting decisions Decisions/OfferDecision The Decision element allows you to
by population weight the decision process across
segment the competing performance metrics.
In this case, we give priority to the
offers that score high on Customer
Retention a heavier weight for the
population segment that fits the
customer retention profile.
Integration to Integration Points Integration Points are the sites that
organizational touch outside systems and processes,
processes either by gathering information (such
as CallStart, which gathers
information from the IVR about the
customer) or provides information to
an outside system (such as
OfferRequest, which provides the
CRM system with the highest scored
offer for the customer).
It should be noted that the
OfferResponse Integration Point has
code in the else branch for
simulation purposes. In a production
situation, this would be feedback
from the service center operator on
whether the offer was accepted or
not.
The Cross Sell Inline Service is ready to be deployed and loaded with data. After you
deploy the Inline Service, open Load Generator by running RTD_
HOME\scripts\loadgen.cmd. Then, choose Open an existing Load Generator
script and browse to RTD_HOME\examples\CrossSell\etc\LoadGen.xml.
Finally, run the script.
This script takes simulated customer data and runs the Inline Service. The data and
correlations found can then be viewed in Decision Center.
These discoveries are published to a thin client, Decision Center, where business users
use these insights to make decisions. Business users also manage and optimize the
Inline Service through Decision Center.
Decision Studio elements are configured within Decision Studio, and the logic is
added in the form of Java scriptlets. This chapter describes the properties of each
element, and the Java scriptlets contained by the element (if any), with examples.
This chapter contains the following topics:
■ Section 13.1, "The Oracle RTD Decisioning Process"
■ Section 13.2, "About Element Display Labels and Object IDs"
■ Section 13.3, "About the Application Element"
■ Section 13.4, "Accessing Data"
■ Section 13.5, "Forming Entities"
■ Section 13.6, "Performance Goals"
■ Section 13.7, "Choice Groups and Choices"
■ Section 13.8, "Filtering Rules"
■ Section 13.9, "Scoring Rules"
■ Section 13.10, "Using Rule Editors"
■ Section 13.11, "About Decisions"
■ Section 13.12, "About Selection Functions"
■ Section 13.13, "About Models"
■ Section 13.14, "About Integration Points"
■ Section 13.15, "About External Systems"
■ Section 13.16, "About the Categories Object"
■ Section 13.17, "About Functions"
■ Section 13.18, "About Type Restrictions"
■ Section 13.19, "About Statistic Collectors"
■ Section 13.20, "About Decision Center Perspectives"
To see how extensions of these inputs can enable external applications together with
Oracle RTD to provide a composite decision service for their end users, see Chapter 17,
"Externalized Objects Management."
Note: When creating a new object, if the object name is already used
by an existing one, Decision Studio will automatically append a
number to the Object ID (such as 1, 2, and so on) to avoid conflicts.
When global parameters are set, getters and setters are generated in the code. To access
the application parameter, for instance myApplicationParameter of type string,
use the following:
String param = Application.getApp().getMyApplicationParameter();
Inline Service permissions work with server-side Cluster Permissions to secure the
Inline Service from being changed or redeployed by an unauthorized user. See Oracle
Real-Time Decisions Installation and Administration Guide for more information on setting
In this Entity, the customerId is the key of the Entity, name and age are simple attributes,
and accounts is a collection of Account entities that has been associated under the
Customer header.
This section contains the following topics:
■ Section 13.5.1, "About the Session Entity"
■ Section 13.5.2, "Creating Entities"
■ Section 13.5.3, "Adding Attributes and Keys to the Entity"
■ Section 13.5.4, "Importing Attributes From a Data Source"
■ Section 13.5.5, "Using Attributes for Analysis"
■ Section 13.5.6, "Decision Center Display"
■ Section 13.5.7, "Adding a Session Key"
■ Section 13.5.8, "Adding Attributes to the Session"
■ Section 13.5.9, "Mapping Attributes to Data Sources"
■ Section 13.5.10, "One-to-Many Relationships"
■ Section 13.5.11, "Adding Imported Java Classes"
■ Section 13.5.12, "Session Logic"
Note: While the Build data mappings for selected data source
functionality maps the entity attributes to the data columns, users
may still assign input values under the Data Source input values
section of the Entity editor.
choose the path to the data source column or output parameter that will supply the
attribute with data.
To map the key value, click Input Value from Data Source Input Values. Your key
value will appear here when you map the attributes to data source values. You can
map the key to a session key attribute, to another entity key value, or to a function.
The input type must be of type String. If it is not, use a function to transform the
non-string value.
You can use session() to access the other entities of the Inline Service. For example:
session().getCustomer().getCustomerId();
If no session keys have been passed in, the session is considered temporary.
The following code is used to access an Integration Point request outside of the
Integration Point and returns the current request:
public IntegrationPointRequestInterface getRequest();
The following code returns whether the current instance of the session has been
closed:
boolean isClosed();
The following code returns any known session keys. This may or may not be the
complete set, depending on where it is called.
Set getKeys();
The following code gets the application object of the current session:
public ApplicationInterface getApp();
For instance, for the Account entity, the following two classes are generated:
Account
SDAccountArray
The second class represents a collection of Accounts. So, when our Customer entity
has an attribute named accounts of type Account (with multiplicity set to multiple),
then the following gets generated for Customer:
Customer {
SDAccountArray getAccounts() {
}
void setAccounts(SDAccountArray accounts) {
}
void addToAccounts(Account account) {
}
}
Optionally, if the Entity is the child of another Entity, pass in the name of the parent
Entity. Session can be a parent Entity of any other Entity.
Customer cust = new Customer(entityParent);
Corresponding setters are also generated. We have already seen the setter for
customerId, but here are the others for our Customer example:
cust.setName("Fred Johnson");
cust.setAge(42);
cust.setAccounts(newCollection);
And, because Accounts is an attribute that has multiple values, you can also add to the
collection:
cust.addToAccounts(anotherAccountObject);
Fill recursively fills the values of the attributes according to the Entity mapping,
forcing it to refresh the data through the data source, calculated or constant value. Any
attributes of Entity type are also filled.
Reset and fill should not be called on cached entities.
Problem
For debugging and logging requirements, developers must write a series of log
statements, for example, using logDebug or logInfo, in order to examine the current
values for the Oracle RTD entities they are setting. Typically, a minimum of one line of
code is required for each entity attribute whose value should be output to the Oracle
RTD log. This results in a large number of lines of code simply to log output.
Solution
A predefined API in the Oracle RTD platform that allows a user to output to the
Oracle RTD log the value of all session entity attributes or of a specified entity and its
attributes. The output is at all the log levels: Info, Debug, Error, Warning, and Trace.
Notes:
1. In this section, only the logInfo command is specified. All the
enhanced logging options apply also to the commands logDebug,
logError, LogWarning, and logTrace.
2. For simplicity, for each logging option, only the essential "active"
parameter is shown. You can concatenate extra textual information into
each parameter for more informative logging messages.
Example
An Inline Service session entity has two attributes:
■ customer (Customer)
■ customer id (Integer)
The customer is an entity which has three attributes:
■ assets (String array)
■ productId (String array)
■ unfilled (String)
The following line:
logInfo(session());
generates output similar to the following in the Test > Log tab of the Inline Service:
Normalization Example
The following example with two Performance Goals illustrates why normalizing
scores is important. Assume the following:
■ The Performance Goals are Revenue and Likelihood.
■ The measurement units for Revenue are monetary amounts between $0 and $1000,
and for Likelihoods, numbers between 0 and 100.
■ The average Revenue per sale is $500.
■ The business wants to balance the relative importance of presenting offers that are
Revenue generating with offers that are of high interest to the customer.
For example, business users may be ready to linearly trade 100% of likelihood for
every incremental $500 in revenue. In other words, they would consider
presenting an offer which is 10% less likely to be accepted than one that would
bring $50 more in Revenue.
To achieve this balance without using normalization factors, the following weights
would need to be applied in the Decision:
■ Weight for Revenue = 1/500 = 0.002
■ Weight for Likelihood = 1 – (1/500) = 0.998
Applying such weights would be quite difficult to manage as small increments in
weight would drastically change the outcome of Decisions. The key factors in this
design are the following:
■ Revenue and Likelihood use different natural measuring scale units
■ Business users want to express how those two units need to be compared at the
point of Decision
2. Scoring: The computation of scores along each Performance Goal defined for the
Decision.
3. Normalization: Brings the scores along the different performance metrics to a
common scale that enables the comparison of scores.
4. Totaling: Produces a single number for each Choice. This number is a weighted
sum of the normalized scores for each Performance Goal for the Segment to which
the Decision applies.
5. Selection: Selects a set number of "best" Choices based on Choice total score.
Choices can either be Static or Dynamic.
With Static Choices, the Choices to present to the requesting application or
self-learning model are completely defined within Oracle RTD. Static Choices are
useful in cases where the Choices are known in advance, and are constant over a
period of time.
Dynamic Choices are Choices that are built dynamically at run time. These Choices
typically reside in external data sources. This allows for the management of Choices to
be done at the source system, such as Choices based on offers defined in an offer
management system.
Note: Choice Groups are always Static, that is, defined in an Oracle
RTD Inline Service.
This section describes the general features and processes applicable to Choice Groups
and to both Static and Dynamic Choices. For information specific to Dynamic Choices,
see Section 17.1, "Dynamic Choices."
This section contains the following topics:
■ Section 13.7.1, "About Choice Groups and Choices"
■ Section 13.7.2, "About Choice Group and Choice Attributes"
■ Section 13.7.3, "Choice Attribute Characteristics"
■ Section 13.7.4, "Using Choice Attributes for Learning"
■ Section 13.7.5, "About Choice Scoring"
■ Section 13.7.6, "About Eligibility Rules"
■ Section 13.7.7, "Evaluating Choice Group Rules and Choice Eligibility Rules"
■ Section 13.7.8, "Determining Eligibility"
■ Section 13.7.9, "Choice Group APIs"
■ Section 13.7.10, "Choice APIs"
■ Choice Events: Choice events are only described at the Group level. These events
identify important events in a Choice lifecycle. For instance, a Cross Selling Offer
made may have events such as Offered, Accepted, and Product First Used.
■ Rules: Two types of Rule can be applied to Choices, both of which can be created
and modified by Decision Center users:
– Eligibility rules govern the conditions under which Choices are considered for
a Decision. Eligibility rules can be defined at any level of the Choice Group
hierarchy. Choices inherit all the Eligibility conditions defined at a higher level
of the hierarchy.
– Scoring rules can be used to associate numeric scores to Choices. Those scores
can be used as part of the Performance Goal scoring logic or as attributes of
Choices.
■ Advanced: The Advanced button lets you choose to show the element in Decision
Center, and to change the label of the element. Changing the label of the element
does not change the Object ID.
The Choice attributes set at the Offers level for this example are shown in Table 13–7.
Table 13–7 Choice Attributes Set at the Offers Level for Offers Choice Group Example
Attribute Type Value
Message String No default value. Values assigned at Choice
level for each Choice.
ShouldRespondPositively Boolean The function ShouldRespondPositively()
that returns a Boolean value about whether a
customer will respond positively to a given
Choice. This specific function is used in the
context of the loadgen simulator.
likelihood Predictive/ A placeholder attribute that is assigned by the
Double choice model or choice event model where this
choice group is registered. Used for likelihood
that the choice will be accepted. There is no
default value as this is calculated at run time.
Profit Margin Double An indicator of the profitability of the offer
represented as a percentage. Default value of 0.5.
Values assigned at Choice level for each Choice.
Each Choice overrides the Profit Margin and Message values with a value that is
indicative of that Choice. However, the default value will be available at run time in
case the server cannot respond in an effective time period.
No Choices override the ShouldRespondPositively attribute, as they all use the same
function to determine that value. The likelihood is calculated by the model for each
Choice at run time.
There is another attribute at the Group level. It is a Group Attribute called
averageLikelihood, of type Predictive/Double. This attribute is used by the model as
an average of likelihoods across all choices. It is used as a likelihood if a likelihood for
a given Choice is not available. There is no default value, as this is calculated at run
time.
mandatory requirement, but it will help you in formulating the rule. For more
information about creating and using type restrictions, see Section 13.18, "About
Type Restrictions."
■ Inherited Value: The value, if any, that the Choice Group or Choice attribute has
inherited from its parent.
■ Value: The value of the attribute. This value always overrides an inherited value.
■ Show in Decision Center: Select this option to make the attribute visible to
business users in Decision Center. Deselect for internally used attributes.
■ Use for learning: Select this option to associate this choice attribute with a
transient session attribute. This option is used to enable multiple values of this
attribute that occur in a session (when the choice occurs or the choice event is
raised) to be available to learning records and associated models.
For more information, see Section 13.7.4, "Using Choice Attributes for Learning."
■ Session Entity Storage Attribute (enabled only if Use for learning is selected): The
name of the associated transient session attribute that automatically stores the
different choice attribute values that occur in a session.
■ Override default max input cardinality: Select this option to override, for this
attribute, the global default value Max Input Cardinality as described in
Section 13.3.4, "Setting Model Defaults." When you select this option, specify also
the Max Input Cardinality for this attribute.
■ Override default max input buckets: Select this option to override, for this
attribute, the global default value Max Input Buckets as described in
Section 13.3.4, "Setting Model Defaults." When you select this option, specify also
the Max Input Buckets for this attribute.
■ Use for indexing: Select this option if you want to be able to look up the Choice by
the attribute specified. For example, assume you have a choice attribute called
namefor this attribute.
■ Send to client: Select this option if the attribute will be sent to the outside client
calling the Inline Service that returns this choice.
To add or remove Choice attributes, click Add or Remove. To edit a Choice attribute,
right-click the attribute and choose Properties. You can only edit Choice attributes at
the highest level that they are defined.
then subsequently be written out to learning records with all of its copied-in choice
attribute values.
The following example illustrates the interaction between Choice Group rules and
Choice rules:
Group1 has rules GroupRule1 and ChoiceRule1
Group2 is a child of Group1 and has rules GroupRule2 and ChoiceRule2
Group2 has a Choice, Choice1, and it has a rule, Rule1
In evaluating the rules for Choice1, the rules will be invoked in the following order:
GroupRule1 AND GroupRule2 AND ChoiceRule1 AND ChoiceRule2 AND Rule1
The following code returns a Choice object from the Choice Group:
public Choice getChoice(String internalNameOfChoice);
When a Choice attribute is marked for indexing, the following method is used to
return the Choice as referenced by the indexed attribute:
public Choice getChoiceWithAttributeID(AttributeType val);
To get the Choice Group in which the Choice is contained, use the following code:
public ChoiceGroup getGroup();
Choice event tracking API consists of two methods defined on choices, as follows:
void recordEvent(String eventName);
void recordEvent(String eventName, String channel);
Tracking of extended and accepted offers is required by many Inline Services for
eligibility rules that depend on previous offers extended to, or accepted by, the same
customer in the past.
Two kinds of questions, both related to a particular customer, can be answered by the
Choice event history:
■ How long ago was an offer extended or accepted?
■ How many times was an offer extended or accepted during a given recent time
period?
The answers to these questions are provided by API methods defined on Choices and
Choice Groups:
int daysSinceLastEvent(String eventName);
int daysSinceLastEvent(String eventName, String channel);
int numberOfEventsDuringLastNDays(String eventName, int numberOfDays);
int numberOfEventsDuringLastNDays(String eventName, int numberOfDays, String
channel);
The rule shown in Figure 13–3 targets customers over the age of 18 with a credit line
amount over $8000.
See Section 13.10, "Using Rule Editors" for information on editing rules.
■ Add Rule
■ Add Rule Set
■ Delete
■ Invert
■ Move up
■ Move down
■ Copy
■ Cut
■ Paste
The editors that are used to create rules are very similar. The following sections
describe how to create rules using these editors.
This section contains the following topics:
■ Section 13.10.1, "Oracle RTD Rule Terms and Statements"
■ Section 13.10.2, "Adding Statements to Rules"
■ Section 13.10.3, "Selecting an Operator"
■ Section 13.10.4, "Editing Boolean Statements"
■ Section 13.10.5, "Editing Rule Properties"
■ Section 13.10.6, "Inverting Rule Elements"
Note: This section describes rules that have conditions, that is, they
are not always true.
The following is an example of a simple filtering rule, used to illustrate rule statements
in this section:
Select List Rule is true when
All of the following
1. session / customer / Age > 21
2. session / customer / MaritalStatus = "MARRIED"
Table 13–8 shows a more formal representation of the Oracle RTD rule grammar, using
BNF (Backus-Naur Form)-type conventions, which describes the terms used in Oracle
RTD rule statements.
<rule set> <logical operator> <rule entry>+ | The second <rule set> component
option is known as an array-processing
<array operator> <logical operator> <rule entry>+
rule set.
<boolean <boolean> | The <boolean statement> is the
statement> lowest level of a rule set - it cannot be
<boolean function> |
decomposed further.
<left operand> <relational operator> <right
operand>
<array <quantifier> <array variable> in <array name> , Used only for array-processing rule
operator> sets. For details, see Quantifiers and
Array-Processing Rules.
<quantifier> For all | There exists None.
Note: Each Oracle RTD rule has an implicit, unnamed, top-level rule
set.
Each rule set is qualified by a logical operator, which controls the processing of the
rule set statements. For more information, see Logical Operators.
The following Exclusion Rule example shows a rule set within a rule set.
In the example:
■ The top-level unnamed rule set contains the logical operator All of the following
and two rule entries. The first rule entry is a boolean statement, the second rule
entry is a rule set.
■ The rule set inside the top-level rule set contains the logical operator None of the
following and three rule entries, each of which is a boolean statement.
Note: Oracle RTD also supports rule sets that depend on values in an
array. For more details, see Quantifiers and Array-Processing Rules.
Logical Operators
The Oracle RTD logical operators are as follows:
■ All of the following (logical and). The rule set evaluates to true when all of its
boolean statements and lower-level rule sets are satisfied.
■ Any of the following (logical or). The rule set evaluates to true when any one of
its boolean statements or lower-level rule sets is true.
■ None of the following (logical not and). The rule set evaluates to true when all of
its boolean statements and lower-level rule sets are false.
■ Not all of the following (logical not or). The rule set evaluates to true when any
one of its boolean statements or lower-level rule sets is false.
In the following example, a rule has been created which examines all of the agents
contained in an array attribute, session/agents. In this example, the rule evaluates to
true when all the agents are at least 30 years old and have a status of "Qualified."
Agent Rule is true when
For all people in session/agents, All of the following
1. people / Age >= 30
2. people / Status = "Qualified"
Full details of the syntax of array-processing rules appear in the section following. In
the preceding example, the term people is an arbitrary term that is defined by the
user and is used to identify individual array elements in the rule set.
If this is the first element to be created in the rule, the following statements appear in
the rule:
■ The default logical operator All of the following
■ A rule set entry as the numbered first line in the rule, which itself contains the
default logical operator All of the following
■ An empty two-operand boolean statement within the newly-defined rule set
Otherwise, a new rule set entry is added as the next entry in the current rule set,
containing an empty two-operand boolean statement. For example, when you add a
rule set to an existing rule set that already contains one boolean statement, the added
rule set entry appears beside the line number 2, as in the following:
You can name the rule set, by clicking the top right corner. When a rule set is named,
you can collapse or expand the rule set, by clicking the appropriate chevron icon in the
top right corner of the rule set box.
If this is the first element to be created in the rule, the default logical operator All of
the following appears, followed by an empty two-operand boolean statement, as in
the following:
Otherwise, an empty two-operand boolean statement is added to the current rule set,
as in the following example, where one boolean statement already exists:
The negative call template is used when a rule is inverted, and should express the
opposite. For example:
There were less than {0} calls in the last {1} days
Rule properties also let you assign which Choice Group to use with the rule. By
selecting Use with choice group, you can specify which Choice Group or its Choices
will provide the Choice attributes for use by parameters. These attributes will be
available when you edit the value of an operand.
Multiple scores can be defined for each choice using a variety of scoring techniques
such as static scores or function driven values, rule based or predictive scores.
At run time, the Decision first identifies all the eligible choices in the subtree of its
associated Choice Groups. Then all the eligible choices are scored (with one or
multiple scores) and ordered.
Examples of scoring techniques for Choices include:
■ Likelihood of interest in the Choice (as computed by an Oracle RTD self-learning
predictive model)
■ Business value of the Choice (as computed by a user defined rule or function)
Alternatively, a custom selection function can be written to select the choice.
Selection criteria include:
■ Select Choice from: Used to assign the Choice Group or Groups that will be
considered by the Decision.
■ Number of Choices to Select: Indicates the maximum number of Choices that will
be selected by the decision. The actual number of Choices returned at run time
may be smaller or equal to this number, based on eligibility rules.
This number can be overridden at the Advisor level, in the event where one
decision is called by multiple touchpoints and each requires a different number of
choices to be returned.
The default and most commonly used number is 1.
■ Radio buttons for Type of Selection: The radio button that you select controls
whether you want to select a random Choice or if you want to use weighted
Performance Goals as part of the Choice selection procedure:
1. The Select with Fixed Goal Weights option enables you to specify population
segments and set Performance Goal weights for each of the segments. The
screen areas that appear when you select this option are:
* Target Segments: Segment of the population that have been segmented
using filtering rules. The default segment is everyone.
* Priorities: Used to set Performance Goal weights for a given segment. The
Performance Goals to use for scoring are selected in the Decision.
Consequently, each specified goal must have a matching scoring method
for each choice group selected for the Decision.
2. The Select with Custom Goal Weights option allows you to have custom
Performance Goal weights, typically by executing a function that returns
Performance Goal weights at run time.
If you select the Select with Custom Goal Weights option, and click the
ellipsis button beside the Select with Custom Goal Weights box, you must
select one of the following in the Value window:
* Function or rule call, then a function that returns a data type of
com.sigmadynamics.sdo.GoalValues
* Attribute or variable, then an application parameter or session attribute of
type com.sigmadynamics.sdo.GoalValues
3. The Select at Random option assigns random selection of a Choice from the
Choice Groups. This is often used for a Control Group Decision.
For more information on the Select with Fixed Goal Weights and Select with
Custom Goal Weights options, see Section 13.11.1, "Segmenting Population and
Weighting Goals."
To add a Choice Group, click Select, then select the Choice Group or Groups to use.
To select Performance Goals for the Decision, click Goals, then select the desired goals.
This section contains the following topics:
■ Section 13.11.1, "Segmenting Population and Weighting Goals"
■ Section 13.11.2, "Using a Custom Selection Function"
■ Section 13.11.3, "Pre/Post-Selection Logic"
■ Section 13.11.4, "Selection Function APIs for Custom Goal Weights"
■ Section 13.11.5, "Adding Imported Java Classes and Changing the Decision Center
Display"
There are two ways that you can set up your Decision, depending on what kind of
weights you want for your Performance Goals:
■ Pre-defined weights, whose values are specified in the Inline Service
■ Custom weights, whose values can be calculated or changed at run time
For pre-defined weights, start the decision setup process by selecting Select with Fixed
Goal Weights in the Selection Criteria for your Decision.
Then, add one or more target segments, which are defined by a rule or a function, as
follows:
■ To add or remove a Segment, click Add and Remove.
Finally, specify a fixed percentage weight for each Performance Goal that you select for
each segment, by performing the following steps for each segment:
Typically, the function would have parameters that can influence the values of the goal
weights, but that is not mandatory.
Within the custom goal weights function, you do not explicitly create segments.
Instead, you can include one or more conditions, each of which returns Performance
Goal weights for a separate subdivision of your population.
When you set up the Decision, you can either select the custom goal weights function
explicitly as the driving parameter of the process, or you can select an application
parameter or entity attribute that receives the goals from the custom goal weights
function or other sources.
For example, assume you have defined a condition, IsMarried, which effectively
segments your target population. You have two Performance Goals Max Rev and Min
Costs.
You create a function Get GoalValues, that returns a data type of
com.sigmadynamics.sdo.GoalValues, and which calculates and returns the
Performance Goals weights.
The key statements of the custom goal weights function Get GoalValues could be:
if (IsMarried)
{return new GoalValues().buildValueForMaxRev(100).buildValueForMinCosts(50);}
else
{return new GoalValues().buildValueForMaxRev(80).buildValueForMinCosts(120);}
With both pre-defined and custom weights, when the Decision is invoked, the
performance metric scoring (whether function, scoring rule, function, and so on) is
applied to all of the eligible Choices. Scores are leveled using the normalization factor
of the performance metrics. Scores are then weighted according to performance metric
weighting contained in the decision. A total score is achieved, and the Choice with the
highest score is selected.
13.11.5 Adding Imported Java Classes and Changing the Decision Center Display
To add imported Java classes to your Inline Service, click Advanced, next to the
description. You can also change the display label for Decision Center, and choose
whether the element is displayed in the Decision Center Navigator. Changing the
display label does not affect the Object ID.
13.12.2 Adding Imported Java Classes and Changing the Decision Center Display
To add imported Java classes to your Inline Service, click Advanced next to the
description. You can also change the display label for Decision Center, and choose
whether the element is displayed in the Decision Center Navigator. Changing the
display label does not affect the Object ID.
Models are associated at design time with a Choice Group. This defines the list of
Choices to which prediction and reports apply. The nature of the Choices to which
Oracle RTD models apply is very flexible as demonstrated by the following example:
■ A model can be associated with a Marketing Offers choice group that contains a
list of offers that have been presented and purchased by customers over time. This
model can then be used to:
– Predict: Compute the likelihood that a given customer will purchase a given
offer in the list
It is possible (and quite common) to define more than one Choice Event Model to
track the same group of events in a given Choice Group. The differences between
the models are typically related to time windows, base events or partitioning
attributes.
A Choice Model is used to predict and analyze the probability of occurrences of
Choices in general. Choice models do not define any events associated with their
Choices. The model predicts whether the Choice is present or not.
This is useful for situations where the Choices represent items that can be present
in a business process. Example include: the reason for a call, a product that is
being purchased, a Web page that is visited.
■ Models: These models are associated with a target attribute of type session
attribute. Plain Models or Models are typically not used but represent general
purpose predictive models that would not have inherent knowledge of
abstractions such as Choices, Choice Groups and Events.
– A secondary model that starts half-way through the lifecycle of the primary
model, and is only used for learning purposes until it becomes the primary
model itself
■ Use for prediction and Randomize Likelihood
All types of model can be used for prediction and reporting purposes. Models that
are to be used for prediction purposes must have the Use for prediction option
selected. When selecting this option, you can also decide whether or not to use the
Randomize Likelihood option.
Models used for prediction are available to compute a mathematical likelihood for
each eligible choice at runtime in the Decision Server.
The Randomize Likelihood option will apply some randomization formula on
those scores to avoid a local minimum or maximum situation. This frequent
situation occurs when new Choices are introduced during the life cycle of a model
and when Models associated with those new Choices are "competing" with models
on established Choices.
In the context of new Choices, it is sometimes useful to introduce some degree of
randomization so that those new Choices get a chance to be presented, and as a
result to accumulate learning. By selecting the Randomize Likelihood option, you
let Oracle RTD decide the degree to which model scores will be randomized. The
randomization factor applied by Oracle RTD when using this option is
proportional to the observed error of predictions for that given model.
■ Premise Noise Reduction
One known data pattern that needs to be addressed when using predictive models
for decision purposes is the case of self-fulfilling predictions. This situation
typically occurs when an input data attribute is always associated with the model
target attribute. If you expect this situation to occur, select the Premise Noise
Reduction option.
This option automatically identifies input variable values that are highly
correlated with the model output and ignores those values for prediction
purposes.
For example:
– Assume that a Model is built to predict products that will be added to a
shopping cart
– Assume that the array of products already in the shopping cart is used as
input to the Model
Using the Premise Noise Reduction option ignores the self-fulfilling correlation
observed between a product and itself. Oracle RTD will also ignore products that
are always associated with the input product, for example, as part of a bundle.
Though ignored for prediction purposes, input attribute values that are identified
as "noise" are still visible in Decision Center and displayed in graphs with gray
bars.
■ Advanced: The Advanced button lets you choose to show the element in Decision
Center, and to change the label of the element. Changing the label of the element
does not change the Object ID.
The decision to partition a model need to be made very carefully for the following
reasons:
– Creating attributes will reduce the number of observations for each choice and
attribute value combination, and therefore slow down the Model conversation
process.
– Model size is very sensitive to the cardinality of partitioning attributes.
– Excluded attributes. By default, all session and entity attributes are used as
inputs to Models. To remove a specific attribute from the list of Model inputs,
add them to the list of Excluded Attributes.
For Choice Models, the Attributes tab has the following specific option:
■ Aggregate by: By choosing one of the partitioning attributes, you can create
additional sub-models for learning on the attribute. As with partitioning, a
decision to aggregate on an attribute has to be based on a radical difference in
predicted likelihood depending on the value of the attribute in question.
Temporary Data Storage Tab for Choice Events and Choice Models
For Choice Event and Choice Models, the Temporary Data Storage tab has the
following common options:
■ Use temporary data storage
A common data pattern is that events related to Choices might not all occur
during the lifetime of the Oracle RTD session. To make sure the original input
values use for predictions are also used to update the Model when such delayed
positive outcomes occur, select the Use temporary data storage option.
■ Days to Keep: Specifies the number of days to keep temporary data stored on the
server.
■ Keys: The data stored in temporary data storage is available for retrieval by
having any one of the keys defined in the Temporary Data Storage tab.
The Informant usually records a Choice with the model. For instance, in a case where
we are recording the Choice of a call reason code with the Model Reason Analysis:
if (code == 17)
ReasonAnalysis.addToChoice("BalanceInquiry");
else if (code == 18)
ReasonAnalysis.addToChoice("MakePayment");
else if (code == 19)
ReasonAnalysis.addToChoice("RateInquiry");
else
ReasonAnalysis.addToChoice("Other");
If the Choices were not marked mutually exclusive, this call must include a call to
getModelData() before recording the Choice:
if (code == 17)
ReasonAnalysis.getModelData().addToChoice("BalanceInquiry");
else if (code == 18)
ReasonAnalysis.getModelData().addToChoice("MakePayment");
else if (code == 19)
ReasonAnalysis.getModelData().addToChoice("RateInquiry");
else
ReasonAnalysis.getModelData().addToChoice("Other");
If you are working with a Choice Array, you should send an empty string to the model
first:
ReasonAnalysis.getModelData().addToChoice("");
Example
For an example of the getChoiceEventModel API, see Example of Choice Event Model
APIs.
For an example of the getChoiceModel API, see Example of Choice Model APIs.
int sz = choices.size();
// Iterate through all eligible choices in the group
for (int i = 0; i < sz; i++) {
ClassificationsTestApiChoice ch = (ClassificationsTestApiChoice) choices.get(i);
String choiceId = ch.getSDOId();
String eventId = "record";
model.recordEvent(choiceId, eventId);
if (ch.getClassification() == classification) {
String cnm = ch.getSDOId();
eventId = "identified";
model.recordEvent(choiceId, eventId);
logInfo("ID " + session().getDnaRecord().getId()
+ " Classification: " + classification + " choice: "
+ ch.getSDOId() + " size was: " + sz);
}
}
if (amount > t) {
id = String.format(targetChoiceGroupName+"$"+targetChoiceBaseName+"%0
"+nDigits+".1fAbove", t);
model.recordChoice(id);
for (double it = t-spacing; it>t_min; it= it-spacing) {
id = String.format(targetChoiceGroupName+"$"+targetChoiceBaseName+"%0
"+nDigits+".1fAbove", it);
model.recordChoice(id);
}
break;
}
}
Example
The following shows an example of the getChoiceEventLikelihood API:
ChoiceEventModel model = Application.getApp().getChoiceEventModel(modelName);
return model.getChoiceEventLikelihood(choiceId, eventId);
■ Force Session Close: When selected, causes the Inline Service to automatically
terminate the session of the Informant after all of the Informant's asynchronous
logic has executed. The same effect can be achieved by placing the following Java
statement anywhere in a subtab of the Informant's Logic tab:
session().close();
This section contains the following topics:
■ Section 13.14.1.1, "Adding a Session Key"
■ Section 13.14.1.2, "Identifying the External System and Order"
■ Section 13.14.1.3, "Adding Request Data"
Note: If the type of the request field and the session key attribute do
not match, you should use a transform method.
13.14.2 Adding Imported Java Classes and Changing the Decision Center Display
To add imported Java classes to your Inline Service, click Advanced next to the
description. You can also change the display label for Decision Center, and choose
whether the element is displayed in the Decision Center Navigator. Changing the
display label does not affect the Object ID.
13.14.4.1 Logic
This script runs after any Request Data declared in Request Data are executed. If the
primary purpose of the Informant is to transfer data from the operational system
request fields to the session key and Request Data, logic may be unnecessary, as this
happens automatically according to declarations in the Request Data tab.
Logic in Informants is typically used for tracing message reception in the log file, or for
pre-populating entities whose keys are supplied by the Informant's message, in order
to avoid having to do this later in an Advisor, where response time might be more
important. Logic is executed directly following the Request Data.
Logic in the Informant can also be used to record Choices with a Choice Model. See the
Choice Model APIs for methods to call.
Each Advisor can make use of two Decisions, the Optimized Decision and the Control
Group Decision. This enables users to compare the respective performance of the two
options.
Generally, the two Decisions are set up as follows:
■ The Optimized Decision implements some decision logic that takes advantage of
the advanced features of the Oracle RTD Decision Framework.
■ The Control Group Decision is as close to the existing business process as possible,
so that the Optimized Decision has a basis for comparison.
Default Choices can be defined for the Advisor. These Choices are used when the
computation in the server can not be completed in time, or if the client loses
communication with the server.
13.14.7 Adding Imported Java Classes and Changing the Decision Center Display
To add imported Java classes to your Inline Service, click Advanced next to the
description. You can also change the display label for Decision Center, and choose
whether the element is displayed in the Decision Center Navigator. Changing the
display label does not affect the Object ID.
Note: If the type of the request field and the session attribute do not
match, you should use a transform method.
compare the business effectiveness of the Advisor's normal Decision object with its
Control Group Decision.
■ Parameters: Input parameter defined by the decision. The Name and Type
columns are descriptive only, surfaced here from the Decision object.
■ Default number of choices returned: Default number of choices returned by the
decision. This is the number of choices defined by the Decision.
■ Override default with: The Advisor can override or accept the number specified
by the referenced Decision. This area specifies the maximum number of qualified
choices to be included in the Advisor's response.
■ Default Choices: A list of Choices that are returned to the calling client application
whenever it tries to invoke this Advisor, and the Advisor is not able to deliver its
response within the server's guaranteed response time.
Note that default Choices do not have to be specified for each Advisor. The Inline
Service may also declare default Choices, which are used for Advisors that don't
declare their own. Also note that the default Choice configuration is propagated to
the client application and stored in the local file system by the Smart Client
component. Hence, it is subsequently available to client applications that cannot
connect to the server.
13.14.12.1 Logic
This script runs after any request data declared in the request data tab is executed, and
before the response is sent back to the client.
Advisor logic is generally not needed. You may want to use it for preprocessing data
coming in with the request, or for debugging purposes.
Each Maintenance Operation will appear twice in the MBeans tree for each Loadable
Inline Service:
13.17.3 Adding Imported Java Classes and Changing the Decision Center Display
To add imported Java classes to your Inline Service, click Advanced next to the
description. You can also change the display label for Decision Center, and choose
whether the element is displayed in the Decision Center Navigator. Changing the
display label does not affect the Object ID.
Functions are called from other elements using the call template. For instance, if you
wanted to use the multiply function described in the previous section, you would
choose the function from the Edit Value dialog. The call template {0} multiplied
by {1} provides the editor with the position and number of arguments.
Other Restrictions consist of either a range of values (for Date, Double, or Integer data
types), or a JavaScript Regular Expression pattern.
JavaScript Regular Expression patterns are generally used for data such as post codes
and telephone numbers, where each character of the data may be subject to a different
real-world constraint, depending on its position in the code. For example, US
telephone numbers, such as (650) 506 7000, and British postal codes, such as KT2 6JX.
The "label" and "value" columns are used in the Rule Editor when you edit a rule
statement, and you select an attribute or parameter to which you have attached a
type restriction.
The "label" column holds the dropdown list data. When you select from the
dropdown list, the corresponding data in the "value" column is placed in the rule.
For example, a type restriction on US state codes may enable a rule creator to
select a state name from a dropdown list of US state names - such as Alabama, or
California, and so on. The "state name" column is the "label" column.
After the rule creator selects a state name from the dropdown list, Oracle RTD
places the corresponding state code - such as AL, or CA - into the rule. The "state
code" column is the "value" column.
List of Entities type restrictions are defined with the following characteristics:
■ Entity: The entity for which you want to define a type restriction.
■ Function: The function that returns restricted data. The Return value for this
function must specify the type restriction entity as its Data Type.
■ Label: The attribute of the type restriction entity that holds the dropdown list
values when rules are created that reference objects with this type restriction.
■ Value: The attribute of the type restriction entity that holds the values
returned into rules when users select dropdown Label list values in the Rule
Editor.
You can define List of Entities type restrictions for String, Integer, Double, or Date
data.
In general:
■ List of Values type restrictions present constant lists
■ List of Entities type restrictions present dynamic run time lists
■ Other Restrictions enable design type validation other than checking against list
entries
Any violation of a type restriction constraint is treated as a warning rather than an
error, as follows:
■ The violating operand is underlined with a red wiggly line
■ When you mouse hover over the offending operand, you get detailed information
about the violation
The rule can still be compiled and deployed with warnings.
Create a type restriction called Product_Size, with values "Large", "Medium", and
"Small."
Attach the Product_Size type restriction to the attribute session/Product.
In the Rule Editor, create the filtering rule Large_Product as follows:
■ session/Product = "Large"
2. "List of Entities" Type Restriction
Create an entity New_Province, with String attributes Code and Fullname.
Create a function Fn_New_Provinces, which returns a value of data type New_
Province, with the following Logic:
SDProvinceArray provinces = new SDProvinceArray();
Province nb = new Province();
nb.setCode("NB");
nb.setFullname("New Brunswick");
provinces.add(nb);
return provinces;
Create a String type restriction, States Input, with the following characteristics:
■ Entity= Look Up
■ Function=Look Up States
■ Label=Statename
■ Value=Statecode
Deploy the Inline Service. This is to enable correct values to appear in a
subsequent dropdown list of values of the Rule Editor.
Attach States Input as a type restriction for the entity attribute
session/Address/State.
In the Rule Editor, create the filtering rule ND as follows:
■ session/Address/State = "ND"
The dropdown list for State values shows Statename values. When you select
"North Dakota", the corresponding Statecode value "ND" is placed in the rule.
4. Other Type Restriction Using a Range
Create a Date type restriction called From_Now_On, with a minimum inclusive
lower value of the current date.
Attach the From_Now_On type restriction to the attribute session/Acct/Pay_By.
In the Rule Editor, create the filtering rule PayUp as follows:
■ session/Acct/Pay_By = <current_date> + 45 days
5. Other Type Restriction Using a JavaScript Regular Expression Pattern
Create a Date type restriction called Morning Rush Hour, that restricts values to
times from 8:00 AM to 9:59 AM, with the following JavaScript RegEx pattern:
^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/
|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6
-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])
00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|
[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[8-9])(:[0-5]\d){0,2}(\
AM))|(0?[8-9])(:[0-5]\d){1,2})?$
Using the factory, create a collector, passing in the event name on which you want to
collect statistics (String) or the statistic name (String):
StatCollectorInterface collector = factory.getCollector(<event name | statistic
name> );
The event name or statistic name is an arbitrary string that represents what you want
to collect.
Then, finally, using the collector, record the event passing in the object_type (String),
object_id (String), event value (double), and extra data (string) to record:
Collector.recordEvent(<object_type>, <object_id>, event value, extra data);
The object_type must be a valid Object type, such as Choice, Choice Group, Entity, and
so on. The object_id is the internal name of the object.
Decision Center has three default perspectives: Explore, Design, and At a Glance. The
Inline Service Navigator changes according to the perspective you are using. Your
system administrator may have added additional perspectives.
You can control access to Decision Center perspectives by assigning permissions to
roles. See Oracle Real-Time Decisions Installation and Administration Guide for
information about managing roles.
To assign permissions for perspectives, go to the Inline Service Navigator in Decision
Studio and right-click the perspective for which you want to set access. Choose
Properties, then click Add. Select the role to which you want to assign permissions,
then select Use perspective under Permissions. Click OK to finish.
Services
This chapter describes how to deploy, test, and debug Inline Services.
This chapter contains the following topics:
■ Section 14.1, "Deploying Inline Services"
■ Section 14.2, "Connecting to Real-Time Decision Server"
■ Section 14.3, "Redeploying Inline Services"
■ Section 14.4, "Testing and Debugging Inline Services"
Deploy the Inline Service using the Project > Deploy menu item, or click the Deploy
icon on the task bar:
The Deploy dialog box appears. The options in the Deploy dialog box are shown in
Figure 14–1.
Note: You must have the proper permissions on the server cluster to
deploy an Inline Service. See Oracle Real-Time Decisions Installation and
Administration Guide for more information about cluster permissions.
Table 14–1 describes the options shown in the Deploy dialog box.
Note: While you must use Decision Studio for Inline Service
enhancement, you can redeploy the Inline Service either in Decision
Studio or by using a command line deployment tool. For more
information, see the chapter "Command Line Deployment of Inline
Services" in Oracle Real-Time Decisions Installation and Administration
Guide
Note: For information on how to output to the Oracle RTD log the
value of all session entity attributes or of a specified entity and its
attributes, see Section 13.5.21, "Enhanced Entity Attribute Logging."
The Decision is executed by the Integration Point, and the Choice is stored:
if (session().isControlGroup()) {
choices = RandomChoice.execute();
} else {
choices = SelectOffer.execute();
}
To find out what the Choice is, you can get them from the array and use getSDOId or
getSDOLabel.
if (choices.size() > 0) {
Choice ch = choices.get(0);
ch.getSDOId();
}
The best place to do this is in the Post Selection Logic of the Decision. After the
Decision executes, the post selection logic will run.
14.4.3 Using System Logs for Testing and Debugging Inline Services
You can use system logs to help you test and debug Inline Services, and also for
performance monitoring and tuning.
The main Oracle RTD system log file is at the following location:
■ RTD_RUNTIME_HOME\log\rtd_server.log
For more information, see Appendix A, "System Log and Configuration Files" in Oracle
Real-Time Decisions Installation and Administration Guide.
This chapter describes Load Generator, which is a tool used for debugging and
benchmarking Inline Services by simulating decision requests. Load Generator is used
both for testing Inline Services, and for performance characterization.
You can access Load Generator by opening RTD_HOME\scripts\loadgen.cmd. For
a sample Load Generator script, see the etc directory of the Cross Sell example.
Load Generator has four tabs:
■ Run: Runs a load generator session and provides feedback on the performance
through measurement and graphs.
■ General: Sets the general settings for Load Generator's operation, including the
rate at which data is sent to the server and the location of the client configuration
file.
■ Variables: Used to create script, message, and access variables.
■ Edit Script: Used to set up the script that specifies the Integration Point requests to
be sent to the server.
This section contains the following topics:
■ Section 15.1, "Using Load Generator for Testing"
■ Section 15.2, "Using Load Generator for Performance Characterization"
■ Section 15.3, "Running a Load Generator Session"
■ Section 15.4, "Viewing Performance Graphs"
■ Section 15.5, "About the General Tab"
■ Section 15.6, "About Variables"
■ Section 15.7, "About Actions"
■ Section 15.8, "Load Generator CSV Log File Contents"
■ Section 15.9, "XLS File Contents"
If you stop a script and restart it, all recorded data will be cleared. However, if you
pause a session and then start it again, the data will not be cleared. The following
graphs are available:
■ Average Response Time: A histogram depicting the 40 most recent average
response times.
■ Errors: A line graph depicting the number of errors that occurred within the most
recent 12,000 data samples.
■ Peak Response Time: A line graph depicting the peak response time, in
milliseconds, that occurred within each of the most recent 12,000 data samples.
■ Requests Per Second: A line graph depicting the average number of requests per
second that occurred within each of the most recent 12,000 data samples.
■ Requests Per Second distribution: A histogram depicting the 40 most recent
readings for requests per second.
■ String Array: Select a string from the specified array. For example:
List: [A, B, C], Access Type: Random
List: [Male, Female], Access Type: Sequential
■ Weighted String Array: Select from the specified array a string with some
likelihood [0,1]. For example:
List: [[0.3, Interested], [0.3, Accepted], [0.4, Rejected]]
List: [[0.999, Interested], [0.001, Accepted]]
This example shows a relative reference to a file in the inbox directory, under the
directory containing the script file.
The chapters in Part IV provide an in-depth look at the concepts, components, and
processes involved in Oracle RTD application development that require special
processing, such as batch framework and external editors that enable modification of
Oracle RTD application objects.
Part IV contains the following chapters:
■ Chapter 16, "Oracle RTD Batch Framework"
■ Chapter 17, "Externalized Objects Management"
16
16 Oracle RTD Batch Framework
Oracle RTD Batch Framework is a set of components that can be used to provide batch
facilities in an Inline Service. This enables the Inline Service to be used not just for
processing interactive Integration Point requests, but also for running a batch of
operations of any kind. This chapter describes the batch framework architecture, as
well as how to implement and administer batch jobs.
Typically, a batch will read a set of input rows from a database table, flat file, or
spreadsheet, process each input row in turn, and optionally write one or more rows to
an output table for each input row.
The following examples describe in outline form how you can use Oracle RTD batch
processing facilities in a non-interactive setting:
■ Create a "learning" batch to train models to learn from historical data about the
effectiveness of offers previously presented to customers.
■ Create an "offer selection" batch which starts with a set of customers, and selects
the best product to offer to each customer.
■ Create a "customer selection" batch which starts with a single product, and selects
the best customers to whom to offer the product.
■ Create a batch set of e-mails where Oracle RTD selects the right content for the
e-mails
Within an Inline Service, the Inline Service developer defines one or more Java classes
implementing the BatchJob interface, with one BatchJob for each named batch that
the Inline Service wishes to support. In the Inline Service, each of the BatchJob
implementations is registered with the Oracle RTD Batch framework, making the job
types available to be started by an external batch administration application.
External applications may start, stop, and query the status of registered batch jobs
through a BatchAdminClient class provided by the Batch Framework. The Batch
Console, released with Oracle RTD, is a command-line utility that enables you to
perform these batch-related administrative tasks.
Note: The following terms are referenced throughout the Oracle RTD
documentation:
■ RTD_HOME: This is the directory into which Oracle RTD is
installed. For example, C:\OracleBI\RTD.
■ RTD_RUNTIME_HOME: This is the application server specific
directory in which the application server runs Oracle RTD.
For more information, see the Section "About the Oracle RTD
Run-Time Environment" in Oracle Real-Time Decisions Installation and
Administration Guide.
Inline Service is deployed, and executes batch commands on behalf of the Batch
Manager.
In a clustered environment, all the batch framework components appear in each
Oracle RTD instance. However, the Batch Manager is only active in one of the
instances, and that active Batch Manager controls all the Batch Admin Client and
Batch Agent requests in the cluster.
A batch client application, such as the Batch Console, communicates with the Batch
Manager, by invoking batch management commands, such as to start, stop, or pause a
job.
Developers using Decision Studio can create and deploy Inline Services with batches
to any instance where Oracle RTD is installed, such as that on Cluster server 2.
The diagram shows the Batch Agent on the Cluster server 2 instance registering
batches with the Batch Manager.
The Batch Manager can then run batch jobs on any instance, such as that on Cluster
server 3, so long as they were previously registered.
The easiest way to create the Java classes is to subclass from BatchJobBase, provided
with the batch framework.
The principal methods of a batch job are called in the following sequence when the job
is started:
1. init()
Called once by the framework before starting the batch's processing loop.
2. getNextInput()
Returns the next input row to be processed by the batch.
3. executeRow()
The BatchJob implements this method to process the input row that was returned
by getNextInput. Generally, this is called in a different thread from
getNextInput.
4. flushOutputs()
Called by the framework to allow the BatchJob to flush its output table buffers.
5. cleanup()
Called by the framework after the batch is finished or is being stopped. Cleans up
any resources allocated by the batch job, such as the result set created by its
init() method.
For full details of the methods of the BatchJob interface, see the following Javadoc
entry:
RTD_HOME\client\Batch\javadocs\com\sigmadynamics\batch\BatchJob.html
16.2.2.1 BatchAgent
In a batch job, the batch agent is the interface between a batch job and the batch
framework. You need to register the batch job with the batch framework.
An inline service can locate its batch agent through a getter in its Application object.
For example, in a context where the Inline Service has access to a session, you can use
the following command to access the BatchAgent:
■ BatchAgent batchAgent = session().getApp().getBatchAgent();
For example:
crosssell.batch.OfferSelectJob
For full details of the BatchAdminClient interface, see the following Javadoc entry:
RTD_
HOME\client\Batch\javadocs\com\sigmadynamics\batch\client\BatchAdminClient.html
Notes:
1. You must enter batch user name and password information. If you do
not specify values for the -user and -pw parameters, you will be
prompted for them.
2. <RTD_server_URL> (default value http://localhost:8080) is the
address of the Decision Service. In a cluster, it is typically the address of
the load balancer's virtual address representing the Decision Service's
J2EE cluster.
3. Use the -Djavax.net.ssl.trustStore="<trust_store_
location>" parameter only if SSL is used to connect to the Real-Time
Decision Server (that is, where -sslConnection is set to true), where
<trust_store_location> is the full path of the truststore file. For
example,
-Djavax.net.ssl.trustStore="C:\OracleBI\RTD\etc\ssl\sd
trust.store". In this case, <RTD_server_URL> should look like
https://localhost:8443.
4. If you enter -help, with or without other command line parameters, a
usage list appears of all the Batch Console command line parameters,
including -help.
To see a list of the interactive commands within Batch Console, enter ? at the command
prompt:
command <requiredParam> -- [alias] Description
If you run the status command later, you can see that the job finished without
errors, after processing 50,000 customers in 9 minutes and 44 seconds:
ID Name State Rows Errors Restarts
-- ---- ----- ---- ------ --------
batch-2 MyBatchJob1 Finished 50,000 0 0
This chapter describes the extensions that are available to basic Oracle RTD elements,
how they are defined and used in the composite decision process, and how they are
integrated with the external applications that they serve.
Oracle RTD produces adaptive enterprise software solutions by a process of
continuously learning in real time from business process transactions as those
transactions are executing. By continuously learning in real time, the adaptive
solutions can optimize the outcome of each transaction and of the associated business
process.
The basic framework of the Oracle RTD decisioning process is as follows:
■ Oracle RTD makes analytic decisions for each interaction.
■ Based on rules and predictive models, Oracle RTD decisions use real-time and
historical data to make optimal recommendations from a variety of choices.
■ In making the best recommendations, Oracle RTD optimizes across potentially
conflicting business goals.
The following image shows the standard elements that form the framework for the
Oracle RTD decision process, together with a significant set of inputs that enable
external applications together with Oracle RTD to provide a composite decision
service for their end users.
The standard elements of the Oracle RTD decision process - decisions, entities, choices,
rules, models, and performance goals - are defined within Decision Studio. For general
information about these elements, see Chapter 12, "About Decision Studio" and
Chapter 13, "About Decision Studio Elements and APIs."
Oracle RTD can adapt to real-time changes to objects in external data systems, such as
choices maintained in external content management systems.
Applications using Oracle RTD can also enable their users to make significant
on-the-spot modifications to the decision process by creating and modifying the rules
and by altering the performance goals that drive and control the overall decision
process.
This chapter describes how these extensions to basic Oracle RTD elements are defined
and used in the composite decision process, and how they are integrated with the
external applications that they serve.
This chapter contains the following topics:
■ Section 17.1, "Dynamic Choices"
■ Section 17.2, "External Rules"
■ Section 17.3, "Example of End to End Development Using Dynamic Choices and
External Rules"
■ Section 17.4, "Externalized Performance Goal Weighting"
The Dynamic Choices to be presented to an application may vary over time, but
always reflect the up-to-date state of the application data. It is not necessary to
redeploy the Oracle RTD Inline Service when dynamic choice content is updated.
The column that categorizes or groups the Dynamic Choices is an important required
key identifier for setting up Dynamic Choices.
Each row in the group shows a different type of insurance product being offered, such
as AutoInsurance, and DisabilityInsurance. Each row represents a Dynamic Choice.
One column serves to identify the particular Dynamic Choice within the group. In this
example, the ChoiceID column is the Dynamic Choice identifier column.
Other columns in the table, such as ProfitMargin, can be used by Oracle RTD in the
evaluation process. These columns can also be sent back to the application as part of
the Dynamic Choice recommendation, as a value for a defined Choice attribute.
In short, the setup process is that, in Oracle RTD, you set up a Choice Group for
Dynamic Choices, and associate this Choice Group with the required external Data
Source or Sources. The Dynamic Choices are then available to be recommended by
Oracle RTD.
After sufficient recommendations have been made and models have been updated for
the corresponding Choice Group, you can analyze the performance of the various
Dynamic Choices through Decision Center, as shown in Figure 17–2.
■ The set of all the Dynamic Choices is identified as all the rows that have a common
value in a "grouping" or categorizing column. In the Insurance_Proposals
example, the categorizing column (or set identifier) is the ChoiceGroupId column.
■ Each row in the database set represents a single Dynamic Choice. In the Insurance_
Proposals example, the Dynamic Choice itself is identified by the unique value in
the ChoiceId column.
■ When you define the Choice Group for Dynamic Choices in Oracle RTD, you must
link the Group to the set of rows that contain the Dynamic Choices.
■ When you define the Dynamic Choices in the Choice Group in Oracle RTD, you must
link each Dynamic Choice in the Group to the corresponding single Dynamic
Choice row in the Data Source.
For this situation, you set up two Choice Groups in Oracle RTD, making both sets of
data available for recommendations in the application.
After sufficient recommendations have been made and models have been updated for
the corresponding Choice Group, you can analyze the performance of either or both of
the Insurance Products and Insurance Services Dynamic Choices.
For example, the Choice Groups could have been set up as two groups in a group
hierarchy, and available for analysis in Decision Center as shown in Figure 17–4.
Analyzing the Insurance Products provides the same results as shown in Figure 17–2.
Figure 17–5 shows an equivalent analysis report for Insurance Services.
The column does not need to have unique values across all the rows, just within
the extracted data set.
Any column that provides a unique identifier within the extracted data is
sufficient. Oracle recommends that the column values include some textual
component. These values appear as headers for some Decision Center reports, and
an identifier that is meaningful in the real world sense is more useful than a
strictly numeric identifier.
Figure 17–6 is an example of a database table Web Offers, that could be used as the
external data source for a Dynamic Choice data source.
Figure 17–7 Overview of Setup Process for Single Category Dynamic Choices
Figure 17–8 shows how the Data Source Web Offers DS is set up from the table
SDDS.WEBOFFERS, with Category as the Input identifier, and a number of other
columns that represent attributes of the Dynamic Choice itself.
Figure 17–10 Defining the Dynamic Choice Set Entity Web Offers List
5. Click the Mapping tab, and map each Attribute within the entity-type Attribute to
the appropriate column in the original Data Source.
6. In the Data Source Input Values region, for the Input Value of the Data Source,
select the Dynamic Choice categorizing Attribute that you created in step 2.
Figure 17–11 shows the Mapping tab for the setup of the Dynamic Choice Set
Entity Web Offers List. Each of the Attributes within the array Attribute is
mapped to the corresponding column in the Web Offers DS Data Source. In the
Data Source Input Values region, the Attribute selected for the Input Value is the
key Attribute Category.
Figure 17–11 Mapping the Web Offers Attributes in the Web Offers List Entity
where:
■ WebOffersList is the object name, with internal spaces deleted, for the Entity
created in Section 17.1.8, "Creating the Dynamic Choice Set Entity."
■ list.setCategory references the Entity key that you created in Section 17.1.8,
"Creating the Dynamic Choice Set Entity," step 2.
■ getWebOffers() refers to the Entity created in Section 17.1.7, "Creating the
Single Dynamic Choice Entity," that is mapped inside the Dynamic Choice Set
Entity.
Figure 17–12 shows the definition of the GetWebOffers Function.
Note: You only need to fill in Dynamic Choices tab parameters in the
lowest-level Choice Groups of a multi-level Choice Group hierarchy.
In Decision Studio, the Choice Group is configured to be able to extract the Choices
dynamically at runtime through options that you set up in the following tabs:
■ Group Attributes Tab
■ Choice Attributes Tab
■ Dynamic Choices Tab
These are the main tabs where you configure Dynamic Choices.
Note:You can also use the Choice Eligibility tab, to filter the
Dynamic Choice data as it is extracted from the Data Source.
Eligibility rules created for a Dynamic Choice are shared across all
Choices retrieved for the same Dynamic Choice Group.
Figure 17–13 shows an example of the main elements required to set up a single
category Choice Group, Dynamic Offers.
The Group Attribute setup indicates that all the data to be retrieved for the Dynamic
Choices will be of one category only, and you must specify the exact category here.
The Choice Attribute setup describes the individual attributes that will be retrieved.
The Group and Choice Attributes are then referenced in the Dynamic Choices tab for
this single category Choice Group.
Note: This string Value is the exact value in the database that
categorizes all the Dynamic Choice rows for a Choice Group.
For example, for a Choice Group set up for the Insurance_Proposals
table as described in Section 17.1.1, "Simple Example of Dynamic
Choices," the Value is InsuranceProducts.
Figure 17–14 shows the Group Attributes tab for the Choice Group Dynamic
Offers. The Function to call is GetWebOffers. The Value in the Parameters area is
the string DynamicOffersCG.
Figure 17–14 Defining the Group Attributes for the Choice Group Dynamic Offers
Figure 17–15 Defining the Choice Attributes for the Choice Group Dynamic Offers
Note: For more information about this parameter, and the parameter
in the following step, see Section 17.1.13.4, "Distribution of Choices
Across Decision Center Folders."
7. Select the Maximum number of choices within one choice group folder on
decision center.
8. The field Function returning the entity for a given choice is optional.
If provided, it must take two String parameters, Choice Group ID and Choice
Group in that order, and return an entity object.
This function is called as part of the <Choice Group>.getChoice() processing.
If you do not specify this function, then getChoice() will perform the following
operations:
a. It will call the function configured against the list of entities on the Group
Attributes tab.
b. It will iterate through all entities to find the matching one.
This iteration may be inefficient when there is a large number of dynamic choices.
If you specify this function, it will be used in preference to a and b, and must
return the entity corresponding to the specified Dynamic Choice ID.
Figure 17–16 Defining the Dynamic Choice Parameters for the Choice Group
Note:You can also use the Choice Eligibility tab, to filter the
Dynamic Choice data as it is extracted from the data source.
Eligibility rules created for a Dynamic Choice are shared across all
Choices retrieved for the same Dynamic Choice Group.
To allow for multiple Dynamic Choice categories, you must create a hierarchy of
Choice Groups, and set up the Choice Group elements at different levels.
Figure 17–17 shows an example of the main elements required to set up a two-category
Choice Group, Incentive Choices.
The Choice Group Incentive Choices is the parent Choice Group, with two child
Choice Groups, Discounts and Gifts.
You specify the Choice Attributes at the top level, in the parent Choice Group. These
Choice Attributes are then inherited by the two child Choice Groups.
Each child Choice Group enables a different category set of data to be retrieved,
through the Group Attributes setup. The Group and Choice Attributes are then
referenced in the Dynamic Choices tab for both of the child Choice Groups.
To compare this process with the equivalent single category Choice Group setup, see
Figure 17–7.
6. Click the right-hand end of the Value box to expose the ellipsis (...) button, then
click the ellipsis button to open the Value window.
7. In the Value window, select the option Value for array as a whole.
8. For Value Source, select Function or rule call, then select the Function that you
created in Section 17.1.9, "Creating the Dynamic Choice Data Retrieval Function."
9. In the Parameters area, choose the Value of the parameter that will retrieve the
corresponding rows in the Data Source whose Input attribute contains that value.
Note: For more information about this parameter, and the parameter
in the following step, see Section 17.1.13.4, "Distribution of Choices
Across Decision Center Folders."
7. Select the Maximum number of choices within one choice group folder on
decision center.
Figure 17–18 Example of Definition and Reporting with Static Choices Only
In Decision Center, only those Dynamic Choices that have actually been recommended
and added to model learning data appear in the Decision Center Navigator, and have
Performance and Analysis reports.
The other factor that influences how the Dynamic Choices appear in the Decision
Center is the parameter Maximum number of choices within one choice group folder
on decision center, which you specify when you define the Dynamic Choice Group. If
the number of choices exceeds this maximum, the choices appear under
system-created range folders, otherwise they appear directly under the Choice Group
name.
For more information on range folders, see Section 17.1.13.3, "System-Created Range
Folders."
The example Decision Support Navigator menu in Figure 17–20 shows the following:
■ Five Dynamic Choices were recommended and added to model learning data.
■ The maximum number of choices per choice group is 3.
■ Each Dynamic Choice appears under one of the two system-created folder names.
If the total number of (Static choices + Dynamic Choices recommended and added to
model learning data) exceeds the maximum defined for the Choice Group folder, the
choices appear in system-created "groups" or subfolders, otherwise they appear
directly under the Choice Group name.
The Maximum number of choices parameter limits the number of Choices, regardless
of whether they are Static or Dynamic, in each range folder.
The Distribution mode parameter specifies how the range folders are populated:
■ In Spill mode, each range folder is filled up to the maximum, and the final range
folder typically has less values than the maximum.
■ In Even mode, the aim is to distribute the Choices evenly across the range folders.
For example, if there is a total of 106 Static or Dynamic Choices to display in the
Decision Center, and the maximum per range folder is 25:
■ In Spill Mode, the distribution across the range folders is 25,25,25,25,6.
■ In Even Mode, the distribution across the range folders is 22,21,21,21,21.
The external rules are stored in metadata form in an external content repository, which
can be any external data system, but is typically a database. The content management
server controls read and write access to the rules stored in the external content
repository.
Business users edit rules through an Oracle RTD Rule Editor embedded in a third
party external interface provided by a content management product.
The external interface dynamically sets the context in which the rule needs to be edited
in the embedded Rule Editor. For example a rule can be attached to a specific group's
choice, a choice group or a filtering rule.
In the Rule Editor, the business user creates and edits rules, which can reference any of
the objects defined in the Inline Service, such as any of the dynamic choices, functions,
and session attributes.
After the user has finished editing the rule in the Rule Editor, the rule metadata is
passed to the external interface, which saves the rule metadata to the external content
repository.
At run time, the Inline Service accesses the edited external rule from the external
content repository.
Note: For the eligibility rule functions, one of the parameters sets the
context for rule evaluation. For example, the parameter choice in the
function External Rules - Evaluate Choice Eligibility Rule specifies the
particular choice name where the external rule will be evaluated.
The call templates for both External Rules - Evaluate Choice Eligibility Rule and
External Rules - Evaluate Choice Group Eligibility Rule are released as:
■ Value of rule {0} evaluated in context of Choice {1}, {2} if rule is invalid
The call template for External Rules - Evaluate Filtering Rule is released as:
■ Value of rule {0}, {1} if rule is invalid
The call template for External Rules - Evaluate Scoring Rule is released as:
■ Value of rule {0}, {1} if scoring rule is invalid
boolean defaultReturnValue,
boolean blockEvaluationUntilCached,
boolean propagateExceptions);
public static EvaluationOptions getEvaluationOptions(
double defaultReturnValue,
boolean blockEvaluationUntilCached,
boolean propagateExceptions);
}
The External Rules functions are similar to one another, in that each function creates a
rule definition, obtains a rule evaluator and rule cache, defines evaluation options, and
then evaluates the rule. The difference between the functions is in their scope and
return value:
■ Scope - the functions evaluate as a scoring or filtering rule or for a choice or choice
group
■ Return value - the eligibility and filtering functions return a boolean value, the
scoring functions return a double value
The following example shows a choice eligibility evaluation function (from the DC_
Demo Inline Service) in more detail.
//compile, cache and evaluate the eligibility rule and return a boolean
if (ruleMetadata == null || ruleMetadata.trim().equals(""))
return true;
RuleDefinition def = new RuleDefinitionImpl(ruleMetadata);
RuleEvaluator evaluator = Application.getRuleEvaluator();
RuleCache cache = Application.getRuleCache();
The following example shows the equivalent active (that is, non-commented) lines of
the scoring evaluation function (from the DC_Demo Inline Service) in more detail.
if (ruleMetadata == null || ruleMetadata.trim().equals(""))
return defaultValue;
RuleDefinition def = new RuleDefinitionImpl(ruleMetadata);
RuleEvaluator evaluator = Application.getRuleEvaluator();
RuleCache cache = Application.getRuleCache();
■ Scoring Rule
The eligibility rules are defined as part of a choice or choice group definition. Filtering
and scoring rules are standalone rules, in that they are created independently of any
other Oracle RTD object. After creation, filtering rules can be attached to one or more
decisions, and scoring rules can be attached to choice and choice group attributes.
This section describes the process of setting up external rules.
The examples in this section are based on the DC_Demo Inline Service, which is
released with Oracle RTD.
This section contains the following topics:
■ Section 17.2.4.1, "Prerequisite - Setting Up Objects in an External Content
Repository"
■ Section 17.2.4.2, "Defining the Inline Service Objects for the Rules"
■ Section 17.2.4.3, "Defining External Rules for Inline Service Objects"
Example
For rule set up, the data source Web Offers DS is based on the table
SDDS.WEBOFFERS, and the entity Web Offers, derived from Web Offers DS,
includes the two attributes Eligibility Rule Metadata and Scoring Rule Metadata.
For dynamic choice setup, the entity Web Offers contains Id, and the entity Web
Offers List (also derived from Web Offers DS) contains the attribute Category.
The choice group Dynamic Offers includes Eligibility Rule Metadata and Scoring
Rule Metadata among its choice attributes, as well as the attributes required for
dynamic choice definition.
For more details, see Section 17.3, "Example of End to End Development Using
Dynamic Choices and External Rules."
As a choice eligibility example, in the DC_Demo Inline Service, the external rule for
choice group Dynamic Offers is defined in the Choice Eligibility tab as follows:
DC_Demo Inline Service also contains an example of an external scoring rule, for the
choice group Dynamic Offers.
In the Choice Attributes tab, the value for the choice attribute Dynamic Score is
derived from the function External Rules - Evaluate Scoring Rule. The parameters for
the function are the choice attributes Scoring Rule Metadata and Default Score.
In the Scores tab, the Score for the performance metric Offer Acceptance is derived
from the choice attribute Dynamic Score.
For more information on External Rules functions and parameters, see Section 17.2.3.1,
"External Rule Evaluation Functions."
Table 17–3 shows the parameters for each type of rule. The HTML form must create
form inputs with values for each of the parameters listed in Table 17–3.
The form inputs help to create an initial context and scope for the embedded Rule
Editor.
For an example, see Defining the Rule Editor IFrame in the DC_Demo External Rules
Helper.
For an example, see Changing Rule Editor Context and Scope in the DC_Demo
External Rules Helper.
The database columns are mapped to Oracle RTD entity object attributes through the
data source Web Offers DS, as in the following image:
■ The entity called Web Offers contains the attribute information for one dynamic
choice.
■ The entity Web Offers List contains a set of dynamic offers obtained by the
database and is mapped to a datasource that describes the dynamic choice table
information.
A choice group called Dynamic Offers is created whose dynamic choice configuration
is enabled and set to use the Web Offers entity for assigning choice attribute data.
The following image shows dynamic choice definition for the Dynamic Offers choice
group.
The following image shows dynamic choice attributes mapped to the Web Offers
entity attributes. Note the two choice attributes Eligibility Rule Metadata and Scoring
Rule Metadata, which are used to store the external rule metadata, and will be used to
evaluate choice eligibility and scoring.
For general information about setting up dynamic choices, see Section 17.1.5,
"Overview of Setting up Dynamic Choices in Decision Studio."
Defining the Rule Editor IFrame in the DC_Demo External Rules Helper
The following is an example of how the embedded rule editor is integrated into the
DC_Demo external Rule Editor helper:
<!--
form attributes:
-->
<!--
form inputs:
</form>
Changing Rule Editor Context and Scope in the DC_Demo External Rules Helper
The embedded Rule Editor context and scope can also be dynamically changed with
Javascript functions.
The following is an example of how DC_Demo dynamically changes the context and
scope of the Rule Editor using defined Javascript functions to change the form input
values:
<!--
editorViewForm: name of the form containing the rule editor
editorViewForm.object: ID of the choice or choice group context
editorViewForm.type: scope or context type (for example, choiceGroup)
editorViewForm.editingAspect: editor aspect view (for example, choiceRule)
-->
<script>
groupChoiceScope: function() {
editorViewForm.object.value = "DynamicOfferCG";
editorViewForm.type.value = "choiceGroup";
editorViewForn.editingAspect.value = "choiceRule";
loadRule();
}
</script>
</script>
The Tabular View displays the rows of the database table WEBOFFERS, where the
significant columns are:
Note: Decision Center does not by default display the eligibility rule
of a Dynamic Choice, even when the rule was edited with an external
Rule Editor.
Decision Center can be used to view reports for each dynamic choice defined in a
content database, which were actually recommended and added to model learning
data. This is done by logging into a Decision Center Inline Service and opening the
Decision Process section in the Decision Center navigator.
From here, any defined dynamic choice groups will be listed and will contain all
dynamic offers defined in database tables for each dynamic choice group, that were
recommended and added to model learning data. Choices in the database tables that
were not added to model learning data do not appear in Decision Center reports.
The following is an image of a Decision Center report, with the navigator tree showing
the DC_Demo dynamic choices:
Analytics
This chapter describes the transactional logging and decision analytics feature. This
feature provides analytics on the decisions and events that are processed by Oracle
RTD, that is, it provides transactional reporting capabilities on Oracle RTD choice
events and decisions. It enables business users to easily see a summary performance of
choices by decision.
Transactional logging and decision analytics uses other business intelligence
technologies such as Oracle Business Intelligence Enterprise Edition (OBIEE).
This chapter contains the following topics:
■ Section 18.1, "High Level Architecture"
■ Section 18.2, "Specifications"
■ Section 18.3, "Installation"
■ Section 18.4, "Customization"
18.1.1 Terminology
Decision Analytics - The transactional reports based on OBIEE.
18.1.2 Logging
Inline Services can use Java APIs to log decision and event information in transactional
tables within SDDS.
18.1.3 Transformation
A stored procedure is provided to move the contents of the transactional tables in
SDDS into a star schema. This star schema resides in a different database schema.
The stored procedure is typically run once a day.
18.1.4 Reporting
OBIEE is used to provide dashboards reporting on this star schema.
Sub-components include:
■ An OBIEE RPD which provides the physical and logical mappings
The RPD also provides some measures that are used by the reports. These
measures are specific to the marketing use case.
■ A Web Catalog which provides dashboards for the marketing use case. One
dashboard is generic and can be used with any kind of choices (static or dynamic).
The generic dashboard can be viewed within OBIEE Presentation Services.
18.2 Specifications
Two tables, SDDecisionLog and SDChoiceEventLog, have been added to SDDS. This
section describes these tables and the other components of the transactional logging
and decision analytics feature.
This section contains the following topics:
■ Section 18.2.1, "SDDecisionLog"
■ Section 18.2.2, "SDChoiceEventLog"
■ Section 18.2.3, "Partitioning"
■ Section 18.2.4, "Inline Service APIs"
■ Section 18.2.5, "Report Schema"
■ Section 18.2.6, "OBIEE Integration"
18.2.1 SDDecisionLog
Column Description
session_key Key of session (customer identification)
app_name_id ID of the application (Inline Service)
version_id Version of the application.
This gets incremented every time the Inline Service is redeployed
choice_parent_id ID of the choice group to which this choice belongs
choice_parent_id_name Name of the choice group to which this choice belongs.
choice_id ID of the choice.
Column Description
choice_id_name Name of the choice
channel_id Channel in which this decision was made
happened Timestamp of the decision based on application time (in seconds
since January 1st 1970 UTC)
day_of_month Day of the month of the decision in format day_n or day_nn
decision_instance_id Unique id representing the decision
ip_name Name of the integration point
decision_name Name of the decision
control_group Whether this is a control group decision or not (’Y’ or ’N’)
is_random Whether this is a random decision or not (’Y’ or ’N’)
segment_id ID of the decision segment
segment_name Name of the decision segment
perf_goal_1 Name of the first performance goal
individual_score_1 Score for the first performance goal
individual_weight_1 Weight for the first performance goal
perf_goal_2 Names, scores, and weights for subsequent performance goals
individual_score_2
individual_weight_2
........
perf_goal_10
individual_score_10
individual_weight_10
total_score Total score for all performance goals
score_rank Rank of this choice among other choices in this decision
hierarchy_id_1 ID of the first related choice or choice group in the hierarchy.
hierarchy_id_2,..., IDs of subsequent related choices or choice groups in the hierarchy
hierarchy_id_10
hierarchy_id_name_1 Name of the first related choice or choice group in the hierarchy.
hierarchy_id_name_2,..., Names of subsequent related choices or choice groups in the
hierarchy
hierarchy_id_name_10
event_flex_float_1 First float flex field
event_flex_float_2,..., Subsequent float flex fields
event_flex_float_10
event_flex_int_1 First int flex field
event_flex_int_2,..., Subsequent int flex fields
event_flex_int_10
event_flex_string_1 First string flex field
event_flex_string_2,..., Subsequent string flex fields
event_flex_string_10
event_flex_date_1 First date flex field
Column Description
event_flex_date_2,..., Subsequent date flex fields
event_flex_date_10
A row is inserted in this table for each choice returned as part of a decision and each
key in the current session.
If the decision returns multiple choices, multiple rows will be inserted, with different
choices (and scores) for each row.
If the session is identified by multiple keys, multiple rows will be inserted, with a
different session key for each row.
Note: if the session has multiple keys, all the counts in the dashboards will be
multiplied by the number of keys.
Oracle RTD logs only the choices that are returned as part of the decision, not the ones
that are eligible but not returned.
More details about some of the SDDecisionLog fields:
is_random: The value is 'Y' in the following cases:
■ The decision was specified to select choices at random
■ Total score could not be calculated for any eligible choice in that decision
(therefore it is truly a random decision as all the choices were randomly selected)
control_group: The value is 'Y' if session().isControlGroup() is true. This attribute is
used to distinguish choices returned by a decision when control group is set to Y
versus N. If control_group is 'Y' then the choices returned by the decision is random. If
control_group is 'Y' then the is_random attribute is always 'Y'.
individual_score_n: This is the score for this performance goal, un-weighed,
un-normalized, that is, not multiplied by the weight and not divided by the
performance goal normalization factor. This is different from the Studio trace that
shows the weighted, normalized score. The score is null if it cannot be computed.
individual_weight_n: This is the weight of this performance goal, as a number
between 0 and 100.
total_score: This is the total score for this choice, computed as the sum of the
weighted, normalized individual score. If a score cannot be determined for a required
performance goal, the total score is null. If a score cannot be determined for a
non-required performance goal, the total weight is normalized so that the other
performance goals cover 100% of the weights.
score_rank: This is the rank of the choice after the selection function has been applied.
Note that a choice for which a total score cannot be computed is assigned a random
score and can therefore be ranked above another choice that has a real total score.
18.2.2 SDChoiceEventLog
Column Description
session_key Key of session (customer identification)
app_name_id ID of the application (Inline Service)
Column Description
version_id Version of the application.
This gets incremented every time the Inline Service is redeployed
choice_parent_id ID of the choice group to which this choice belongs
choice_parent_id_name Name of the choice group to which this choice belongs.
choice_id ID of the choice.
choice_id_name Name of the choice
channel_id Channel in which this event was made
choice_event_id ID of the choice event
happened Timestamp of the event based on application time (in seconds
since January 1st 1970 UTC)
day_of_month Day of the month of the event in format day_n or day_nn
decision_instance_id Unique id representing the decision this event belongs to
control_group Whether this event occurred in a control group decision or not ('Y'
or 'N')
segment_id ID of the decision segment this event occurred in
segment_name Name of the decision segment this event occurred in
hierarchy_id_1 ID of the first related choice or choice group in the hierarchy.
hierarchy_id_2,..., IDs of subsequent related choices or choice groups in the hierarchy
hierarchy_id_10
hierarchy_id_name_1 Name of the first related choice or choice group in the hierarchy.
hierarchy_id_name_2,..., Names of subsequent related choices or choice groups in the
hierarchy
hierarchy_id_name_10
event_flex_float_1 First float flex field
event_flex_float_2 ,..., Subsequent float flex fields
event_flex_float_10
event_flex_int_1 First int flex field
event_flex_int_2,..., Subsequent int flex fields
event_flex_int_10
event_flex_string_1 First string flex field
event_flex_string_2,..., Subsequent string flex fields
event_flex_string_10
event_flex_date_1 First date flex field
event_flex_date_2,..., Subsequent date flex fields
event_flex_date_10
A row is inserted in this table for each event and each key in the current session. If the
session is identified by multiple keys, multiple rows will be inserted, with a different
session key for each row.
18.2.3 Partitioning
SDDS can be configured to use partitioning or not. If SDDS uses partitioning, the
following partition tablespaces are created: SDLogging_TS0, SDLogging_TS1 and
SDLogging_TS2.
If partitioning is enabled, the tables SDChoiceEventLog and SDDecisionLog are
partitioned by the day_of_month column to have 10 (or 11) consecutive days in each
partition tablespace.
18.2.4.1 APIs
SDChoice (the parent class for all choices) has the following new methods:
■ public String getDecisionId();
■ public void setDecisionId(String decisionId);
■ public HashMap<String, Object> getChoiceEventLogValues();
■ public void setChoiceEventLogValue(String key, Object value);
■ public HashMap<String, Object> getDecisionLogValues();
■ public void setDecisionLogValue(String key, Object value);
In addition, the following methods are automatically generated for each choice class
for each choice group:
■ public void recordDecisionLog(String eventName, String channel, String
decisionId, HashMap<String, Object> decisionLogFields);
■ public void recordChoiceEventLog(String eventName, String channel, String
decisionId, HashMap<String, Object> choiceeventLogFields, String
decisionClassName);
In the APIs, decisionId is the name for the element described previously in this section
as decision_instance_id. It is set on the choice when the decision is evaluated so you
do not typically need to call the setter. But you call the getter to get the id so you can
remember it when you close the loop.
The decisionLogFields hashmap contains the key value pairs for most of the columns
logged as part of the decision.
The choiceEventLogFields hashmap contains the key value pairs for most of the
columns logged as part of the choice event.
Decision log logging occurs when recordDecisionLog is called, where:
■ eventName is the name of the base event (required).
■ channel is the name of the channel (optional).
■ decisionLogFields is the decision log values hashmap (required).
Choice event log logging occurs when recordChoiceEventLog is called, where:
■ eventName is the name of the base or positive event (required).
■ channel is the name of the channel (optional).
■ choiceEventLogFields is the decision log values hashmap (required).
■ decisionClassName is the class name of the decision that was used for the base
event of this choice, for instance "OfferDecision" or "RandomDecision"
The following table provides a detailed description of how each of the database
columns are set for the decision log.
Note: In the tables that follow, set values for the italicized names.
For example, for the API method for choice_parent_id, replace
newValue with the value of your choice_parent_id.
The following table provides a detailed description of how each of the database
columns are set for the choice event log.
If you did not log the decision for this decision_instance_id before
logging the choice event, the control_group value will be determined
by the value of session().isControlGroup(), unless you override it by
calling choice.setChoiceEventLogValue("control_group", newValue).
If you did not log the decision for this decision_instance_id before
logging the choice event, the segment_id and segment_name value
will be determined by evaluating the segments of the decision passed
as decisionClassName when you called the recordChoiceEventLog
method, unless you override it by calling both
choice.setChoiceEventLogValue("segment_id", newValue) and
choice.setChoiceEventLogValue("segment_name", newValue).
creative.setDecisionLogValue("decision_flex_int_1",
session().getCustomer().getCallsLast6Months());
Here is an example of choice event logging, given an event named event, a channel
named channel and a decision instance id named decision_instance_id, and setting a
flex field:
creative.setChoiceEventLogValue("event_flex_int_1",
session().getCustomer().getCallsLast6Months());
18.2.5.1 Description
The report schema is in a different schema than SDDS. It is a traditional star schema
with three tables as facts: SDDECISIONLOGREPORTMASTER,
SDDECISIONLOGREPORT and SDCHOICEEVENTLOGREPORT.
SDDECISIONLOGREPORTMASTER contains data that is different for each choice in a
decision, for instance the performance goal weights and scores.
SDDECISIONLOGREPORT contains data that is common for every choice returned as
part of a decision.
The dimensions correspond to the main columns available in the fact tables.
Additional dimensions can be created if, for instance, you want to slice and dice based
on the flex fields.
The SAMP_TIME_DAY_D, SAMP_TIME_MTH_D and SAMP_TIME_QTR_D tables
are standard BI tables for date representations (as in the SampleApp RPD).
18.2.5.3 Functions
The following function is created as part of the schema:
■ NormalizedEventName: The RPD contains measures based on a marketing
scenario where choices go through 3 stages: presented, interested and converted.
This function allows for mapping Inline Service event names to these 3
pre-defined events. By default, "Presented" and "Delivered" are allowed as the
base presented event, "Interested" and "Clicked" are allowed as the positive
interested event and "Converted" and "Purchased" are allowed as the positive
converted event. You can modify this function if your inline service uses different
event names.
18.2.6.1 RPD
The RPD contains two entries in the physical layer, one containing the model snapshot
physical schema and one containing the decision analytics report schema.
Two variables are used to define the connection to the report schema: RTD_REPORT_
DSN and RTD_REPORT_USERNAME.
Response Lift
Response lift is defined by the following function:
IFNULL((("RTD DM Report Schema"."Choice Log"."Response Rate for Test") - ("RTD
DM Report Schema"."Choice Log"."Response Rate for Control")) *100.00 /"RTD DM
Report Schema"."Choice Log"."Response Rate for Control", 0)
Conversion Lift
Conversion lift is defined by the following function:
IFNULL((("RTD DM Report Schema"."Choice Log"."Conversion Rate for Test") - ("RTD
DM Report Schema"."Choice Log"."Conversion Rate for Control")) *100.00 /"RTD DM
Report Schema"."Choice Log"."Conversion Rate for Control", 0)
18.3 Installation
To enable transactional logging and decision analytics, you must perform a number of
additional operations after you have installed Oracle RTD.
This section contains the following topics:
■ Section 18.3.1, "Post Oracle RTD-Installation Steps"
■ Section 18.3.2, "OBIEE Steps"
For example:
InitReportDB C:\OracleBI\RTD localhost 1521 orcl rtd_rep rtd overture
Note: The procedures described in this section require that you edit
these files:
■ DecisionAnalytics.rpd, which is located in the Oracle RTD
Platform zip file, in the folder OracleBI\RTD\Analytics.
■ Decision Analytics.catalog, which is located in the Oracle RTD
Platform zip file, in the folder OracleBI\RTD\Analytics.
■ Decision Analytics - Base Marketing.catalog, which available in
the Oracle RTD Applications zip file, in the folder RTD_Apps_
3xxx\software\Oracle Real-Time Decisions Base
Application\Analytics.
After the change is effected, a new link is available indicating Restart to apply recent
changes. Click the link, and in the overview tab restart all the services by clicking the
restart button.
18.4 Customization
Oracle RTD logs data into both the SDDecisionLog and SDChoiceEventLog tables.
Currently, the choice performance dashboard is based on the data from
SDChoiceEventLog.
This data can subsequently be used to slice and dice from within OBIEE.
The following example shows how to add a flex field.
Assume you have logged the Marital Status to column EVENT_FLEX_STRING_1 in
SDChoiceEventLog.
You can add this flex field in the dashboard (in this case, Choice Performance
Dashboard) by performing the following steps:
1. Click the Edit button of the Choice Performance Dashboard.
2. In Section 1 which defines the dashboard prompts, click the Properties button (XYZ
in the following image) on the top right hand corner and select Edit.
9. Go to criteria tab of the view and under filters pane, click the button, select more
columns and select the column Choice Log -> Event Flex String 1.
10. In the New Filter dialog, select is prompted as the operator and click OK.
11. Repeat the process to add the flex string to the other two views in section 2.
Repeat the process to add the flex string in Section 3 and 4 as well.
Now, the dashboard responds to the column prompt Marital Status in all sections and
views defined in within it.
Procedures
This appendix shows examples of how to create data sources from Oracle, SQL Server,
and DB2, and then how to create entities and session attributes from these data
sources.
The examples are based on the CrossSellCustomers table. For details of setting up this
table, see the topic "Populating the CrossSell Example Data" in Oracle Real-Time
Decisions Installation and Administration Guide.
This appendix contains the following topics:
■ Section A.1, "Creating a Data Source from Single Result Stored Procedures"
■ Section A.2, "Creating a Data Source from Stored Procedures with One Result Set"
■ Section A.3, "Creating a Data Source from Stored Procedures with Two Result Sets"
(C) DB2
CREATE PROCEDURE DB2ADMIN.GET_SINGLE_CUSTOMERINFO
(
IN P_ID INTEGER,
OUT P_AGE INTEGER,
OUT P_OCCUPATION VARCHAR(20),
OUT P_LASTSTATEMENTBALANCE REAL
)
LANGUAGE SQL
P1: BEGIN
DECLARE CURSOR_ CURSOR WITH RETURN FOR
SELECT AGE, OCCUPATION, LASTSTATEMENTBALANCE
FROM DB2ADMIN.CROSSSELLCUSTOMERS AS CROSSSELLCUSTOMERS
WHERE CROSSSELLCUSTOMERS.ID = P_ID;
OPEN CURSOR_;
FETCH CURSOR_ INTO P_AGE, P_OCCUPATION, P_LASTSTATEMENTBALANCE;
CLOSE CURSOR_;
END P1
2. Create a JDBC data source for the stored procedure in the application server that
you are using.
For details of how to create data sources in the application servers, see
"Configuring Data Access to Oracle Real-Time Decisions" in Oracle Real-Time
Decisions Installation and Administration Guide.
3. In Decision Studio, create the stored procedure data source DS_Single_Customer,
by importing the Get_Single_CustomerInfo stored procedure from your
database.
For the SQL Server stored procedure, change the direction of the parameters pAge,
pOccupation, and pLastStatementBalance from Input/Output to Output.
4. In Decision Studio, create the entity Ent_Single_Customer, by importing the data
source DS_Single_Customer.
5. Add the attribute Id, of data type Integer.
6. In the Mapping tab, in the Data Source Input Values area, set the Input Value for
the Input Column pId to Id.
7. Open the Session entity, and add a new attribute cust_sp, setting the data type to
Ent_Single_Customer.
A.2 Creating a Data Source from Stored Procedures with One Result Set
To create a data source from stored procedures with one result set:
1. Create the stored procedure Get_OneSet_CustomerInfo in your Oracle, SQL
Server, or DB2 database, using the appropriate commands:
(A) Oracle
(C) DB2
CREATE PROCEDURE DB2ADMIN.GET_ONESET_CUSTOMERINFO
(
IN P_CREDITLINEAMOUNT INTEGER
)
DYNAMIC RESULT SETS 1
LANGUAGE SQL
P1: BEGIN
DECLARE CURSOR_ CURSOR WITH RETURN FOR
SELECT * FROM DB2ADMIN.CROSSSELLCUSTOMERS AS CROSSSELLCUSTOMERS
WHERE CROSSSELLCUSTOMERS.CREDITLINEAMOUNT >= P_CREDITLINEAMOUNT;
OPEN CURSOR_;
END P1
2. Create a JDBC data source for the stored procedure in the application server that
you are using.
For details of how to create data sources in the application servers, see
"Configuring Data Access to Oracle Real-Time Decisions" in Oracle Real-Time
Decisions Installation and Administration Guide.
3. In Decision Studio, create the stored procedure data source DS_OneSet_
Customer, by importing the Get_OneSet_CustomerInfo stored procedure from
your database.
4. In the Results Set Details section, add a result set.
5. Check Allow multiple rows.
6. For the SQL Server stored procedure, add the following column names exactly as
shown with the given data types:
■ Age [Integer]
■ Occupation [String]
■ LastStatementBalance [Double]
For the Oracle and DB2 stored procedures, add the following column names
exactly as shown with the given data types:
■ AGE [Integer]
■ OCCUPATION [String]
■ LASTSTATEMENTBALANCE [Double]
7. In Decision Studio, create the entity Ent_OneSet_Customer, by importing the data
source DS_OneSet_Customer.
8. Add the attribute CreditLineAmount, of data type Integer, and set its default
value to 50000.
This will limit results to around 30 rows.
9. Check the Array column for the attributes Age, Occupation, and
LastStatementBalance.
10. In the Mapping tab, in the Data Source Input Values area, set the Input Value for
the Input Column pCreditLineAmount to CreditLineAmount.
11. Open the Session entity, and add a new attribute cust_oneset_sp, setting the data
type to Ent_OneSet_Customer.
A.3 Creating a Data Source from Stored Procedures with Two Result Sets
To create a data source from stored procedures with two result sets:
1. Create the stored procedure Get_TwoSets_CustomerInfo in your Oracle, SQL
Server, or DB2 database, using the appropriate commands:
(A) Oracle
CREATE PROCEDURE GET_TWOSETS_CUSTOMERINFO
(
P_CREDITLINEAMOUNT IN INTEGER,
CURSOR1_ IN OUT TYPES.REF_CURSOR,
CURSOR2_ IN OUT TYPES.REF_CURSOR
)
AS
BEGIN
OPEN CURSOR1_ FOR
SELECT * FROM CROSSSELLCUSTOMERS
WHERE CREDITLINEAMOUNT >= P_CREDITLINEAMOUNT;
(C) DB2
CREATE PROCEDURE DB2ADMIN.GET_TWOSETS_CUSTOMERINFO
(
IN P_CREDITLINEAMOUNT INTEGER
)
DYNAMIC RESULT SETS 2
LANGUAGE SQL
P1: BEGIN
DECLARE CURSOR1_ CURSOR WITH RETURN FOR
SELECT * FROM DB2ADMIN.CROSSSELLCUSTOMERS AS CROSSSELLCUSTOMERS
WHERE CROSSSELLCUSTOMERS.CREDITLINEAMOUNT >= P_CREDITLINEAMOUNT;
OPEN CURSOR1_;
OPEN CURSOR2_;
END P1
2. Create a JDBC data source for the stored procedure in the application server that
you are using.
For details of how to create data sources in the application servers, see
"Configuring Data Access to Oracle Real-Time Decisions" in Oracle Real-Time
Decisions Installation and Administration Guide.
3. In Decision Studio, create the stored procedure data source DS_TwoSets_
Customer, by importing the Get_TwoSets_CustomerInfo stored procedure from
your database.
4. In the Results Set Details section, add a result set.
5. Check Allow multiple rows.
6. For the SQL Server stored procedure, add the following column names exactly as
shown with the given data types:
■ Age [Integer]
■ Occupation [String]
■ LastStatementBalance [Double]
For the Oracle and DB2 stored procedures, add the following column names
exactly as shown with the given data types:
■ AGE [Integer]
■ OCCUPATION [String]
■ LASTSTATEMENTBALANCE [Double]
7. Repeat steps 4 through 6 for the second result set.
8. In Decision Studio, create the entity Ent_TwoSets_Customer, by importing the
data source DS_TwoSets_Customer.
9. Add the attribute CreditLineAmount, of data type Integer, and set its default
value to 50000.
This will limit results to around 30 rows.
10. Check the Array column for the attributes Age, Occupation, and
LastStatementBalance.
11. In the Mapping tab, in the Data Source Input Values area, set the Input Value for
the Input Column pCreditLineAmount to CreditLineAmount.
12. Open the Session entity, and add a new attribute cust_twosets_sp, setting the data
type to Ent_TwoSets_Customer.
An Oracle RTD Inline Service using ORE would contain a Java function that uses JDBC
to order a script execution by ORE embedded R engine. Deploying updated versions
of R scripts could be facilitated by a special "Update Script" informant. Statistical
models and other R objects could be built in R Development Environment and
deployed to an Oracle Database using ore.save() API. They can then subsequently be
loaded and used by R scripts that are invoked from Oracle RTD but executed within
Oracle Database.
B.1.2.1 Obtaining R
The recommended way to obtain R 2.15.1 is by downloading Oracle R Distribution.
B.1.3.1 Steps for Making Use of R Scripting in Oracle RTD Inline Services
CrossSellR contains modifications to CrossSell that illustrate the following steps you
will need to take to make use of R in your Inline Service:
■ Create a script launching function, providing the input to, and making use of
output of, an R script (in our example, this function is called SimpleRRegression).
This function calls a SQL statement that executes an embedded R script deployed
using UpdateScript informant, returning the result of the calculation performed in
R.
■ Create a new Customer entity attribute: RiskByR mapped to SimpleRRegression
function. This attribute is inherited by the Session entity (since it includes
Customer entity).
■ Modify the filtering rule "Segment to Retain" to check the value of RiskByR session
entity attribute.
■ Create a new function, DeployR, performing deployment of an updated R script to
the Oracle RTD database.
■ Create a new informant: UpdateScript, enabling deployment of a new R script to
the Oracle RTD database.
rqEvalSB.append("select *")
try {
DatabaseProviderInterface dp = newDatabaseProvider("SDDS");
connection = dp.getConnection();
java.sql.PreparedStatement statement =
connection.prepareStatement(rqEvalSB.toString());
statement.setInt(1, session().getCustomer().getCallsAbandoned());
statement.setInt(2, session().getCustomer().getComplaintsPerYear());
java.sql.ResultSet rs = statement.executeQuery();
if (!rs.next()) {
logInfo("Error: empty result set");
return 0.;
}
riskVal = rs.getDouble(1);
} catch(java.sql.SQLException e) {
e.printStackTrace();
logError("exception in GENSimpleRRegression " + e.getLocalizedMessage());
} finally {
try {
if (connection != null)
connection.close();
} catch( java.sql.SQLException cannotEvenClose) {
}
}
return riskVal;
DatabaseProviderInterface dp = newDatabaseProvider("SDDS");
summary(linChurnMod)
# trimming the model
linChurnMod$residuals <- NULL
linChurnMod$effects <- NULL
linChurnMod$fitted.values <- NULL
linChurnMod$qr$qr <- NULL
ore.save(linChurnMod, name="ds_1", description="linear churn model")
After executing the above script, the model is saved to the Oracle database.
Note: In R language, carriage return and semi-colon (";") can both be used to separate
statements.
Note: The informant we created facilitates updating the scripts, hiding the somewhat
obscure SQL statements that have to be executed to achieve that. It is, of course,
possible to execute the same SQL manually from SQLPlus or your favorite SQL query
editor.
Note: CrossSellR contains an Advisor, OfferRequest, that returns a likelihood. When
this Inline Service is deployed, the Customer entity is populated. That in turn results
in an attempt to invoke the R script, execLm. If you deploy your Inline Service before
the script is created in the database, you will see an error in your server log that will
look like the following:
ERROR [CrossSellRORE] exception in GENSimpleRRegression ORA-20000: RQuery error
ORA-06512: at "RQSYS.RQTABLEEVALIMPL", line 84
ORA-06512: at "RQSYS.RQTABLEEVALIMPL", line 80
After you run the UpdateScript informant, the script will be created, and the error
should no longer appear on subsequent deployments of the Inline Service.