Icon

05 Machine Learning

Machine Learning - Exercise

This workflow shows a hands-on exercise in the L1-DS Introduction to KNIME Analytics Platform for Data Scientists - Basics course

Task 1: Linear Regression1. Read the adult_joined.table file by executing the Table Reader and Missing Value nodes2. Partition the data into a training set (75 %) and test set (25 %). Draw randomly.3. Train a linear regression model on the training set to predict the weekly working hours. Use all other columns except the"ID" column for the prediction.4. Apply the model to the test set5. Evaluate the performance of the linear regression model with the Numeric Scorer node Task 2: Decision Tree Model1. Use the same dataset as in task 1 and partition it into a training set (75%) and a test set (25%). Apply stratified samplingto the income column.2. Train a decision tree model on the training set to predict whether or not a person earns more than 50K per year3. Apply the model to the test set4. Evaluate the accuracy of the model with scoring metrics5. Open the configuration dialog of the Scorer (JavaScript) node and exclude those statistics from the class predictionstatistics table that are also present in the confusion matrix. Display the number of rows in the confusion matrix. 6. Evaluate the performance of the model with an ROC curve7. OPTIONAL: Try out other parameter settings to reach a better performance. For example, change the quality measure,pruning method, or minimum number of records. Top: train set (75%)Bottom: test set (25%)Random samplingRead data adult_joined.tableTraining set to predict the weekly working hoursTest SetEvaluating performanceRead data adult_joined.tableTop: train set (75%)Bottom: test set (25%)Stratifies sampling "income"Training setTest setScoring metrics Partitioning Missing Value Table Reader Linear RegressionLearner RegressionPredictor Numeric Scorer Table Reader Partitioning DecisionTree Learner Decision TreePredictor Scorer (JavaScript) ROC Curve Task 1: Linear Regression1. Read the adult_joined.table file by executing the Table Reader and Missing Value nodes2. Partition the data into a training set (75 %) and test set (25 %). Draw randomly.3. Train a linear regression model on the training set to predict the weekly working hours. Use all other columns except the"ID" column for the prediction.4. Apply the model to the test set5. Evaluate the performance of the linear regression model with the Numeric Scorer node Task 2: Decision Tree Model1. Use the same dataset as in task 1 and partition it into a training set (75%) and a test set (25%). Apply stratified samplingto the income column.2. Train a decision tree model on the training set to predict whether or not a person earns more than 50K per year3. Apply the model to the test set4. Evaluate the accuracy of the model with scoring metrics5. Open the configuration dialog of the Scorer (JavaScript) node and exclude those statistics from the class predictionstatistics table that are also present in the confusion matrix. Display the number of rows in the confusion matrix. 6. Evaluate the performance of the model with an ROC curve7. OPTIONAL: Try out other parameter settings to reach a better performance. For example, change the quality measure,pruning method, or minimum number of records. Top: train set (75%)Bottom: test set (25%)Random samplingRead data adult_joined.tableTraining set to predict the weekly working hoursTest SetEvaluating performanceRead data adult_joined.tableTop: train set (75%)Bottom: test set (25%)Stratifies sampling "income"Training setTest setScoring metrics Partitioning Missing Value Table Reader Linear RegressionLearner RegressionPredictor Numeric Scorer Table Reader Partitioning DecisionTree Learner Decision TreePredictor Scorer (JavaScript) ROC Curve

Nodes

Extensions

Links