PLS example code

Hi,

I would like to use the R Integration nodes to build a PLS model, but need an example code to get started. Is the an example of PLS modeling using the Interactive R Statistics Integration nodes (not using the deprecated nodes)?

Thanks,

Evert

Hi Evert,

To build an R PLS model in KNIME you can use the "R Learner" node with the following code inside:

library(pls)

pls.fit=plsr(response~., data=knime.in) 

summary(pls.fit)
knime.model<-pls.fit

Consider that this lines of code produce a R PLS model for the prediction of column named "response" using all the other columns present as input in knime node. You have to replace "response" with the name of the column you would like to model. Additionally with the command "summary(pls.fit)" you can see the R log pushing the "Eval script" button inside the node configuration.

Finally you can modify the "pls.fit" code line to customize your model (e.g. use a different number of LVs respect the default one, scale the variables, etc.)

The "R Learner" node can then be connected to an "R Predictor" one in order to predict the modeled response.

I hope this help,

Gio