Oracle Data Mining Java API Reference
10g Release 1 (10.1)

B12276-01

oracle.dmt.odm
Class CategoryMatrix

java.lang.Object
  |
  +--oracle.dmt.odm.MiningObject
        |
        +--oracle.dmt.odm.CategoryMatrix
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CostMatrix

public class CategoryMatrix
extends MiningObject

An instance of CategoryMatrix represents a sparse square matrix whose axes are categories. This class supports the confusion matrix, an output of the test operation for a classification model, and the cost matrix, an input of the build operation for a classification model.

Since:
9.0.1
See Also:
Serialized Form

Constructor Summary
CategoryMatrix()
          Creates an empty instance of CategoryMatrix.

 

Method Summary
 void addEntry(Category rowValue, Category columnValue, float value)
          Deprecated. As of ODM 10.1.0, Use other CostMatrix.addEntry() method
 float getDiagonalDefault()
          Deprecated. As of ODM 9.2.0, this method is not supported.
 float getOffDiagonalDefault()
          Deprecated. As of ODM 9.2.0, this method is not supported.
 float getValue(Category row, Category column)
          Returns the value of the entry at the specified row Category and column Category position.
 float getValue(java.lang.String row, java.lang.String column)
          Returns the value of the entry whose row and column display names match to the specified names.
 boolean isPresent(Category indexValue)
          Returns true if the given index value is found in the matrix.
 Category[] listCategories()
          Returns all row and column index values in the matrix.
 java.lang.String[] listColumnDisplayNames()
          Deprecated. As of 9.2.0, replaced by listDisplayNames method.
 Category[] listColumnValues()
          Deprecated. As of 9.2.0, replaced by listCategories method.
 java.lang.String[] listDisplayNames()
          Returns all display names used in the matrix.
 java.lang.String[] listRowDisplayNames()
          Deprecated. As of 9.2.0, replaced by listDisplayNames method.
 Category[] listRowValues()
          Deprecated. As of 9.2.0, replaced by listCategories method.
 float sumAllCells()
          Returns the sum of all cells in the matrix.
 float sumForColumn(Category column)
          Returns sum of all cells in the given column index of the matrix.
 float sumForRow(Category row)
          Returns sum of all cells in the given row index of the matrix
 java.lang.String toString()
          Returns a formatted string representation of a CategoryMatrix instance.
 void validate()
          Deprecated. As of ODM 10.1.0, Use other CostMatrix.validate() method

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

CategoryMatrix

public CategoryMatrix()
Creates an empty instance of CategoryMatrix.
Method Detail

getDiagonalDefault

public float getDiagonalDefault()
Deprecated. As of ODM 9.2.0, this method is not supported.
Returns the default value of the diagonal elements in the matrix.
Returns:
float - The default value of the diagonal elements

getOffDiagonalDefault

public float getOffDiagonalDefault()
Deprecated. As of ODM 9.2.0, this method is not supported.
Returns the default value of off-diagonal elements in the matrix.
Returns:
float - The default value of the off-diagonal elements

addEntry

public void addEntry(Category rowValue,
Category columnValue,
                     float value)
              throws ODMException
Deprecated. As of ODM 10.1.0, Use other CostMatrix.addEntry() method
Adds a new entry to the matrix.
Throws:
ODMException -
  • when rowValue or columnValue is null,
  • when value is negative,
  • when rowValue and columnValue do not have the same data type,
  • when all row categories do not have the same data type,
  • when all column categories do not have the same data type,
  • when A duplicated entry is being added.

getValue

public float getValue(java.lang.String row,
                      java.lang.String column)
               throws ODMException
Returns the value of the entry whose row and column display names match to the specified names.
Parameters:
row - A row display name in the matrix
column - A column display name in the matrix
Returns:
float - The value in the matrix at (row, column) position.
Throws:
ODMException - when no entry was found at the position (row, column).

getValue

public float getValue(Category row,
Category column)
               throws ODMException
Returns the value of the entry at the specified row Category and column Category position.
Parameters:
row - A row index in the matrix
column - A column index in the matrix
Returns:
value - The value at the specified position
Throws:
ODMException - when no entry was found at the position (row, column).

validate

public void validate()
              throws ODMException
Deprecated. As of ODM 10.1.0, Use other CostMatrix.validate() method
Validates the matrix to ensure all entries have a valid value and all diagonal entries have a zero value.
Throws:
ODMException -
  • when a value is null,
  • when a value is negative, or
  • when a diagonal value is not 0.
ODMException - when the object is invalid.

listRowValues

public Category[] listRowValues()
Deprecated. As of 9.2.0, replaced by listCategories method.
Returns all row index values in the matrix.
Returns:
Category[] - All row index values

listColumnValues

public Category[] listColumnValues()
Deprecated. As of 9.2.0, replaced by listCategories method.
Returns all column index values in the matrix.
Returns:
Category[] - All column index values

listCategories

public Category[] listCategories()
Returns all row and column index values in the matrix.
Returns:
Category[] - All index values
Since:
9.2.0

toString

public java.lang.String toString()
Returns a formatted string representation of a CategoryMatrix instance.
Overrides:
toString in class java.lang.Object
Returns:
String - A formatted string of the instance

listRowDisplayNames

public java.lang.String[] listRowDisplayNames()
Deprecated. As of 9.2.0, replaced by listDisplayNames method.
Returns all display names for the rows in the matrix.
Returns:
String[] - An array of display names

listColumnDisplayNames

public java.lang.String[] listColumnDisplayNames()
Deprecated. As of 9.2.0, replaced by listDisplayNames method.
Returns all display names for the columns in the matrix.
Returns:
String[] - An array of display names

listDisplayNames

public java.lang.String[] listDisplayNames()
Returns all display names used in the matrix.
Returns:
String[] - An array of display names
Since:
9.2.0

sumAllCells

public float sumAllCells()
                  throws ODMException
Returns the sum of all cells in the matrix.
Returns:
float - The total value of all cells in the matrix.
Throws:
ODMException - when an invalid value is found.

sumForRow

public float sumForRow(Category row)
                throws ODMException
Returns sum of all cells in the given row index of the matrix
Parameters:
row - A row index in the matrix
Returns:
float - The total value of all cells in the given row index.
Throws:
ODMException - when an invalid value is found.

sumForColumn

public float sumForColumn(Category column)
                   throws ODMException
Returns sum of all cells in the given column index of the matrix.
Parameters:
column - A column index in the matrix
Returns:
float - The total value of all cells in the given column index.
Throws:
ODMException - when an invalid value is found.

isPresent

public boolean isPresent(Category indexValue)
Returns true if the given index value is found in the matrix.
Returns:
true if cat is found, false otherwise.

Copyright © 2003 Oracle Corporation. All Rights Reserved.