Skip Headers

Oracle9i Data Mining Concepts
Release 2 (9.2)

Part Number A95961-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

A
ODM Sample Programs

The sample programs for ODM consist of Java classes and property files, along with the data required to run the programs. There are also scripts to compile and execute the sample programs. The sample programs and how to compile and execute them are briefly described in this appendix. The data used by the sample programs is installed when you install ODM.

After ODM is installed on your system, the sample programs, property files, and scripts are in the directory $ORACLE_HOME/dm/demo/sample; the data used by the sample programs is in the directory $ORACLE_HOME/dm/demo/data. The data required by the sample programs is also installed in the ODM_MTR schema.

A.1 ODM Java API

This appendix does not include a detailed description of the ODM API classes and methods. For detailed information about the ODM API, see the ODM Javadoc in the directory $ORACLE_HOME/dm/doc on any system where ODM is installed.

A.2 List of ODM Sample Programs

ODM sample programs are provided to illustrate the features of ODM.

The sample programs, except for the "short" sample programs, use property files to specify values that control program execution. Each program has at least one property file; most sample programs have an (input) data set. There is also one special property file, Sample_Global.property, that is used to specify the characteristics of the environment in which the programs run. The rest of this section lists the ODM sample programs, arranged according to the ODM features that they illustrate.

A.2.1 Basic ODM Usage

The following sample programs are the programs that are discussed in detail in Chapter 3:

  1. Sample_NaiveBayesBuild_short.java
    • Property file: This program does not have a property file.
    • Data: census_2d_build_unbinned
  2. Sample_NaiveBayesApply_short.java
    • Property file: This program does not have a property file.
    • Data: census_2d_apply_unbinned

Neither of these sample programs uses either a property file or Sample_Global.property.

A.2.2 Decision Tree Models

The following sample programs illustrate building a Decision Tree (Adaptive Bayes Network) Model, calculating lift for the model and testing it, and applying the model:

  1. Sample_AdaptiveBayesNetworkBuild.java
    • Property file: Sample_AdaptiveBayesNetworkBuild.property
    • Data: census_2d_build_binned
  2. Sample_AdaptiveBayesNetworkLiftAndTest.java
    • Property file:
      Sample_AdaptiveBayesNetworkLiftAndTest.property
    • Data: census_2d_test_binned
  3. Sample_AdaptiveBayesNetworkApply.java
    • Property file: Sample_AdaptiveBayesNetworkApply.property
    • Data: census_2d_apply_binned

A.2.3 Naive Bayes Models

The following programs illustrate building a Naive Bayes Model, calculating lift for the model and testing it, applying the model, and cross validating the model:

  1. Sample_NaiveBayesBuild.java
    • Property file: Sample_NaiveBayesBuild.property
    • Data: census_2d_build_unbinned
  2. Sample_NaiveBayesLiftAndTest.java
    • Property file: Sample_NaiveLiftAndTest.property
    • Data: census_2d_test_unbinned
  3. Sample_NaiveBayesApply.java
    • Property file: Sample_NaiveBayesApply.property
    • Data: census_2d_apply_unbinned
  4. Sample_NaiveBayesCrossValidate.java
    • Property file: Sample_NaiveBayesCrossValidate.property
    • Data: census_2d_build_unbinned

A.2.4 Model Seeker Usage

The following sample program illustrates how to use Model Seeker to identify a "best" model:

  1. Sample_ModelSeeker.java
    • Property file: Sample_ModelSeeker.property
    • Data: census_2d_build_unbinned and census_2d_test_unbinned

A.2.5 Clustering Models

The following sample programs illustrate building a clustering model and applying it:

  1. Sample_ClusteringBuild.java
    • Property file: Sample_ClusteringBuild.property
    • Data: eight_clouds_build_unbinned
  2. Sample_ClusteringApply.java
    • Property file: Sample_ClusteringApply.property
    • Data: eight_clouds_apply_unbinned

