Teradata Package for Python Function Reference - XmlToHtmlReport - 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
 
 
XmlToHtmlReport

 
Functions
       
XmlToHtmlReport(data, analysis_type, filter=None)
DESCRIPTION:
    Several Analytic Algorithms and Scoring functions output columns of XML.
    This function transforms the XML to HTML, which is easier to view.
    Function outputs the HTML in a column of type Teradata XML. You can copy
    the HTML into a text file, give the text file a name ending in ".html",
    and view it in a browser.
    Alternatively, you can view the HTML in a Jupyter notebook by
    double-clicking the cell that contains HTML to display it in web view.
 
    Note:
        This function is available in Vantage Analytic Library 2.0.0.3 or
        later.
 
PARAMETERS:
    data:
        Required Argument.
        Specifies the input data to run statistical tests.
        Types: teradataml DataFrame
 
    analysis_type:
        Required Argument.
        Specifies the class name of the function or a SQL function name
        whose XML you want the function to translate to HTML.
        Function outputs different reports in HTML format depending on
        the values passed to the argument.
        Permitted Values:
            * "decisiontree", "DecisionTree".
              Outputs HTML reports for:
                  * Decision Tree Summary.
                  * Variables.
                  * Text Tree.
            * "decisiontreescore", "DecisionTreeEvaluator".
              Outputs HTMl reports for:
                  * Decision Tree Scoring Summary—Confusion Matrix.
            * "factor", "PCA".
              Outputs HTMl reports for:
                  * Factor Analysis Summary.
                  * Variable Statistics.
                  * Eigenvalues.
                  * PCLoadings.
                  * Variance and Absolute Difference.
                  * Near Dependency Report.
                  * Group-by Columns.
            * "factorscore", "PCAEvaluator".
              Outputs HTMl reports for:
                  * Factor Analysis Scoring Summary.
            * "linear", "LinReg".
              Outputs HTMl reports for:
                  * Linear Regression Summary.
                  * Group-by Columns.
                  * Near Dependency Report.
            * "logistic", "LogReg".
              Outputs HTMl reports for:
                  * Prediction Success Table.
                  * Multithreshold Success Table.
                  * Lift Table.
                  * Near Dependency Report.
                  * Group-by Columns.
                  * Variable Statistics.
            * "logisticScore", "LogRegEvaluator".
              Outputs HTMl reports for:
                  * Prediction Success Table.
                  * Multithreshold Success Table.
                  * Lift Table.
        Types: str
 
    filter:
        Optional Argument.
        Specifies the clause to filter rows selected for analysis.
        For example,
              filter = "cust_id > 0"
        This parameter is useful only when the function "analysis_type"
        (which outputs the input table name for the report function)
        specified its "group_columns" argument and generated multiple
        XML models.
        Multiple XML models in input table name can cause the function
        to run out of memory. In that case, limit the rows selected for
        analysis with this argument.
        Type: str
 
    RETURNS:
        An instance of XmlToHtmlReport.
        Output teradataml DataFrames can be accessed using attribute
        references, such as XmlToHtmlReport.<attribute_name>.
        Output teradataml DataFrame attribute name is: result.
 
    RAISES:
        TeradataMlException, TypeError, ValueError.
 
    EXAMPLES:
        # Notes:
        #   1. To execute Vantage Analytic Library functions,
        #       a. import "valib" object from teradataml.
        #       b. set 'configure.val_install_location' to the database name where Vantage
        #          analytic library functions are installed.
        #   2. Datasets used in these examples can be loaded using Vantage Analytic Library
        #      installer.
        # Import valib object from teradataml to execute this function.
        from teradataml import valib
 
        # Set the 'configure.val_install_location' variable.
        from teradataml import configure
        configure.val_install_location = "SYSLIB"
 
        # Create required teradataml DataFrame.
        df = DataFrame("customer")
        print(df)
 
        # Example 1: Shows the Near Dependency Report is requested with
        related options.
        obj = valib.LogReg(data=df,
                       columns=["age", "years_with_bank", "income"],
                       response_column="nbr_children",
                       response_value=1,
                       cond_ind_threshold=3,
                       variance_prop_threshold=0.3)
 
        # Print the results.
        print(obj.model)
        print(obj.statistical_measures)
        print(obj.xml_reports)
 
        obj = valib.XmlToHtmlReport(data=obj.model, analysis_type="logistic")
 
        # Print te result.
        print(obj.result)