Comments (5)
Oh you are fast...! Your proposition is not far from a solution that i was trying since a few hours.
But the plot part seems to not work (the neural network model is flat as the variably "Y" is missing in ex_nn):
set.seed(13)
N <- 250
X1 <- runif(N)
X2 <- runif(N)
X3 <- runif(N)
X4 <- runif(N)
X5 <- runif(N)
f <- function(x1, x2, x3, x4, x5) {
((x1-0.5)2)^2-0.5 + sin(x210) + x3^6 + (x4-0.5)2 + abs(2x5-1)
}
y <- f(X1, X2, X3, X4, X5)
library(randomForest)
library(DALEX)
library(e1071)
library(rms)
library(neuralnet)
df <- data.frame(y, X1, X2, X3, X4, X5)
model_rf<-randomForest(y~., df)
model_svm<-svm(y~., df)
model_lm<-lm(y~., df)
model_nn<-neuralnet(y~X1+X2+X3+X4+X5,df,hidden=1)
dd <- datadist(df)
options(datadist="dd")
model_rms <- ols(y ~ rcs(X1) + rcs(X2) + rcs(X3) + rcs(X4) + rcs(X5), df)
ex_rf<-explain(model_rf)
ex_svm<-explain(model_svm)
ex_lm<-explain(model_lm)
ex_nn<-explain(model_nn,data = df[, -1],y = df[, 1],predict_function = function(x, y) compute(x, y)$net.result)
ex_rms<-explain(model_rms, label = "rms", data = df[, -1], y = df$y)
ex_tr<-explain(model_lm, data = df[,-1],
predict_function = function(m, x) f(x[,1], x[,2], x[,3], x[,4], x[,5]),
label = "True Model")
library(ggplot2)
plot(single_variable(ex_rf, "X1"),
single_variable(ex_svm, "X1"),
single_variable(ex_lm, "X1"),
single_variable(ex_nn, "X1"),
single_variable(ex_rms, "X1"),
single_variable(ex_tr, "X1")) +
ggtitle("Responses for X1. Truth: y ~ (2*x1 - 1)^2")
from dalex.
Try this code:
ex_nn<-explain(model_nn,
data = df[, -1],
y = df[, 1],
predict_function = function(x, y) compute(x, y)$net.result)
Is this okay?
from dalex.
Problem solved... my last post was fucking stupid! Everything works great!
from dalex.
So, what was the problem?
from dalex.
The code you give me made the trick. I was just biased by the result! Stupid human brain!
from dalex.
Related Issues (20)
- can dalex generate reports if only given features, label, and prediction? HOT 4
- collinearity issue in permutation based feature importance (technical question) HOT 8
- Fairness module: why using those specific checks, while omitting others? HOT 2
- `loss_accuracy` returns 0 for `mean_dropout_loss` HOT 9
- Non-varying column in data causes Aspect initialisation to fail HOT 2
- External tests fail for Ubuntu HOT 1
- predict_profile fails for penguins data because it is a tibble HOT 2
- Default color theme in DALEX HOT 1
- Add `cross_entropy` as model performance measure in `models_performance`
- thanks
- Add EDA plots to Arena in Python
- add shapr implementation to dalex
- Issue creating a DALEXtra-explainer with response-type mlr3 learners HOT 4
- Error in `predict_profile` when a Dataframe with MultiIndex is Used HOT 2
- Add support for kernelshap
- predict_parts() at dataset level HOT 6
- ability to use something other than plotly to make plots HOT 3
- Option to specify random effects? HOT 1
- PDP with 2 variables HOT 1
- update warning occurring when specifying `variable_splits`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dalex.