Copyright (c) 2003, 2004 Oracle.  All rights reserved.

JAVA SAMPLE PROGRAMS FOR ORACLE 10g DATA MINING

This directory, "$ORACLE_HOME/dm/demo/sample/java" on UNIX or
"%ORACLE_HOME%\dm\demo\sample\java" on Windows, contains sample programs
for Oracle Data Mining (ODM) illustrating the Java interface.


Data for Sample Programs
------------------------
The data used by the Java sample programs is in the SH schema. To grant the
necessary access privileges to the data mining user, your database administrator
needs to execute the following script:

     For UNIX, use the script 
            "$ORACLE_HOME/dm/admin/dmshgrants.sql" 
     For Windows, use the script  
            "%ORACLE_HOME%\dm\admin\dmshgrants.sql"

Then, you must run the following script as a data mining user to create the
necessary tables and views:

     For UNIX, use the script
            "$ORACLE_HOME/dm/admin/dmsh.sql"
     For Windows, use the script
            "%ORACLE_HOME%\dm\admin\dmsh.sql"

For more information, see the "Oracle Data Mining Administrator's Guide". Note
that there are additional requirements for programs that do text mining.


Overview of Sample Programs
---------------------------

Most of the programs build, test, and apply a model using a specific
algorithm. For example, "SVMCDemo.java" builds, tests, and applies a
classification model using the Support Vector Machine algorithm. Other
sample programs illustrate special tasks, such as performing data
preparation ("DataPrepDemo.java"), using a cost matrix ("CostDemo.java"),
importing and exporting a PMML model ("PMMLDemo.java), and using 
prior probabilities ("PriorsDemo.java").

None of the sample programs use property files.

To execute any of the sample programs, you must edit the sample
program to specify the URL of the database where ODM is installed,
a user name and password for the database, and the name of a
valid database schema.

To find where to specify the URL, search the sample program code for 
"put DB URL here". The database URL is a JDBC URL in the following form:

  jdbc:oracle:thin:@<host_name>:<port>:<SID>

where <host_name>, <port>, and <SID> are specific to your database.  
 
To find where to specify the schema name, search the sample program
code for "schema name" and replace it with the name of the data mining user
schema in double quotation marks.

To find where to specify the user name and password search the sample program
code for "user name" and "password" respectively. Replace with the required
information in quotation marks.

After you finish editing the code, save your changes.

Compile and execute the sample program just as you would compile and
execute any Java program.


Prerequisites
-------------

Before you compile and execute any programs, do the following:

1. Check that ORACLE_HOME has been set correctly.

2. Check that the DMSYS account is unlocked.

3. Check that TCP/IP listener is running on the server.

4. Check that the version of java you are using is 1.4.2_01. You can execute
   the following in your shell on UNIX or in a Command Window on Windows to
   check the version of java:
     
     java -version

5. Ensure that your CLASSPATH includes the following Oracle 10g
   Java Archive files:

   For UNIX:

      $ORACLE_HOME/dm/lib/odmapi.jar
      $ORACLE_HOME/jdbc/lib/ojdbc14.jar
      $ORACLE_HOME/jlib/orai18n.jar
      $ORACLE_HOME/lib/xmlparserv2.jar

   For Windows:

      %ORACLE_HOME%/dm/lib/odmapi.jar
      %ORACLE_HOME%/jdbc/lib/ojdbc14.jar 
      %ORACLE_HOME%/jlib/orai18n.jar
      %ORACLE_HOME%/lib/xmlparserv2.jar

6. To run NMFDemo.java and SVMCDemo.java Oracle Text must be available.

Summary of Sample Programs
--------------------------

The ODM Java sample programs are as follows:

ABNDemo.java -- Classification using Adaptive Bayes
Network

AIDemo.java -- Determine important attributes
using attribute importance; build a Naive Bayes
model using the important attributes

ARDemo.java -- Build Association model and
extract association rules

CostDemo.java -- Use cost matrix; compare results
with and without cost matrix

DataPrepDemo.java -- Use of several discretization
(binning) schemes: automated, external discretization,
and user-supplied bin boundaries

kMeansDemo.java -- Clustering using the k-Means algorithm

NBDemo.java -- Classification using Naive Bayes

NMFDemo.java -- Feature extraction using and text mining
Non-Negative Matrix Factorization

OClusterDemo.java -- Clustering using Orthogonal 
Partitioning Clustering

PMMLDemo.java -- Import and Export a PMML model

PriorsDemo.java Use priors; compare results with
and without priors

SVMCDemo.java -- Classification and text mining using
Support Vector Machine

SVMRDemo.java -- Regression using Support Vector Machine


