Use the visualize() function to visualize the data using various plots such as heatmap, pair plot, histogram, univariate plot, count plot, box plot, and target distribution.
Required Parameters
- data
- Specifies the input teradataml DataFrame for plotting.
- target_column
- Specifies the name of the target column in "data"."target_column" must be of numeric type.
Optional Parameters
- plot_type
- Specifies the type of plot to be displayed.Permitted values:
- "heatmap": Displays a heatmap of feature correlations.
- "pair": Displays a pair plot of features.
- "density": Displays a density plot of features.
- "count": Displays a count plot of categorical features.
- "box": Displays a box plot of numerical features.
- "target": Displays the distribution of the target variable.
- "all": Displays all the plots.
Default value: "target"
- length
- Specifies the length of the plot.
Default value: 10
- breadth
- Specifies the breadth of the plot.
Default value: 8
- columns
- Specifies the column names to be used for plotting.
- max_features
- Specifies the maximum number of features to be used for plotting.
Default value: 10
It applies separately to categorical and numerical features. - problem_type
- Specifies the type of problem.Permitted values:
- 'regression'
- 'classification'
Example setup
Import either of AutoML or AutoClassifier or AutoRegressor or AutoDataPrep from teradataml.
>>> from teradataml import AutoML
>>> from teradataml import DataFrame
>>> load_example_data("teradataml", "titanic")
>>> titanic_data = DataFrame("titanic")
Example 1: Visualize the data using AutoML class
>>> AutoML.visualize(data = titanic_data, ... target_column = 'survived', ... plot_type = ['heatmap', 'pair', 'histogram', 'target'], ... length = 10, ... breadth = 8, ... max_features = 10, ... problem_type = 'classification')
Example 2: Visualize the data using AutoDataPrep class
>>> from teradataml import AutoDataPrep >>> obj = AutoDataPrep(task_type="classification") >>> obj.fit(data = titanic_data, target_column = 'survived')
Retrieve the data from AutoDataPrep object
>>> datas = obj.get_data() >>> AutoDataPrep.visualize(data = datas['lasso_train'], ... target_column = 'survived', ... plot_type = 'all' ... length = 20, ... breadth = 15)