Switches • A switch allows you to selectively activate branches of a workflow • Inactive branches are marked with a red x on their output ports. Inactive nodes propagate down stream. Inactive Active Copyright © 2017 KNIME AG 12 201 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Node: Rule Engine/Rule Engine Variable • Define custom logic to using simple rules. • Rules like: <Antecedent> => <Consequence> • (1=1 => “true”) • May be used in flow variables or tables • Easiest way to encode logic for switches Copyright © 2017 KNIME AG 13 202 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Node: If Switch • Control which branches of your workflow are active programatically. • Controlled with a flow variable, setting the value to the literal strings: “top”, “bottom”, “both” • May be used in flow variables or tables (different nodes) Copyright © 2017 KNIME AG 14 203 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Workflow Control Exercise, Activity III Starting with exercise: Workflow Control, Activity III • Read the data file: CurrentDetailData.table • Use a Single Input Quickform to let a user choose the values “scatter” or “bar” • Use a Rule Engine Variable node to convert that into a format readable by an IF Switch (“top” or “bottom”) • Use an IF Switch to create either a scatter plot or a bar plot depending on the input. Copyright © 2017 KNIME AG 15 204 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Try-catch • A way to catch errors in workflows. • Useful when it is hard to know if a node will execute (for example, when connecting to a web service). • KNIME tries to execute the nodes, but if it fails will fall back to an alternate branch. Copyright © 2017 KNIME AG 16 205 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Streaming • Standard execution: Node by node. Node processes all data, finishes, then passes data to next node, etc. • Streaming: Nodes executed concurrently, each nodes passes data to the next as soon as it is available, i.e. before node is fully executed – Faster execution, esp. for reading/preprocessing data • Create wrapped metanode -> Configure -> Job Manager Selection -> Simple Streaming – Not available for all nodes (show in node repository) – Can only execute entire metanode, not individual nodes – Intermediate results not available since nothing is cached Copyright © 2017 KNIME AG 17 206 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Streaming Copyright © 2017 KNIME AG 18 207 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Advanced Data Mining Random Forest, Tree Ensembles, Parameter Optimization, Cross Validation 1 208 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Nodes: Random Forest • Ensemble learning method for classification and regression tasks • It consists of a chosen number of decision trees • Each of the decision tree models is learned on a different set of rows (records) and a different set of columns (describing attributes) 2 209 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
KNIME’s Tree Ensemble models The general idea is to take advantage of the “wisdom of the crowd”: combining predictions from a large number of weak predictors leads to a more accurate predictor. This is called ”bagging”. X 1 4 …1 52 27 76 39 5 7 29 6 7 68 9 3 P1 P2 … Pn Typically: for classification the individual models vote and the y majority wins; for regression, the individual predictions are averaged 3 Copyright © 2017 KNIME AG 210 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
How does bagging work? Pick a different random subset of the training data for each model in the ensemble (bag). … Build tree Build tree Build tree 1 4 … 1 52 57 76 29 6 7 28 9 3 39 5 7 4 211 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
An extra benefit of bagging: out of bag estimation Allows testing the model using the training data: when validating, each model should only vote on data points that were not used to train it X1 X2 1 4 …1 1 4 …1 52 27 76 52 27 76 39 5 7 39 5 7 29 6 7 68 9 3 29 6 7 68 9 3 P1 P2 … Pn P1 P2 … Pn y1OOB y2OOB 5 212 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Random Forests Build tree • Bags of decision trees, but an extra 1 element of randomization is applied 52 when building the trees: each node in 29 6 7 the decision tree only “sees” a subset of the input columns, typically ������. • Random forests tend to be very robust w.r.t. overfitting (though the individual trees are almost certainly overfit) • Extra benefit: training tends to be much faster 6 213 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Nodes: Random Forest • The output model describes a random forest and is applied in the corresponding predictor node using a simple majority vote. • Tree Ensemble Learner node provides more functionalities 7 214 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Gradient Boosting • Another algorithm for creating ensembles of decision trees • Starts with a tree built on a subset of the data • Builds additional trees to fit the residual errors • Typically uses fairly shallow trees • Can introduce randomness in choice of data subsets (“stochastic gradient boosting”) and in variable choice. 8 215 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Out-of-bag vs. leave out model scoring Results from predicting quality of white wine 9 216 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Tree Ensembles • Random Forest variant • More options to set • Trees may be trained using subsets of rows and/or columns and this approach may lead to greater accuracy. Copyright © 2017 KNIME AG 10 217 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Tree Ensembles • Optimization of a tree ensemble is complex due to a surplus of configuration options (number of models, number of columns, number of rows, tree depth etc.) Copyright © 2017 KNIME AG 11 218 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Nodes: Tree Ensemble Learner/Predictor • Choose which columns to include • Configure a prototype tree (depth, split criteria etc.) • Setup ensemble parameters (model count, row/column subsampling) Copyright © 2017 KNIME AG 12 219 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Advanced Data Mining Exercise, Activity I Starting with exercise: Advanced Data Mining, Activity I • Read the data file CurrentDetailData.table • Partition the data 50/50 using stratified sampling on the Products column • Create a Tree Ensemble model to predict the “Products” column • Use a tree depth of 5, 50 models, and 75% of rows and columns for each iteration. • Calculate the overall accuracy of the model and filter that value into a flow variable. Copyright © 2017 KNIME AG 13 220 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Parameter Optimization • Some modeling approaches are very sensitive to their configuration. • Calculating optimum settings is not always possible. • Parameter Optimization loops may help find a good configuration Copyright © 2017 KNIME AG 14 221 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Node: Parameter Optimization Loop Start • Define some parameters to optimize • Set upper/lower bounds and step sizes (and flag integers) • Choose an optimization method • Brute force for maximum accuracy but slower computation • Hill climbing for better faster runtimes but may get stuck in local optimum settings Copyright © 2017 KNIME AG 15 222 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Node: Parameter Optimization Loop End • Collects some value to optimize in a flow variable. • Value may be maximized (accuracy) or minimized (error) Copyright © 2017 KNIME AG 16 223 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Advanced Data Mining Exercise, Activity II Starting with exercise: Advanced Data Mining, Activity II • Add a parameter optimization loop to your Tree Ensemble Model • Use Hill climbing to determine the optimum number of models (min=10,max=200,step=10, int = yes) • Maximize the accuracy in the loop and node. • What were the optimal settings? (Hint: don’t forget to use the flow variable in your learner) Copyright © 2017 KNIME AG 17 224 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Cross Validation • Used to evaluate model stability. • Re-execute the modeling process many times using different data partitions. • Collect aggregated statistics on model accuracy Copyright © 2017 KNIME AG 18 225 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Example: Cross Validation • X-Partitioner X-Aggregator • X-Partitioner replaces Partition • X-Aggregator replaces Scorer • Can be used with any learner/predictor Copyright © 2017 KNIME AG 19 226 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Advanced Data Mining Exercise, Activity III Starting with exercise: Advanced Data Mining, Activity III • Create a 10-fold cross validation for your Tree Ensemble Learner. • Calculate the mean error for the cross validation. • Does the model seem stable? Copyright © 2017 KNIME AG 20 227 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Model Selection Compare and deploy 1 228 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Model Selection • We can build many models, but which should we use? • Probably the best one • Most accurate?, Best ROC?, Other criteria? • In this section we will: • Bring our models and performance indicators into a single table • Sort that table to choose the best model • Extract the best model and use it to make predictions 2 229 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Nodes: PMML to Cell/Cell to PMML • Insert PMML models to or extract them from a KNIME table cell. 3 230 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Node: Constant Value Column • Insert a constant value as a new column to the table 4 231 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
New Node: PMML Predictor • Score a table using a standard PMML model • No configuration required 5 232 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Model Selection Exercise Starting with exercise: Model Selection • Train a decision tree on all the data. • Partition and score the data as in the logistic regression example • Join this model to the accuracy from the scorer. • Label your model and concatenate this and other models together. • Convert the best scoring model back to a model port. • Predict new results for CurrentDetailData.table 6 233 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Supplemental Workflows 1 234 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining • Builds and scores model on uploaded data • Quickform nodes for stepwise configuration of workflow 1. Upload data file 2. Select target and features 3. Specify training / test fraction 4. Create downloadable PMML file 5. Report generation 2 235 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
WebPortal Enabled Data Mining 3 236 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining Execution on Server via WebPortal - 1 4 237 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining Execution on Server via WebPortal - 2 5 238 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining Execution on Server via WebPortal - 3 6 239 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining Execution on Server via WebPortal - 4 7 240 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining Execution on Server via WebPortal - 5 8 241 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Webportal Enabled Data Mining Execution on Server via WebPortal - 6 9 242 Licensed under a Creative Commons Attribution- ® Copyright © 2017 KNIME AG Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
RESTful Geolocation Try Catch Block REST call to get lat/long for IPs Copyright © 2017 KNIME AG 10 243 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
RESTful Geolocation • Translates IPs to geo coordinates via RESTful service • GET Resource: access RESTful API via GET • IP to geo coordinates (lat/lon) • Read REST Representation: parse REST result • JSON, XML, CSV, … • Try Catch nodes to log errors gracefully Copyright © 2017 KNIME AG 11 244 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Geographic Analysis Copyright © 2017 KNIME AG 12 245 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Geographic Analysis • Reads IPs from download weblog and related geo-coordinates • Aggregates downloads by city, country, and US states • OSM Map View to visualize geo-coordinates • OSM Map to Image to create image of map view Copyright © 2017 KNIME AG 13 246 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Text and Network Mining – KNIME Forums Create forum user interaction network Extract important terms, topics from forum sections Copyright © 2017 KNIME AG 14 247 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Text and Network Mining – KNIME Forums Copyright © 2017 KNIME AG 15 248 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Text and Network Mining – KNIME Forums • Crawls KNIME forums and creates report • Text Mining: tagging of users, topics, nodes • Text Mining: tag cloud creation • Network Mining: creation of user interaction networks • Network Mining: visualization of user networks Copyright © 2017 KNIME AG 16 249 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Open Session Copyright © 2017 KNIME AG 17 250 Licensed under a Creative Commons Attribution- ® Noncommercial-Share Alike license https://creativecommons.org/licenses/by-nc-sa/4.0/
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251