oracle.dmt.odm.model
Class SupervisedModel

java.lang.Object
  |
  +--oracle.dmt.odm.MiningObject
        |
        +--oracle.dmt.odm.LocatableObject
              |
              +--oracle.dmt.odm.model.MiningModel
                    |
                    +--oracle.dmt.odm.model.SupervisedModel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AdaptiveBayesNetworkModel, NaiveBayesModel

public abstract class SupervisedModel
extends MiningModel

The abstract class SupervisedModel serves as a common superclass for supervised learning models. ODM supports supervised algorithms such as Naive Bayes and Adaptive Bayes Network. The class SupervisedModel includes common functionality to apply a model to data (score), to test a model, and to compute lift.

See Also:
NaiveBayesModel, AdaptiveBayesNetworkModel, Serialized Form

Method Summary
TypeMethod
static void apply(Connection dmsConn, LocationAccessData applyData, PhysicalDataSpecification pds, java.lang.String modelName, MiningApplyOutput applyOutput, LocationAccessData outputLoc, java.lang.String applyResultName)
          Deprecated. As of ODM 9.2.0. Use MiningApplyTask to perform apply mining operation on a database table.
static RecordInstance apply(Connection dmsConn, RecordInstance record, java.lang.String modelName)
          Performs the apply mining operation on a single record represented by an instance of RecordInstance.
static RecordInstance apply(Connection dmsConn, RecordInstance record, java.lang.String modelName, MiningApplyOutput applyOutput)
          Performs the apply mining operation on a single record represented by an instance of RecordInstance.
static void computeLift(Connection dmsConn, int numQuantiles, LocationAccessData inputData, PhysicalDataSpecification pds, int targetVal, java.lang.String modelName, java.lang.String liftResultName)
          Deprecated. As of ODM 9.2.0. Use MiningLiftTask to perform the compute lift mining operation.
 java.lang.String getConditionsTableName()
          Returns the name of the conditions table for this model.
 java.lang.String getCostMatrixTableName()
          Returns the name of the cost matrix table for this model.
 int getNumberOfConditions()
          Returns the number of conditions for this model.
 int getNumberOfPriors()
          Returns the number of priors for this model.
 java.lang.String getPriorsTableName()
          Returns the name of the priors table for this model.
 int getTargetValueCount()
          Deprecated. Use method getNumberOfPriors
static SupervisedModel restore(Connection dmsConn, java.lang.String modelName)
          Returns an instance of SupervisedModel with the specified name persisted in the data mining server given a connection to the data mining server and the model name.
static SupervisedModel restore(java.sql.Connection dbConn, java.lang.String modelName)
          Returns an instance of SupervisedModel with the specified name persisted in the data mining server given a database connection to the data mining server and the model name.
static void test(Connection dmsConn, LocationAccessData inputData, PhysicalDataSpecification pds, java.lang.String modelName, java.lang.String outputResultName)
          Deprecated. As of ODM 9.2.0. Use MiningTestTask to perform the test mining operation.
 
Methods inherited from class oracle.dmt.odm.model.MiningModel
build, getBinCategoricalTableName, getBinNumericTableName, getMiningAlgorithm, getMiningFunction, getMiningFunctionSettings, getModelName, listContents, listContents, listContents, listContents, remove, setModelNameForMig
 
Methods inherited from class oracle.dmt.odm.LocatableObject
deserialize, serialize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTargetValueCount

public int getTargetValueCount()
Deprecated. Use method getNumberOfPriors

Returns the number of unique target values.
Returns:
int - The number of unique target values

getConditionsTableName

public java.lang.String getConditionsTableName()
Returns the name of the conditions table for this model.
Returns:
String - The name of the conditions table

getPriorsTableName

public java.lang.String getPriorsTableName()
Returns the name of the priors table for this model.
Returns:
String - The name of the priors table

getCostMatrixTableName

public java.lang.String getCostMatrixTableName()
Returns the name of the cost matrix table for this model.
Returns:
String - The name of the cost matrix table

getNumberOfConditions

public int getNumberOfConditions()
Returns the number of conditions for this model.
Returns:
int - The number of conditions

getNumberOfPriors

public int getNumberOfPriors()
Returns the number of priors for this model.
Returns:
int - The number of priors

apply

