Icon

04 Analyze Linear Regression

Analyze Data by Training a Linear Regression model for House Price Prediction

This workflow is an example of how to train a basic machine learning model - Linear Regression for a house price prediction task


If you want to give your acquired knowledge a test run, take a look at the Just KNIME It challenges. (Just KNIME It Link provided in External resources section of this workflow)

URL: Behind the Scenes of Linear Regression with KNIME - KNIME TV - YouTube https://www.youtube.com/watch?v=FnxeMpHQMuY
URL: KNIME Cheat Sheet : Building a KNIME Workflow for Beginners https://www.knime.com/sites/default/files/2021-07/CheatSheet_Beginner_A3.pdf
URL: KNIME Self Paced Course https://www.knime.com/knime-self-paced-courses
URL: Just KNIME It Challenges https://www.knime.com/just-knime-it

Pre-processing (data preparation)

Partition the data into training set (80%) and test set (20%).

Model evaluation

Apply the trained Linear Regression to the test set with the Regression Predictor node. Evaluate the prediction using the Numeric Scorer node.

Model training


Train the Linear Regression with the Linear Regression Learner node.

Read data

The data contains various attributes about different houses and their price.

How to train a Linear Regression model?

Step 1: Drag the "Linear Regression Learner" node and double click to open the dialog.

Step 2: Select the "Target" Column as "SalesPrice".

Step 3: RIght Click on the node and select "Execute and Open View" to train the model and to get a view of the Regression Co-efficients.

How to evaluate a Linear Regression model?

Step 1: Drag the "Regression Predictor" node.

Step 2: Connect the output of "Linear Regression Learner" node to model input port and Test Dataset to data input port. Execute the node.

Step 3: Connect the Predictor Output to "Missing Value" node to remove rows with missing prediction and then connect it to "Scorer" node to evaluate the model on various evaluation measures.

Analyze Data by Training a Linear Regression


This workflow is an example of how to train and evaluate a basic machine learning model for a house price prediction task.

In this case, we train and apply a Linear Regression algorithm. However, the Learner-Predictor construct is common to all supervised algorithms.

Workflow complete!

Keep the momentum going by exploring Just KNIME It!on the Hub to challenge yourself and see how these nodes can be integrated into more complex workflows and use cases.

Target:SalePrice
Linear Regression Learner
Port 0: Train Set (70%) Port 1: Test Set (30%)
Table Partitioner
Apply trainedLinear Regression
Regression Predictor
ReadAmesHousing_simple.csv
CSV Reader
Evaluate modelquality and performance
Numeric Scorer
Remove datawithout prediction
Missing Value

Nodes

Extensions

Links