Before You Begin
This 15-minute tutorial shows you how to use a CART predictive model, inspect the results of running the data flow to create the CART model, apply a predictive model to your dataset, and visualize the impact in a workbook.
Background
You can create a different predictive model using a classification and regression tree (CART) for numeric prediction with the random sample donation dataset. The CART predictive model classifies all the records in the dataset based on inputs and assigns an expected record for each class. In this tutorial, you use the CART model to predict the total donations.
You also score a dataset using the trained model by applying the predictive model. You run analysis and create visualizations using the predictive measure along with other metrics, dimensions, or dataset mash-ups.
This is the third tutorial in Train and Apply Predictive Models in Oracle Analytics. Read the tutorials in the order listed.
- Create a Random Sample Dataset and Train a Prediction Model
- Inspect and Modify the Prediction Model
- Apply a Predictive Model
What Do You Need?
- Oracle Analytics
When using Oracle Analytics Desktop, you must install machine learning (DVML) to use Diagnostics Analytics (Explain), Machine Learning Studio, or advanced analytics.
- Access to the following:
- elastic_train_df data flow
- sample_donation_data dataset
- donations_random_sample workbook
Modify the Predictive Model
- On the Home page, click Data, enter
elastic_train_df
in the Search bar, and then click Search. - In the elastic_train_df, click the Actions
, and then select Open.
Description of the illustration donations_elast1_n2.png - In the data flow, click the Train Numeric Prediction step.
- In Train Numeric Prediction, click Elastic Net Linear Regression for model training in the Model Training Script row.
- In Select Train Numeric Prediction Model Script, click CART for Numeric Prediction training, and then click OK.
- In Train Numeric Prediction, click Select a column in the Target row, and then select TOTAL_DONATIONS from Available Data.
- Click the Save Model step. In Save Model, enter
cart_model_1
. Click Save. - Click Run Data Flow
.
Review the CART Model Related Datasets
- Click Go back
. On the Home page, click Machine Learning.
- In the cart_model_1, click the Actions
, and then select Inspect.
- In cart_model_1, click Quality to see the distribution of residual values and overall statistics.
Description of the illustration cart_model_quality.png - Click Related to view the generated datasets.
- Click Close.
Add the CART Scenario to the Workbook
- On the Home page, enter
donations_random_sample
workbook, and then click Search. - In the
donations_random_sample
workbook, click the Actions, and then select Open.
- If the visualization contains multiple TOTAL_DONATIONS lines, right-click elastic_model_1 in the Data panel, and then select Remove From Workbook. In Remove Scenario, click Yes.
The TOTAL_DONATIONS by POSTED_DATE line visualization refreshes to remove the prediction line related to the scenario.
Description of the illustration elastic_model1_removed.png - In the Data panel, click Add
, and then select Create Scenario.
- In Create Scenario, select cart_model_1, and then click OK.
- In the Data panel, expand the cart_model_1 node. Select TOTAL_DONATIONS, and then drag it to Values (Y-Axis) in the Grammar panel.
The CART numeric prediction model produces results similar to the elastic model.
Description of the illustration cart_model_total_donations.png - Click Save.
Review CART Numeric Model Segments
- Click Add Canvas
. In the Data panel under the cart_model_1 node, select and drag Segments to Canvas 2.
The CART model segment objects show the leaf branches of the tree.
Description of the illustration cart_model_segments.png - In the Data panel under the cart_model_1 node, select and drag TOTAL_DONATIONS to Rows in the Grammar panel.
The table shows the distribution of donations to the CART branches.
Description of the illustration segments_total_donations.png
Modify the CART Model
- Click Go back
. In Save Changes, click Don't Save.
- On the Home page, enter
elastic_train_df
, and then click Search. - In the elastic_train_df, click the Actions, and then select Open.
- In the data flow, click the Train Numeric Prediction step.
- In Maximum Depth, click the up arrow to increase the value to 7.
- Click the Save Model step. In Save Model, enter
cart_model_2
.Description of the illustration elastic_train_df.png - Click Run Data Flow.
- On the Home page, enter
donations_random_sample
workbook, and then click Search. In thedonations_random_sample
workbook, click the Actions, and then select Open.
- In the Data panel, click Add
, and then select Create Scenario. In Create Scenario, select cart_model_2, and then click OK.
- Click Canvas 1, in the Data panel expand the cart_model_2 node. Select TOTAL_DONATIONS and drag it to Values (Y-Axis) in the Grammar panel.
The results are similar to the other prediction models.
Description of the illustration cart_model2_donations.png - Click Add Canvas
. In the Data panel under the cart_model_2 node, select and drag Segments to Canvas 2.
- In the Data panel under the cart_model_2 node, select and drag TOTAL_DONATIONS to Rows in the Grammar panel.
Increasing the maximum depth in cart_model_2 provides more granular leaf levels in the tree.
Description of the illustration cart_model_2_segments.png
Score a Dataset
- Click Go back
. On the Home page, click Create, and then select Data Flow. In Add Dataset, select sample_donation_data, and then click Add.
- Double-click Apply Model in the Data Flow Steps panel. In Select Model, click cart_model_1, and then click OK.
- Double-click Save Dataset to add it to the data flow. In Save Dataset, enter
scored_donation_dataset
in Name. - Click Save, and select Save As. In Save Data Flow As, enter
scored_donation_dataset_df
, and then click OK. - Click Run Data Flow
.
Create a Workbook with the Scored Dataset
- Click Go back
. On the Home page, click Create and click Workbook.
- In Add Dataset, click scored_donation_dataset, and then click Add to Workbook.
- In the Data panel, hold down the Ctrl key select PredictedValue and TOTAL_DONATIONS and DATE_POSTED. Right-click, select Pick Visualization, and then select Line.
- Select TOTAL_DONATIONS and move it to Values (Y-Axis) in the Grammar panel.
Description of the illustration predictivevalue_viz.png - Right-click DATE_POSTED in the Grammar panel, select Show by, and then select Quarter.
Description of the illustration predictive_viz_by_qtr.png - Select SCH_METRO in the Data panel and drag it to Trellis Columns in the Grammar panel.
Description of the illustration predictive_sch_metro.png
Learn More
Apply a Predictive Model in Oracle Analytics
F27838-07
July 2025
Learn how to create and apply a predictive model in Oracle Analytics.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial computer software" or "commercial computer software documentation" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the license contained in the applicable contract. The terms governing the U.S. Government's use of Oracle cloud services are defined by the applicable contract for such services. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc, and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.