Skip to content

Mission 12 - Regression Revisited

Estimated time for completing this mission: 20 mins

Learning Objective

Using LOGIBLOX to create a Regression model business app.

Scenario

Imagine that you have to create a regression analysis model for someone who has never seen a regression model so you want to present different plots and results in an easily interpretable way. In this task, we will show the tools for that using LOGIBLOX.

BLOX used in this mission:

Logic BLOX

  • MyData/FinalData
  • Database/First Rows
  • Database/Group By
  • AI/Regression
  • Charts/Chart Dataset
  • Charts/Multi Charts

App BLOX

  • Chart
  • Panel
  • Input
  • Button
  • Textfield

Data

The same data set will be used as for the previous exercise. In case you do not have the data set you can download it here: FinalData.xlsx

Steps

Please refer to the Navigation Guide to perform the steps below

App Designer:

Regression Revisited

  1. Import dataset from Data section to Module4 folder
  2. In Module4 create new app named Regression revisited
  3. Include all the BLOX which are mentioned in the description above as App BLOX
  4. Make the "panel" BLOX large enough to fit two "chart" BLOX in it
  5. In the "input" BLOX write a title for the dashboard
  6. Below the first "chart" BLOX, insert an "input" BLOX and name is accuracy
  7. Next to it, put a "text field" BLOX
  8. Once the layout of the app is done (see image below for help), create a new logic by clicking on the flask icon on your current page
  9. Name the new logic "Regression"
  10. Make the compositions of logic as seen on the images below
  11. In the "First row" BLOX specify the number of row to 200
  12. In the "Group By" BLOX, use the "ORDERDATE" and the "average" command
  13. In the regression model function specify Features as "ORDERDATE" Target as "SALES" exponential degree as quadratic, "x is time series" is yes and give a name to the model (Preferably "Linear Model 3")
  14. Then on the first "Chart data" BLOX specify "X" as x, "y" as y_pred, label as "Prediction", chose a color and "Chart type" as line
  15. On the other one specify "X" as x, "y" as y, label as "True Value", chose a color and "Chart type" as scatter
  16. Then in BLOX "Multi Chart" tick yes on "Show Legend", "Tilt Axis" and "Continuous x"
  17. As a last step run the app and then clicking on the "Button" page BLOX will display the different results
  18. As your challenge, try to add to the existing app a graph that would compare degrees of regression (i.e. linear vs fifth power).
Hint Create new regression models using the same data BLOX as previously. Connect them to the chart datasets and finally to multi chart. Specify the powers in regression BLOX. Create new Graph element in App Designer and connect it with Multichart BLOX in logic view.
End Result of Comparing Regressions

startBlox

Layout composition

startBlox

Logic composition

Results and Summary

startBlox

Resulting Chart 1

startBlox

Resulting Chart 2

The first chart displays the true values and the predicted regression line.

Whereas the second chart, the true values are plotted against the predicted values hence, the model is better if the points are closer to the diagonal.

Well done! Now let's move on to the next mission!