hana_ml.visualizers package

The Visualizers Package consists of the following sections:

hana_ml.visualizers.eda

This module represents an eda plotter. Matplotlib is used for all visualizations.

hana_ml.visualizers.eda.kdeplot(data, key, features=None, kde=<hana_ml.algorithms.pal.kernel_density.KDE object>, points=1000, **kwargs)

Display a kernel density estimate plot for SAP HANA DataFrame.

Parameters
dataDataFrame

Dataframe including the data of density distribution.

keystr

Name of the ID column in the dataframe.

featuresstr/list of str, optional

Name of the feature columns in the dataframe.

kdehana_ml.algorithms.pal.kernel_density.KDE, optional

KDE Calculation.

Defaults to KDE().

pointsint, optional

The number of points for plotting.

Defaults to 1000.

Returns
axAxes

The axes for the plot.

surfPoly3DCollection

The surface plot object. Only valid for 2D plotting.

Examples

>>> f = plt.figure(figsize=(19, 10))
>>> ax = kdeplot(data, key="PASSENGER_ID", features=["AGE"])
>>> ax.grid()
>>> plt.show()
_images/kde_plot.png
>>> f = plt.figure(figsize=(19, 10))
>>> ax, surf = kdeplot(data, key="PASSENGER_ID", features=["AGE", "FARE"])
>>> ax.grid()
>>> plt.show()
_images/kde_plot2.png
hana_ml.visualizers.eda.hist(data, columns, bins=None, debrief=False, x_axis_fontsize=10, x_axis_rotation=0, title_fontproperties=None, default_bins=20, **kwargs)

Plot histograms for SAP HANA DataFrame.

Parameters
dataDataFrame

DataFrame used for the plot.

columnslist of str

Columns in the DataFrame being plotted.

binsint or dict, optional

The number of bins to create based on the value of column.

Defaults to 20.

debriefbool, optional

Whether to include the skewness debrief.

Defaults to False.

x_axis_fontsizeint, optional

The size of x axis labels.

Defaults to 10.

x_axis_rotationint, optional

The rotation of x axis labels.

Defaults to 0.

title_fontpropertiesFontProperties, optional

Change the font properties for titile.

Defaults to None.

default_binsint, optional

The number of bins to create for the column that has not been specified in bins when bins is dict.

Defaults to 20.

Examples

>>> hist(data=data, columns=['PCLASS', 'AGE', 'SIBSP', 'PARCH', 'FARE'], default_bins=20, bins={"AGE": 10})
_images/hist_plot.png
class hana_ml.visualizers.eda.EDAVisualizer(ax=None, size=None, cmap=None, title=None)

Bases: hana_ml.visualizers.visualizer_base.Visualizer

Class for all EDA visualizations, including:

  • Distribution plot

  • Pie plot

  • Correlation plot

  • Scatter plot

  • Bar plot

  • Box plot

Parameters
axmatplotlib.Axes, optional

The axes used to plot the figure.

Default value is current axes.

sizetuple of integers, optional

(width, height) of the plot in dpi

Default value is the current size of the plot.

cmapmatplotlib.pyplot.colormap, optional

Color map used for the plot.

Defaults to None.

titlestr, optional

This plot's title.

Default value is None

Examples

>>> f = plt.figure(figsize=(10,10))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
Attributes
ax

Returns the matplotlib Axes where the Visualizer will draw.

cmap

Returns the color map being used for the plot.

size

Returns the size of the plot in pixels.

title

Returns the title of the plot.

Methods

bar_plot(self, data, column, aggregation[, ...])

Displays a bar plot for the SAP HANA DataFrame column specified.

box_plot(self, data, column[, outliers, ...])

Displays a box plot for the SAP HANA DataFrame column specified.

correlation_plot(self, data[, key, ...])

Displays a correlation plot for the SAP HANA DataFrame columns specified.

distribution_plot(self, data, column, bins)

Displays a distribution plot for the SAP HANA DataFrame column specified.

pie_plot(self, data, column[, explode, ...])

Displays a pie plot for the SAP HANA DataFrame column specified.

scatter_plot(self, data, x, y[, x_bins, ...])

Displays a scatter plot for the SAP HANA DataFrame columns specified.

set_ax(self, ax)

Sets the Axes

set_cmap(self, cmap)

Sets the colormap

set_size(self, size)

Sets the size

set_title(self, title)

Sets the title of the plot