public static void apply(Connection dmsConn,
                         LocationAccessData applyData,
                         PhysicalDataSpecification pds,
                         java.lang.String modelName,
                         MiningApplyOutput applyOutput,
                         LocationAccessData outputLoc,
                         java.lang.String applyResultName)
                  throws InvalidArgumentException,
                         java.sql.SQLException,
                         MiningOperationException,
                         ODMException
Deprecated. As of ODM 9.2.0. Use MiningApplyTask to perform apply mining operation on a database table.

Performs the apply mining operation on multiple records specified in a database table. Using the applyData represented by the pds and the named modelName, this method generates an output table specified by outputLoc according to the appyOutput specification; writes the result with the name applyResultName in the data mining server represented by dmsConn.

Refer to oracle.dmt.odm.result package for more information on MiningApplyOutput and MiningApplyResult.

Parameters:
dmsConn - A connection to the data mining server
applyData - A database table to be used as input for apply
pds - A specification on the format of the input data
modelName - The name of the model to be used for apply
applyOutput - A specification on the format of apply output
outputLoc - The location an name of the output table
applyResultName - The name of the result to be persisted in the data mining server
Throws:
InvalidArgumentException -
  • dmsConn is null,
  • applyData is null,
  • pds is null,
  • modelName is null,
  • applyOutput is null,
  • outputLoc is null, or
  • applyResultName is null
ODMException -
  • modelName is empty or exceeds 64 characters in length, or
  • applyResultName is empty or exceeds 64 characters in length
java.sql.SQLException - when an error occurs during the execution of apply operation
MiningOperationException -  
See Also:
MiningApplyTask, MiningApplyResult, MiningApplyOutput

apply

public static RecordInstance apply(Connection dmsConn,
                                   RecordInstance record,
                                   java.lang.String modelName)
                            throws InvalidArgumentException,
                                   java.sql.SQLException,
                                   MiningOperationException,
                                   ODMException
Performs the apply mining operation on a single record represented by an instance of RecordInstance. The result of this method is also returned in an instance of RecordInstance, which contains the top prediction and its probability (i.e., its probability is the highest among all predictions). The returned RecordInstance contains the default attribute instance values: score and probability. Note that no mining result is persisted for the result of this operation.
Parameters:
dmSConn - The connection to the data mining server
record - An instance of RecordInstance for input to apply
modelName - The model name to be used for apply
Returns:
RecordInstance - An instance of RecordInstance that contains two attribute instances: score and probability of the top prediction.
Throws:
InvalidArgumentException -
  • dmsConn is null,
  • record is null, or
  • modelName is null.
ODMException - when modelName is empty or exceeds 64 characters in length
java.sql.SQLException - when an error occurs during the execution of apply operation
MiningOperationException -  
See Also:
RecordInstance, AttributeInstance

apply

public static RecordInstance apply(Connection dmsConn,
                                   RecordInstance record,
                                   java.lang.String modelName,
                                   MiningApplyOutput applyOutput)
                            throws InvalidArgumentException,
                                   java.sql.SQLException,
                                   MiningOperationException,
                                   ODMException
Performs the apply mining operation on a single record represented by an instance of RecordInstance. The result of this method is also returned in an instance of RecordInstance, which contains attribute instances based on the specification in applyOutput. Note that no mining result is persisted for the result of this operation.
Parameters:
dmSConn - The connection to the data mining server
record - An instance of RecordInstance for input to apply
modelName - The model name to be used for apply
applyOutput - A specification on the format of apply output
Returns:
RecordInstance - An instance of RecordInstance that contains attribute instances based on the specification in applyOutput
Throws:
InvalidArgumentException -
  • dmsConn is null,
  • record is null,
  • modelName is null, or
  • applyOutput is null.
ODMException - when modelName is empty or exceeds 64 characters in length
java.sql.SQLException - when an error occurs during the execution of apply operation
MiningOperationException -  
Since:
9.2.0
See Also:
RecordInstance, AttributeInstance, MiningApplyOutput

test

public static void test(Connection dmsConn,
                        LocationAccessData inputData,
                        PhysicalDataSpecification pds,
                        java.lang.String modelName,
                        java.lang.String outputResultName)
                 throws InvalidArgumentException,
                        java.sql.SQLException,
                        java.io.IOException,
                        ODMException
Deprecated. As of ODM 9.2.0. Use MiningTestTask to perform the test mining operation.

