Teradata Package for R Function Reference | 17.00 - 17.00 - td_xml_to_html_report_valib - Teradata Package for R

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B700-4007-090K
Language
English (United States)

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.

Usage

td_xml_to_html_report_valib(data, analysis.type, ...)

Arguments

data

Required Argument.
Specifies the input data to run statistical tests.
Types: tbl_teradata

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', 'td_decision_tree_valib'
    Outputs HTML report for:

    • Decision Tree Summary

    • Variables

    • Text Tree

  • 'decisiontreescore', 'td_decision_tree_evaluator_valib'
    Outputs HTML report for:

    • Decision Tree Scoring Summary - Confusion Matrix

  • 'factor', 'td_pca_valib'
    Outputs HTML report for:

    • Factor Analysis Summary

    • Variable Statistics

    • Eigenvalues

    • PCLoadings

    • Variance and Absolute Difference

    • Near Dependency Report

    • Group-by Columns

  • 'factorscore', 'td_pca_evaluator_valib'
    Outputs HTML report for:

    • Factor Analysis Scoring Summary

  • 'linear', 'td_lin_reg_valib'
    Outputs HTML report for:

    • Linear Regression Summary

    • Group-by Columns

    • Near Dependency Report

  • 'logistic', 'td_log_reg_valib'
    Outputs HTML report for:

    • Prediction Success Table

    • Multithreshold Success Table

    • Lift Table

    • Near Dependency Report

    • Group-by Columns

    • Variable Statistics

  • 'logisticscore', 'td_log_reg_evaluator_valib'
    Outputs HTML report for:

    • Prediction Success Table

    • Multithreshold Success Table

    • Lift Table

Types: character

...

Specifies other arguments supported by the function as described in the 'Other Arguments' section.

Value

Function returns an object of class "td_xml_to_html_report_valib" which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using name: result.

Other Arguments

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. Types: character

Examples

# Notes:
#   1. To execute Vantage Analytic Library functions, set option 
#      '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.
#   3. The Statistical Test metadata tables must be loaded into the database 
#      where Analytics Library is installed.

# Set the option 'val.install.location'.
options(val.install.location = "SYSLIB")

# Get remote data source connection.
con <- td_get_context()$connection

# Create an object of class "tbl_teradata".
df <- tbl(con, "customer")
print(df)

# Example: Shows the Near Dependency Report is requested with related 
#          options. Convert the XML reports from the output of this 
#          function to HTML format.
lrobj <- td_log_reg_valib(data=df, 
                          columns=c("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(lrobj$model)
print(lrobj$statistical.measures)
print(lrobj$xml.reports)

obj <- td_xml_to_html_report_valib(data=lrobj$model,
                                   analysis.type="logistic")

# Print the results.
print(obj$result)