transfer variables "Linear Regression Learner Node" to "Table View-Node"

Hello, How can I transfer the result of the “Linear Regression Learner Node” with “Multiple R-Squared” and “Adjusted R-Squared” into the “Table View-Node”.

Basically I want to display all values of “View:Linear Regression Result view” via the "Table View node.

Hmm…
The only way I know of is attaching the “Numeric Scorer” node to the Regression Predictor node. E.g.:
image

But that does not get you the Adjusted R-Squared value.

Alternatively, I would recommend doing your regression in an R-Snippet node and outputting the results as a data frame. (Use the table-to-R node to set up the regression, then the R-to-table node to get the results back into the workflow loop.)

1 Like

Thanks @Snowy, could you share a short example workflow (using the R-Node example you mentioned), I’m honestly a bit overwhelmed…

What does “all values” actually contain?
The bottom output of Linera Regression Learner gives you P Values and other statistics
br

Here you go @wkoenig
Hopefully this is enough to get your started… regression_output.knwf (35.9 KB)

There are better ways to do this I’m sure, but most of the examples I saw required additional packages (what doesn’t need a package in R?!). This is just with base R. You could probably get creative and concatenate them into a single table if you would like, but I’ll leave the rest to you :slight_smile:

If you need anything more complex, I might suggest the Broom package: broom: a package for tidying statistical models into data frames | R-bloggers

2 Likes

The Idea is to vizualize all Values (eg “Multiple R-Squared” and “Adjusted R-Squared”) of the “Linera Regression Learner” in a dashboard via a widget…

Thanks for explaining it. Does the provided solution help?
br

I have not tested the solution (with R), because I want to realize everything directly in Knime and
don’t want to get into the dependency hell.
–>If there is a direct solution in Knime, then I would be grateful if I could get another suggestion for this.

I did a re-implementation with KNIME. Luckily, the adjusted R^2 is a relatively “simple” calculation:

The computation is hidden away in the component and should be relatively flexible w.r.t changes of the target column.

Best regards,
Stefan

2 Likes

Thank you @stelfrich for this solution. But if there are missing values in my dataset, then the node “Enhanced Numeric Scorer” does not work.
And the following error message appears: §Execute failed: Missing value in prediction column in row: Row23".
(the node “Linear Regression Learner” works without problems with the data set and outputs also R2 etc.).
Can you give me a hint how to get the “Enhanced Numeric Scorer” to work despite missing values?

It does if you configure it to just ignore the rows with missing values, like this:

Unfortunately, I don’t have enough time to look into making the component more robust right now. You can, however, use the Missing Value node to remove the rows that contain missing values before feeding them to the Enhanced Numeric Scorer component. Ideally, you would configure the node such that it removes all the rows that have missing values in the feature columns:

Best,
Stefan

2 Likes

And a short follow-up: We are already working on an updated version of the Numeric Scorer node that computes the adjusted R^2.

2 Likes