distribution_plot(self, data, column, bins, title=None, x_axis_fontsize=10, x_axis_rotation=0, debrief=False, rounding_precision=3, title_fontproperties=None, replacena=0, **kwargs)

Displays a distribution plot for the SAP HANA DataFrame column specified.

Parameters
dataDataFrame

DataFrame used for the plot.

columnstr

Column in the DataFrame being plotted.

binsint

Number of bins to create based on the value of column.

titlestr, optional

Title for the plot.

x_axis_fontsizeint, optional

Size of x axis labels.

Defaults to 10.

x_axis_rotationint, optional

Rotation of x axis labels.

Defaults to 0.

debriefbool, optional

Whether to include the skewness debrief.

Defaults to False.

rounding_precisionint, optional

The rounding precision for bin size.

Defaults to 3.

title_fontpropertiesFontProperties, optional

Change the font properties for titile.

Defaults to None.

replacenafloat, optional

Replace na with the specified value.

Defaults to 0.

Returns
axAxes

The axes for the plot.

bin_datapandas.DataFrame

The data used in the plot.

Examples

>>> f = plt.figure(figsize=(35, 10))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax1, dist_data = eda.distribution_plot(data=data, column="FARE", bins=100, title="Distribution of FARE")
>>> plt.show()
_images/distribution_plot.png
pie_plot(self, data, column, explode=0.03, title=None, legend=True, title_fontproperties=None, legend_fontproperties=None, **kwargs)

Displays a pie plot for the SAP HANA DataFrame column specified.

Parameters
dataDataFrame

DataFrame used for the plot.

columnstr

Column in the DataFrame being plotted.

explodefloat, optional

Relative spacing between pie segments.

titlestr, optional

Title for the plot.

Defaults to None.

legendbool, optional

Whether to show the legend for the plot.

Defaults to True.

title_fontpropertiesFontProperties, optional

Change the font properties for titile.

Defaults to None.

legend_fontpropertiesFontProperties, optional

Change the font properties for legend.

Defaults to None.

Returns
axAxes

The axes for the plot. This can be used to set specific properties for the plot.

pie_datapandas.DataFrame

The data used in the plot.

Examples

>>> f = plt.figure(figsize=(8, 8))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax1, pie_data = eda.pie_plot(data, column="PCLASS", title="% of passengers in each cabin")
>>> plt.show()
_images/pie_plot.png
correlation_plot(self, data, key=None, corr_cols=None, label=True, cmap='RdYlBu', **kwargs)

Displays a correlation plot for the SAP HANA DataFrame columns specified.

Parameters
dataDataFrame

DataFrame used for the plot.

keystr, optional

Name of ID column.

Defaults to None.

corr_colslist of str, optional

Columns in the DataFrame being plotted. If None then all numeric columns will be plotted.

Defaults to None.

labelbool, optional

Plot a colorbar.

Defaults to True.

cmapmatplotlib.pyplot.colormap, optional

Color map used for the plot.

Defaults to "RdYlBu".

Returns
axAxes

The axes for the plot. This can be used to set specific properties for the plot.

corrpandas.DataFrame

The data used in the plot.

Examples

>>> f = plt.figure(figsize=(35, 10))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax1, corr = eda.correlation_plot(data=data, corr_cols=['PCLASS', 'AGE', 'SIBSP', 'PARCH', 'FARE'], cmap="Blues")
>>> plt.show()
_images/correlation_plot.png
scatter_plot(self, data, x, y, x_bins=None, y_bins=None, title=None, label=None, cmap='Blues', debrief=True, rounding_precision=3, label_fontsize=12, title_fontproperties=None, sample_frac=1.0, **kwargs)

Displays a scatter plot for the SAP HANA DataFrame columns specified.

Parameters
dataDataFrame

DataFrame used for the plot.

xstr

Column to be plotted on the x axis.

ystr

Column to be plotted on the y axis.

x_binsint, optional

Number of x axis bins to create based on the value of column.

Defaults to None.

y_binsint

Number of y axis bins to create based on the value of column.

Defaults to None.

titlestr, optional

Title for the plot.

Defaults to None.

labelstr, optional

Label for the color bar.

Defaults to None.

cmapmatplotlib.pyplot.colormap, optional

Color map used for the plot.

Defaults to "Blues".

debriefbool, optional

Whether to include the correlation debrief.

Defaults to True

rounding_precisionint, optional

The rounding precision for bin size.

Defaults to 3.

label_fontsizeint, optional

Change the font size for label.

Defaults to 12.

title_fontpropertiesFontProperties, optional

Change the font properties for titile.