A.2.6 Association Rules Models

The following sample program illustrates building an Association Rules model:

Sample_AssociationRules.java

The property file depends on the format of the data:

A.2.7 PMML Export and Import

The following sample programs illustrate importing and exporting PMML Models:

  1. Sample_PMML_Export.java
    • Property file: Sample_PMML_Export.property
    • Data: no input data is required
  2. Sample_PMML_Import.java
    • Property file: Sample_PMML_Import.property
    • Data: no input data is required

A.2.8 Attribute Importance Model Build and Use

The following sample programs illustrate how to build and attributes importance model and use the results to build another model:

  1. Sample_AttributeImportanceBuild.java
    • Property file: Sample_AttributeImportanceBuild.property
    • Data: magazine_2d_build_binned
  2. Sample_AttributeImportanceUsage.java
    • Property file: Sample_AttributeImportanceUsage.property
    • Data: magazine_2d_build_binned and magazine_2d_test_binned

A.2.9 Discretization

The following sample programs show to discretize (bin) data by creating a bin boundaries table and how to use the bin boundaries table:

  1. Sample_Discretization_CreateBinBoundaryTables.java
    • Property file:
      Sample_Discretization_CreateBinBoundaryTables.property
    • Data: census_2d_build_unbinned
  2. Sample_Discretization_UseBinBoundaryTables.java
    • Property file:
      Sample_Discretization_UseBinBoundaryTables.property
    • Data: census_2d_test_unbinned and census_2d_apply_unbinned

A.3 Compiling and Executing ODM Sample Programs

This section provides a brief description of how to compile and execute the ODM sample programs. There are two cases:

A.3.1 Compiling and Executing the Short Sample Programs

Follow these steps to compile and execute the programs Sample_NaiveBayesBuild_short.java and Sample_NaiveBayesApply_short.java:

  1. Install Oracle9i release 2 Enterprise Edition and the ODM 9.2.0 option. Ensure that you have a valid ORACLE_HOME environment variable setup.

    ODM depends on the following Oracle9i Java Archive files; ensure that they are in your CLASSPATH:

    $ORACLE_HOME/jdbc/lib/classes12.jar
    $ORACLE_HOME/lib/xmlparserv2.jar
    $ORACLE_HOME/rdbms/jlib/jmscommon.jar
    $ORACLE_HOME/rdbms/jlib/aqapi.jar
    $ORACLE_HOME/rdbms/jlib/xsu12.jar
    $ORACLE_HOME/dm/lib/odmapi.jar
    
    

    You may also need to include

    $ORACLE_HOME/jdbc/lib/nls_charset12.zip 
    
    

    in your CLASSPATH. See Section 2.1 for details.

    
    
  2. The datasets used by the sample programs are installed during ODM installation. The default schema for these datasets is odm_mtr. If the default name is not correct for your installation, replace the schema name in the program.
  3. Ensure you have installed JDK 1.3 or above and have a valid JAVA_HOME environment variable setup.
  4. Before you execute either of these programs, make sure that you have specified the data mining server and the location access data appropriately for your installation.

    To specify the data mining server, substitute appropriate values for the italicized items in the following line:

    dms = new DataMiningServer(DB_URL, user_name, password);
    
    

    To specify location access data, substitute appropriate values for the italicized items in the following line:

    LocationAccessData("CENSUS_2D_BUILD_UNBINNED", schema_name);
    
    

    For Sample_NaiveBayesApply_short.java, you must also specify a location for the output table; substitute appropriate values for the italicized item in the following line:

    LocationAccessData ladOutput = 
        new LocationAccessData("CENSUS_NB_APPLY_RESULT", output_schema_name)
    
    
  5. The ODM sample programs include scripts that compile the sample programs. Compile an ODM sample program by running the appropriate script.
    • On UNIX platforms, use
       /usr/bin/sh compileSampleCode.sh program-name
      
      
      
      
    • On Windows platforms, use
      compileSampleCode.bat program-name
      
      
  6. Before you run a sample program, verify that the ODM monitor is running. If you need to start the monitor, log in to the ODM schema and type
    exec odm_start_monitor
    
    
  7. Execute the sample program as you would execute any Java program.

    Note:

    Since these short programs do not use Sample_Global.property, you cannot execute them using the executeSampleCode scripts.


  8. You must perform cleanup before you execute either of these programs a second time.

