[R] Get Data Table from iml FeatureEffect Object

Sparks, John j@p@rk4 @end|ng |rom u|c@edu
Tue Mar 17 20:26:10 CET 2020


From my previous email:

"I tried str(eff) and class(eff), but I am not familiar with the structure of the object(s)."

--JJS

________________________________
From: Bert Gunter <bgunter.4567 using gmail.com>
Sent: Tuesday, March 17, 2020 2:22 PM
To: Sparks, John <jspark4 using uic.edu>
Cc: r-help using r-project.org <r-help using r-project.org>; christoph.molnar using gmail.com <christoph.molnar using gmail.com>
Subject: Re: [R] Get Data Table from iml FeatureEffect Object

?str

Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Mar 17, 2020 at 12:19 PM Sparks, John <jspark4 using uic.edu<mailto:jspark4 using uic.edu>> wrote:
Hi R-Helpers,

I have recently started working with the iml package (Interpretable Machine Learning)  and its associated material, which I generally find very helpful.

I want to recover some values out of the FeatureEffect Object created by this library, but the form of the object is completely foreign to me.

As a reproducible example:


set.seed(42)​
library("iml")​
library("randomForest")​
data("Boston", package  = "MASS")​
rf = randomForest(medv ~ ., data = Boston, ntree = 50)​
​
X = Boston[which(names(Boston) != "medv")]​
predictor = Predictor$new(rf, data = X, y = Boston$medv)​
imp = FeatureImp$new(predictor, loss = "mae")​
eff = FeatureEffect$new(predictor, feature = "rm") ​
eff


Interpretation method:  FeatureEffect
features: rm[numerical]
grid size: 20

Analysed predictor:
Prediction task: unknown


Analysed data:
Sampling from data.frame with 506 rows and 13 columns.

Head of results:
       .ale .type    rm
1 -2.150574   ale 3.561
2 -2.610528   ale 5.304
3 -2.338677   ale 5.593
4 -2.265673   ale 5.709
5 -2.142912   ale 5.837
6 -2.085899   ale 5.885

How can I refer to and get ahold of the table of 6 records above?

I tried str(eff) and class(eff), but I am not familiar with the structure of the object(s).

Would someone please tell me how to get inside the eff object, or point me to a reference as to what the class or structure of the object is?

Thanks.
--John Sparks

        [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list