Defaults to None.

sample_fracfloat, optional

Sampling method is applied to data. Valid if x_bins and y_bins are not set.

Defaults to 1.0.

Returns
axAxes

The axes for the plot.

bin_matrixpandas.DataFrame

The data used in the plot.

Examples

>>> f = plt.figure(figsize=(10, 10))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax1, corr = eda.scatter_plot(data=data, x="AGE", y="SIBSP", x_bins=5, y_bins=5)
>>> plt.show()
_images/scatter_plot.png
>>> f = plt.figure(figsize=(10, 10))
>>> ax2 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax2)
>>> ax2 = eda.scatter_plot(data=data, x="AGE", y="SIBSP", sample_frac=0.8, s=10, marker='o')
>>> plt.show()
_images/scatter_plot2.png
bar_plot(self, data, column, aggregation, title=None, label_fontsize=12, title_fontproperties=None, **kwargs)

Displays a bar plot for the SAP HANA DataFrame column specified.

Parameters
dataDataFrame

DataFrame used for the plot.

columnstr

Column to be aggregated.

aggregationdict

Aggregation conditions ('avg', 'count', 'max', 'min').

titlestr, optional

Title for the plot.

Defaults to None.

label_fontsizeint, optional

The size of label.

Defaults to 12.

title_fontpropertiesFontProperties, optional

Change the font properties for titile.

Defaults to None.

Returns
axAxes

The axes for the plot.

bar_datapandas.DataFrame

The data used in the plot.

Examples

>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax, bar_data = eda.bar_plot(data=data, column='COLUMN',
                                aggregation={'COLUMN':'count'})

Returns : bar plot (count) of 'COLUMN'

>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax, bar_data = eda.bar_plot(data=data, column='COLUMN',
                                aggregation={'OTHER_COLUMN':'avg'})

Returns : bar plot (avg) of 'COLUMN' against 'OTHER_COLUMN'

box_plot(self, data, column, outliers=False, title=None, groupby=None, lower_outlier_fence_factor=0, upper_outlier_fence_factor=0, title_fontproperties=None)

Displays a box plot for the SAP HANA DataFrame column specified.

Parameters
dataDataFrame

DataFrame used for the plot.

columnstr

Column in the DataFrame being plotted.

outliersbool

Whether to plot suspected outliers and outliers.

Defaults to False.

titlestr, optional

Title for the plot.

Defaults to None.

groupbystr, optional

Column to group by and compare.

Defaults to None.

lower_outlier_fence_factorfloat, optional

The lower bound of outlier fence factor.

Defaults to 0.

upper_outlier_fence_factor

The upper bound of outlier fence factor.

Defaults to 0.

title_fontpropertiesFontProperties, optional

Change the font properties for titile.

Defaults to None.

Returns
axAxes

The axes for the plot.

contpandas.DataFrame

The data used in the plot.

Examples

>>> f = plt.figure(figsize=(10, 10))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax1, corr = eda.box_plot(data=data, column="AGE")
>>> plt.show()
_images/box_plot.png
>>> f = plt.figure(figsize=(10, 10))
>>> ax1 = f.add_subplot(111)
>>> eda = EDAVisualizer(ax1)
>>> ax1, corr = eda.box_plot(data=data, column="AGE", groupby="SEX")
>>> plt.show()
_images/box_plot2.png
property ax

Returns the matplotlib Axes where the Visualizer will draw.

property cmap

Returns the color map being used for the plot.

set_ax(self, ax)

Sets the Axes

set_cmap(self, cmap)

Sets the colormap

set_size(self, size)

Sets the size

set_title(self, title)

Sets the title of the plot

property size

Returns the size of the plot in pixels.

property title

Returns the title of the plot.

class hana_ml.visualizers.eda.Profiler(*args, **kwargs)

Bases: object

A class to build a SAP HANA Profiler, including:

  • Variable descriptions

  • Missing values %

  • High cardinality %

  • Skewness

  • Numeric distributions

  • Categorical distributions

  • Correlations

  • High correlaton warnings

Methods

description(self, data, key[, bins, ...])

Returns a SAP HANA profiler, including:

set_size(self, fig, figsize)

Set the size of the data description plot, in inches.

description(self, data, key, bins=20, missing_threshold=10, card_threshold=100, skew_threshold=0.5, figsize=None)

Returns a SAP HANA profiler, including:

  • Variable descriptions

  • Missing values %

  • High cardinality %

  • Skewness

  • Numeric distributions

  • Categorical distributions

  • Correlations

  • High correlaton warnings