A.3.2 Compiling and Executing All Other ODM Sample Programs

Follow these steps to compile all of the sample programs that use Sample_Global.property:

  1. Install Oracle9i release 2 Enterprise Edition and the ODM 9.2.0 option. Ensure that you have a valid ORACLE_HOME environment variable setup.

    ODM depends on the following Oracle9i Java Archive files; ensure that they are in your CLASSPATH:

    $ORACLE_HOME/jdbc/lib/classes12.jar
    $ORACLE_HOME/lib/xmlparserv2.jar
    $ORACLE_HOME/rdbms/jlib/jmscommon.jar
    $ORACLE_HOME/rdbms/jlib/aqapi.jar
    $ORACLE_HOME/rdbms/jlib/xsu12.jar
    $ORACLE_HOME/dm/lib/odmapi.jar
    
    

    You may also need to include

    $ORACLE_HOME/jdbc/lib/nls_charset12.zip 
    
    

    in your CLASSPATH. See Section 2.1 for details.

    
    
  2. Modify the Sample_Global.property file to replace generic placeholders with the details for your database installation. Mining Server details must point to the schema where the Mining Server is installed on your system.

    You must replace the following tags: MyHost, MyPort, MySid (the SERVICE_NAME for your database), MyName (the default is ODM), and MyPW (the default is ODM).

    For example:

    miningServer.url=jdbc:oracle:thin:@odmserver.company.com:orcl:1521
    miningServer.userName=odm
    miningServer.password=odm
    inputDataSchemaName=odm_mtr
    outputSchemaName=odm_mtr
  3. The datasets used by the sample programs are installed during ODM installation. The default schema for these datasets is odm_mtr. If the default name is not correct for your installation, replace the schema name in Sample_Global.property.
  4. Ensure you have installed JDK 1.3 or above and have a valid JAVA_HOME environment variable setup.
  5. Edit the code settings in the property file for the program that you wish to compile and execute. For example, if you plan to compile and execute Sample_ModelSeeker.java, you should edit Sample_ModelSeeker.property.
  6. The ODM sample programs include scripts that compile the sample programs. Compile an ODM sample program by running the appropriate script.
    • On UNIX platforms, use
       /usr/bin/sh compileSampleCode.sh program-name
      
      
      
      

      For example, to compile Sample_ModelSeeker.java, type

       /usr/bin/sh compileSampleCode.sh Sample_ModelSeeker.java
      
      
      
    • On Windows platforms, use
      compileSampleCode.bat program-name
      
      
      
      

      For example, to compile Sample_ModelSeeker.java, type

      compileSampleCode.bat Sample_ModelSeeker.java
      
  1. Before you run a sample program, verify that the ODM monitor is running. If you need to start the monitor, log in to the ODM schema and type
    exec odm_start_monitor
    
  1. The ODM sample programs include scripts that execute the sample programs. Execute an ODM sample program by running the appropriate script.
    • On UNIX platforms, use
      /usr/bin/sh executeSampleCode.sh classname [property_ file]
      
      
      

      For example, to execute Sample_ModelSeeker.java with the property file myFile.property, type

      /usr/bin/sh compileSampleCode.sh Sample_ModelSeeker myFile.property
      
      
      
  2. On Windows platforms, use
    executeSampleCode.bat classname [property_ file ]
    
    
    

    For example, to execute Sample_ModelSeeker.java with the property file myFile.property, type

    executeSampleCode.bat Sample_ModelSeeker myFile.property
    

Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback