Teradata Package for Python Function Reference - FMeasure - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2021-11-19
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.mle.FMeasure = class FMeasure(builtins.object)
     Methods defined here:
__init__(self, data=None, obs_column=None, predict_column=None, classes=None, beta=1.0, data_sequence_column=None, data_order_column=None)
DESCRIPTION:
    The FMeasure function calculates the accuracy of a test (usually the 
    output of a classifier).
 
PARAMETERS:
    data:
        Required Argument.
        Specifies the input teradataml DataFrame containing the output of a classifier.
    
    data_order_column:
        Optional Argument.
        Specifies Order By columns for data.
        Values to this argument can be provided as a list, if multiple 
        columns are used for ordering.
        Types: str OR list of Strings (str)
    
    obs_column:
        Required Argument.
        Specifies the name of the input teradataml DataFrame column that 
        contains the observed class.
        Types: str
    
    predict_column:
        Required Argument.
        Specifies the name of the input teradataml DataFrame column that 
        contains the predicted class.
        Types: str
    
    classes:
        Optional Argument.
        Specifies the class or classes to output in the result. The default 
        is all classes.
        Types: str OR list of strs
    
    beta:
        Optional Argument.
        Specifies the value of beta in the F-measure formula that the function
        implements. The beta_value must be a positive float value.
        Default Value: 1.0
        Types: float
    
    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 FMeasure.
    Output teradataml DataFrames can be accessed using attribute 
    references, such as FMeasureObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
RAISES:
    TeradataMlException
 
EXAMPLES:
    # Load the data to run the example.
    load_example_data("fmeasure", "computers_category")
 
    # Create teradataml DataFrame object.
    computers_category = DataFrame.from_table("computers_category")
 
    # Example 1 - The input DataFrame is computers_category, running FMeasure to calculate
                  accuracy of all classes.
    fmeasure_out1 = FMeasure(data=computers_category,
                            obs_column='expected_compcategory',
                            predict_column='predicted_compcategory',
                            beta=1.0,
                            data_sequence_column='compid'
                            )
 
    # Print the output DataFrames.
    print(fmeasure_out1.result)
 
    # Example 2 - Running FMeasure to calculate accuracy of Specified Classes "special" and "hyper".
    fmeasure_out2 = FMeasure(data=computers_category,
                            obs_column='expected_compcategory',
                            predict_column='predicted_compcategory',
                            classes=['special','hyper'],
                            beta=1.0,
                            data_sequence_column='compid'
                            )
 
    # Print the output DataFrames.
    print(fmeasure_out2.result)
__repr__(self)
Returns the string representation for a FMeasure 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.