Running Reports (Using R)

Running Reports (Using R)

Intellicus supports performing Data Science operations at two levels:

  • Query Object level: Enables data transformation and modeling before reporting.

  • Report level: Allows predictive analysis and What-If simulations directly in reports.

Once a Data Science Engine step is added at the Query Object level and the modular script is defined, Intellicus enables prediction features while running the report.

Running Reports with Data Science Engine Step

After setting up the Query Object with the Data Science Engine step, run the report. If configured correctly, you will see the Machine Learning Operations toolbar.

Machine Learning Operations Toolbar

This toolbar allows you to choose between:

  • Prediction Only: Uses the last trained model to generate predictions.

  • Training and Prediction: Trains the model on the current dataset and then generates predictions.

You can check the Save Values for Next Run option to retain your selection for future executions.

Performing Predictive Analytics

Intellicus enables business users to perform predictive analytics at the report level without modifying the data schema. This is most useful when predictions are derived using existing fields without adding new columns.

Turn on Edit Mode in Smart View reports to access Predictive Analytics options.

Predictive Analytics and What-If Analysis Tabs

Click the Predictive Analytics tab to open the configuration area.

Predictive Analytics Panel

Options in Predictive Analytics

Option

Description

Option

Description

Fields

Lists report fields available for prediction. Select a field to add a script.

Prediction Script

Write the R script used for the prediction of the selected field.

What-if Variable Source

Select how to provide independent variable values: Auto or Data Source.

What-if Variable Source Options

Option

Description

Option

Description

Auto

Intellicus analyzes historical trends. Provide several prediction units.

Data Source

Select a Query Object with independent variable values. Write the script accordingly.

After writing the script, click Verify to check for errors. Click OK to save.

Guidelines for Writing a Script at the Report Level

To ensure Intellicus can parse and execute your predictive script:

  • Use the following modular sections:

    • #<%META.SECTION%> – Define independent variables

    • #<%TRAINING.SECTION%> – Define training logic

    • #<%PREDICTION.SECTION%> – Define prediction logic

  • Declare independent variables (numeric or categorical) under #<%META.SECTION%> as comma-separated fields.

    • Use appropriate aggregation functions, e.g.,
      #SUM(Marketing_Spent),SUM(R&D_Spent)

  • The first line in the Training and Prediction sections must read CSV data:
    read.csv('<%ThisControl.ReadData%>')

  • The model must be saved as myModel.

  • The training script is optional if a trained model is available, but the Prediction script is mandatory.

For categorical variables, handle encoding/decoding explicitly in both training and prediction logic.

Sample Script

#<%META.SECTION%> SUM(RnD_Spent) #<%TRAINING.SECTION%> dataset = read.csv('<%ThisControl.ReadData%>') for(i in 1:(ncol(dataset))) { dataset[is.na(dataset[,i]), i] <- mean(dataset[,i], na.rm = TRUE) } library(randomForest) myModel = lm(Target.Profit ~ RnD_Spent, data = dataset)

Performing What-If Analysis

Intellicus allows you to simulate business outcomes using What-If Analysis. This feature helps users explore different scenarios by adjusting independent variables and visualizing the impact on predictions.

To perform a What-If analysis:

  1. In Filters, go to the What-if tab.

  2. Adjust variable values using the sliders or manually enter values.

    • Positive values increase the variable.

    • Negative values decrease it.

What-if Analysis Tab

For example, increasing the temperature by 20% (from 20°C) will adjust it to 24°C and display the prediction accordingly.

Click Apply to view updated predictions in the report.

Copyright Intellicus Technologies Pvt. Ltd. All rights reserved.