| |
Methods defined here:
- __init__(self, data=None, reference=None, prediction=None, classes=None, prevalence=None, data_sequence_column=None)
- DESCRIPTION:
The ConfusionMatrix function shows how often a classification
algorithm correctly classifies items. The function takes an input
teradataml data frame that includes two columns one containing the
observed class of an item and the other containing the class
predicted by the algorithm and outputs three tables mentioned under RETURNS.
PARAMETERS:
data:
Required Argument.
The input teradataml data frame of ConfusionMatrix function
reference:
Required Argument.
Specifies the name of the input column that contains the observed
class.
Types: str
prediction:
Required Argument.
Specifies the name of the input column that contains the predicted
class.
Types: str
classes:
Optional Argument.
Specifies the classes to output in output_table.
Types: str OR list of Strings (str)
prevalence:
Optional Argument.
Specifies the prevalences for the classes to output in
output_table_3. Therefore, if you specify prevalence, then you must
also specify classes, and for every class, you must specify a
prevalence.
Types: float OR list of floats
data_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "data". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: str OR list of Strings (str)
RETURNS:
Instance of ConfusionMatrix.
Output teradataml DataFrames can be accessed using attribute
references, such as ConfusionMatrixObj.<attribute_name>.
Output teradataml DataFrame attribute names are:
1. counttable
2. stattable
3. accuracytable
4. output
RAISES:
TeradataMlException
EXAMPLES:
# Load the data to run the example.
load_example_data("confusionmatrix", "iris_category_expect_predict")
# Create teradataml Dataframe.
iris_category_expect_predict = DataFrame.from_table("iris_category_expect_predict")
# Example
confusion_matrix_output = ConfusionMatrix(data=iris_category_expect_predict,
reference='expected_value',
prediction='predicted_value',
classes='versicolor',
prevalence=0.5,
data_sequence_column='id'
)
# Print the result teradataml DataFrame
print(confusion_matrix_output.counttable)
print(confusion_matrix_output.stattable)
print(confusion_matrix_output.accuracytable)
print(confusion_matrix_output.output)
- __repr__(self)
- Returns the string representation for a ConfusionMatrix class instance.
- get_build_time(self)
- Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_prediction_type(self)
- Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_target_column(self)
- Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- show_query(self)
- Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.
|