Parameters
dataDataFrame

DataFrame used for the plat.

keystr, optional

Name of the key column in the DataFrame.

binsint, optional

Number of bins for numeric distributions. Default value = 20.

missing_thresholdfloat

Percentage threshold to display missing values.

card_thresholdint

Threshold for column to be considered with high cardinality.

skew_thresholdfloat

Absolute value threshold for column to be considered as highly skewed.

tight_layoutbool, optional

Use matplotlib tight layout or not.

figsizetuple, optional

Size of figure to be plotted. First element is width, second is height.

Note: categorical columns with cardinality warnings are not plotted.
Returns
figFigure

matplotlib axis of the profiler

set_size(self, fig, figsize)

Set the size of the data description plot, in inches.

Parameters
figax

The returned axes constructed by the description method.

figsizetuple

Tuple of width and height for the plot.

hana_ml.visualizers.metrics

This module represents a visualizer for metrics.

class hana_ml.visualizers.metrics.MetricsVisualizer(ax=None, size=None, cmap=None, title=None)

Bases: hana_ml.visualizers.visualizer_base.Visualizer, object

The MetricVisualizer is used to visualize metrics.

Parameters
axmatplotlib.Axes, optional

The axes to use to plot the figure. Default value : Current axes

sizetuple of integers, optional

(width, height) of the plot in dpi Default value: Current size of the plot

titlestr, optional

This plot's title. Default value : Empty str

Attributes
ax

Returns the matplotlib Axes where the Visualizer will draw.

cmap

Returns the color map being used for the plot.

size

Returns the size of the plot in pixels.

title

Returns the title of the plot.

Methods

plot_confusion_matrix(self, df[, normalize])

This function plots the confusion matrix and returns the Axes where this is drawn.

set_ax(self, ax)

Sets the Axes

set_cmap(self, cmap)

Sets the colormap

set_size(self, size)

Sets the size

set_title(self, title)

Sets the title of the plot

plot_confusion_matrix(self, df, normalize=False)

This function plots the confusion matrix and returns the Axes where this is drawn.

Parameters
dfDataFrame

Data points to the resulting confusion matrix. This dataframe's columns should match columns ('CLASS', '')

property ax

Returns the matplotlib Axes where the Visualizer will draw.

property cmap

Returns the color map being used for the plot.

set_ax(self, ax)

Sets the Axes

set_cmap(self, cmap)

Sets the colormap

set_size(self, size)

Sets the size

set_title(self, title)

Sets the title of the plot

property size

Returns the size of the plot in pixels.

property title

Returns the title of the plot.

hana_ml.visualizers.m4_sampling

M4 algorithm for sampling query

hana_ml.visualizers.m4_sampling.get_min_index(data)

Get Minimum Timestamp of Time Series Data

Parameters
dataDataFrame

Time series data whose 1st column is index and 2nd one is value.

Returns
datetime

Return the minimum timestamp.

hana_ml.visualizers.m4_sampling.get_max_index(data)

Get Maximum Timestamp of Time Series Data

Parameters
dataDataFrame

Time series data whose 1st column is index and 2nd one is value.

Returns
datetime

Return the maximum timestamp.

hana_ml.visualizers.m4_sampling.m4_sampling(data, width)

M4 algorithm for big data visualization

Parameters
dataDataFrame

Data to be sampled. Time seires data whose 1st column is index and 2nd one is value.

widthint

Sampling Rate. It is an indicator of how many pixels being in the picture.

Returns
DataFrame

Return the sampled dataframe.

hana_ml.visualizers.model_debriefing

This module represents a visualizer for tree model and Graphviz is required.

Please download and install Graphviz from the following link:

https://graphviz.org/download/

The following class is available:

class hana_ml.visualizers.model_debriefing.TreeModelDebriefing

Bases: object

Visualize tree model.

Examples

Create TreeModelDebriefing Instance and the model is stored in the table PAL_DT_MODEL_TBL:

>>> treeModelDebriefing = TreeModelDebriefing()

Visualize Tree Model in JSON format:

>>> treeModelDebriefing.tree_debrief(PAL_DT_MODEL_TBL)
_images/json_model.png

Visualize Tree Model in DOT format:

>>> treeModelDebriefing.tree_parse(PAL_DT_MODEL_TBL)
>>> treeModelDebriefing.tree_debrief_with_dot(PAL_DT_MODEL_TBL)
_images/dot_model.png

Visualize Tree Model in XML format the model is stored in the table PAL_RDT_MODEL_TBL:

>>> treeModelDebriefing.tree_debrief(PAL_RDT_MODEL_TBL)
_images/xml_model.png

Methods

shapley_explainer(predict_result, ...[, ...])

Create Shapley explainer to explain the output of machine learning model.

tree_debrief(self, model)

Visualize tree model by data in JSON or XML format.

tree_debrief_from_file(path)

Visualize tree model by a DOT, JSON or XML file.

tree_debrief_with_dot(self, model)

Visualize tree model by data in DOT format.

tree_export(self, model)

Export tree model as a JSON or XML file.

tree_export_with_dot(self, model)

Export tree model as a DOT file.

tree_parse(self, model)

Transform tree model content using DOT language.

tree_debrief(self, model)

Visualize tree model by data in JSON or XML format.

Parameters
modelDataFrame

Tree model.

Returns
JSON or XML Component

This object can be rendered by browser.

tree_debrief_with_dot(self, model)

Visualize tree model by data in DOT format.

Parameters
modelDataFrame

Tree model.

Returns
SVG Component

This object can be rendered by browser.

tree_parse(self, model)

Transform tree model content using DOT language.

Parameters
modelDataFrame

Tree model.

tree_export(self, model)

Export tree model as a JSON or XML file.

Parameters
modelDataFrame

Tree model.

Returns
Interactive Text and Button Widgets

Those widgets can be rendered by browser.

tree_export_with_dot(self, model)

Export tree model as a DOT file.

Parameters
modelDataFrame

Tree model.

Returns
Interactive Text and Button Widgets

Those widgets can be rendered by browser.

static tree_debrief_from_file(path)

Visualize tree model by a DOT, JSON or XML file.

Parameters
pathString

File path.

Returns
SVG, JSON or XML Component

This object can be rendered by browser.

static shapley_explainer(predict_result: hana_ml.dataframe.DataFrame, predict_data: hana_ml.dataframe.DataFrame, key, label, predict_reason_column='REASON_CODE')

Create Shapley explainer to explain the output of machine learning model.

It connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions.

Parameters
predict_resultDataFrame

Predicted result.

predict_dataDataFrame

Predicted dataset.

keystr

Name of the ID column.

labelstr

Name of the dependent variable.

predict_reason_columnstr
Predicted result, structured as follows:
  • column : REASON CODE, valid only for tree-based functionalities.

Returns
ShapleyExplainer

Shapley explainer.

hana_ml.visualizers.dataset_report

class hana_ml.visualizers.dataset_report.DatasetReportBuilder

Bases: object

The DatasetReportBuilder instance can analyze the dataset and generate a report in HTML format.

The instance will call the dropna method of DataFrame internally to handle the missing value of dataset.

The generated report can be embedded in a notebook, including:

  • Overview
    • Dataset Info

    • Variable Types

    • High Cardinality %

    • Highly Skewed Variables

  • Sample
    • Top ten rows of dataset

  • Variables
    • Numeric distributions

    • Categorical distributions

    • Variable statistics

  • Data Correlations

  • Data Scatter Matrix

Examples

Create a DatasetReportBuilder instance:

>>> from hana_ml.visualizers.dataset_report import DatasetReportBuilder
>>> datasetReportBuilder = DatasetReportBuilder()

Assume the dataset DataFrame is df and then analyze the dataset:

>>> datasetReportBuilder.build(df, key="ID")

Display the dataset report as a notebook iframe.

>>> datasetReportBuilder.generate_notebook_iframe_report()
_images/dataset_report_example.png

Methods

build(self, data, key, scatter_matrix_sampling)

Build a report for dataset.

generate_html_report(self, filename)

Save the dataset report as a html file.

generate_notebook_iframe_report(self)

Render the dataset report as a notebook iframe.

build(self, data, key, scatter_matrix_sampling: hana_ml.algorithms.pal.preprocessing.Sampling = None)

Build a report for dataset.

Parameters
dataDataFrame

DataFrame to use to build the dataset report.

keystr

Name of ID column.

scatter_matrix_samplingSampling, optional

Scatter matrix sampling.

generate_html_report(self, filename)

Save the dataset report as a html file.

Parameters
filenamestr

Html file name.

generate_notebook_iframe_report(self)

Render the dataset report as a notebook iframe.

hana_ml.visualizers.shap

This module represents an explainer for Shapley values.

The following class is available:

class hana_ml.visualizers.shap.ShapleyExplainer(predict_result: hana_ml.dataframe.DataFrame, predict_data: hana_ml.dataframe.DataFrame, key, label, predict_reason_column='REASON_CODE')

Bases: object

SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain the output of machine learning model.

It connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions.

Parameters
predict_resultDataFrame

Predicted result.

predict_dataDataFrame

Predicted dataset.

keystr

Name of the ID column.

labelstr

Name of the dependent variable.

predict_reason_columnstr
Predicted result, structured as follows:
  • column : REASON CODE, valid only for tree-based functionalities.

Methods

shap_values(self)

Get Shapley values.

summary_plot(self[, print_plot_details])

Global Interpretation using Shapley values.

shap_values(self)

Get Shapley values.

Returns
numpy.ndarray

Shapley values.

summary_plot(self, print_plot_details=False)

Global Interpretation using Shapley values.

To get an overview of which features are most important for a model we can plot the Shapley values of every feature for every sample.

Parameters
print_plot_detailsbool, optional

Specifies whether to show plotting details.

Defaults to False.

Returns
Image Component

This object can be rendered by browser.

hana_ml.visualizers.unified_report

This module is to build report for PAL/APL models.

The following class is available:

  • unified_report

class hana_ml.visualizers.unified_report.UnifiedReport(obj)

Bases: object

The report generator for PAL/APL models. Currently, it only supports UnifiedClassification and UnifiedRegression.

Examples

Data used is called diabetes_train.

Case 1: UnifiedReport for UnifiedClassification is shown as follows:

>>> from hana_ml.algorithms.pal.model_selection import GridSearchCV
>>> from hana_ml.algorithms.pal.model_selection import RandomSearchCV
>>> hgc = UnifiedClassification('HybridGradientBoostingTree')
>>> gscv = GridSearchCV(estimator=hgc,
>>>                     param_grid={'learning_rate': [0.1, 0.4, 0.7, 1],
>>>                                 'n_estimators': [4, 6, 8, 10],
>>>                                 'split_threshold': [0.1, 0.4, 0.7, 1]},
>>>                     train_control=dict(fold_num=5,
>>>                                        resampling_method='cv',
>>>                                        random_state=1,
>>>                                        ref_metric=['auc']),
>>>                     scoring='error_rate')
>>> gscv.fit(data=diabetes_train, key= 'ID',
>>>          label='CLASS',
>>>          partition_method='stratified',
>>>          partition_random_state=1,
>>>          stratified_column='CLASS',
>>>          build_report=True)

To look at the dataset report:

>>> UnifiedReport(diabetes_train).build().display()
_images/unified_report_dataset_report.png

To see the model report:

>>> UnifiedReport(gscv.estimator).display()
_images/unified_report_model_report_classification.png

We could also see the Optimal Parameter page:

_images/unified_report_model_report_classification2.png

Case 2: UnifiedReport for UnifiedRegression is shown as follows:

>>> hgr = UnifiedRegression(func = 'HybridGradientBoostingTree')
>>> gscv = GridSearchCV(estimator=hgr,
                        param_grid={'learning_rate': [0.1, 0.4, 0.7, 1],
                                    'n_estimators': [4, 6, 8, 10],
                                    'split_threshold': [0.1, 0.4, 0.7, 1]},
                        train_control=dict(fold_num=5,
                                           resampling_method='cv',
                                           random_state=1),
                        scoring='rmse')
>>> gscv.fit(data=diabetes_train, key= 'ID',
         label='CLASS',
         partition_method='random',
         partition_random_state=1,
         build_report=True)

To see the model report:

>>> UnifiedReport(gscv.estimator).display()
_images/unified_report_model_report_regression.png

Methods

build(self[, key])

Build the report.

display(self[, save_html, metric_sampling])

Display the report.

build(self, key=None, scatter_matrix_sampling: hana_ml.algorithms.pal.preprocessing.Sampling = None)

Build the report.

Parameters
keystr, valid only for DataFrame

Name of ID column.

Defaults to the first column.

scatter_matrix_samplingSampling, valid only for DataFrame

Scatter matrix sampling.

Defaults to 1000 random sample points.

display(self, save_html=None, metric_sampling=False)

Display the report.

Parameters
save_htmlstr, optional

If it is not None, the function will generate a html report and stored in the given name.

Defaults to None.

metric_samplingbool, optional

Whether the metric table needs to be sampled. It is only valid for UnifiedClassification and used together with UnifiedClassification.set_metric_samplings.

Defaults to False.