Performs the test mining operation on a database table represented by inputData in the format specified by pds. The test result is stored in the specified data mining server.

Refer to the oracle.dmt.odm.result package for more information on MiningTestResult and ClassificationTestResult.

Parameters:
dmsConn - The connection to the data mining server
inputData - A database table to be used as input for test
pds - A specification on the format of the input data
modelName - The name of the model to be used for test
applyResultName - The name of the result to be persisted in the data mining server
Throws:
InvalidArgumentException -
  • dmsConn is null,
  • inputData is null,
  • pds is null,
  • modelName is null, or
  • outputResultName is null
ODMException -
  • modelName is empty or exceeds 64 characters in length, or
  • outputResultName is empty or exceeds 64 characters in length
java.sql.SQLException - when an error occurs during the execution of apply operation
java.io.IOException -  
See Also:
MiningTestTask, MiningTestResult, ClassificationTestResult

computeLift

public static void computeLift(Connection dmsConn,
                               int numQuantiles,
                               LocationAccessData inputData,
                               PhysicalDataSpecification pds,
                               int targetVal,
                               java.lang.String modelName,
                               java.lang.String liftResultName)
                        throws InvalidArgumentException,
                               java.sql.SQLException,
                               MiningObjectException,
                               ODMException
Deprecated. As of ODM 9.2.0. Use MiningLiftTask to perform the compute lift mining operation.

Performs the compute lift mining operation on a database table represented by inputData in the format specified by pds given a positive target value and the number of quantiles. The result is stored in the specified data mining server.

In ODM 9.2.0, the type of the target attribute can be either string (i.e., if unprepared) or integer (i.e., if discretized). This method supports only the former case, and the user is recommended to use MiningLiftTask when the target attribute is of string type. Refer to DataPreparationStatus and DataUsageEntry for further details about automated binning, and to MiningLiftTask for further details about compute lift task.

Parameters:
dmsConn - The connection to the data mining server
numQuantiles - The number of quantiles to be computed
inputData - A database table to be used as input for compute lift
pds - A specification on the format of the input data
targetVal - The positive target value against which the lift values are computed
modelName - The name of the model to be used for compute lift
liftResultName - The name of the result to be persisted in the data mining server
Throws:
InvalidArgumentException -
  • dmsConn is null,
  • numQuantiles is less than 1,
  • inputData is null,
  • pds is null,
  • targetVal is less than 1,
  • modelName is null, or
  • liftResultName is null
ODMException -
  • modelName is empty or exceeds 64 characters in length, or
  • liftResultName is empty or exceeds 64 characters in length
java.sql.SQLException - when an error occurs during the execution of apply operation
MiningObjectException -  
See Also:
MiningLiftTask, MiningLiftResult

restore

public static SupervisedModel restore(Connection dmsConn,
                                      java.lang.String modelName)
                               throws java.sql.SQLException,
                                      MiningObjectException,
                                      InvalidArgumentException,
                                      ODMException
Returns an instance of SupervisedModel with the specified name persisted in the data mining server given a connection to the data mining server and the model name.
Parameters:
dmsConn - The connection to the data mining server
modelName - The name of the model to be restored
Returns:
SupervisedModel - An instance of SupervisedModel restored
Throws:
InvalidArgumentException -
     - if modelName is null
     - if dmsConn is null
ODMException - when modelName is empty or exceeds 64 acharacter in length.
- SQLException
     - if the model table does not exist in the database
     - if the model name is invalid
MiningObjectException - when the restored model is not an instance of SupervisedModel.

restore

public static SupervisedModel restore(java.sql.Connection dbConn,
                                      java.lang.String modelName)
                               throws java.sql.SQLException,
                                      MiningObjectException,
                                      InvalidArgumentException,
                                      ODMException
Returns an instance of SupervisedModel with the specified name persisted in the data mining server given a database connection to the data mining server and the model name.
Parameters:
dbConn - A database connection to the data mining server
modelName - The name of the model to be restored
Returns:
SupervisedModel - An instance of SupervisedModel restored
Throws:
InvalidArgumentException -
     - if modelName is null
     - if dbConn is null
ODMException - when modelName is empty or exceeds 64 acharacter in length.
- SQLException
     - if the model table does not exist in the database
     - if the model name is invalid
MiningObjectException - when the restored model is not an instance of SupervisedModel.