Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/ModelOriented/ingredients:
  potential fix for #137
  • Loading branch information
pbiecek committed Apr 7, 2021
2 parents 367e18e + d0b5264 commit 019af85
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ingredients 2.2.0
--------------------------------------------------------------
* fixes explanations when data has one column [#137](https://github.com/ModelOriented/ingredients/issues/137)

ingredients 2.0.1
--------------------------------------------------------------
* code and documentation maintenance [#130](https://github.com/ModelOriented/ingredients/issues/130)
Expand Down
2 changes: 1 addition & 1 deletion R/accumulated_dependence.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ accumulated_dependence.default <- function(x,
variable_type = "numerical") {
if (!is.null(N) && N < nrow(data)) {
# sample N points
ndata <- data[sample(1:nrow(data), N),]
ndata <- data[sample(1:nrow(data), N), , drop = FALSE]
} else {
ndata <- data
}
Expand Down
2 changes: 1 addition & 1 deletion R/conditional_dependence.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ conditional_dependence.default <- function(x,

if (!is.null(N) && N < nrow(data)) {
# sample N points
ndata <- data[sample(1:nrow(data), N),]
ndata <- data[sample(1:nrow(data), N), , drop = FALSE]
} else {
ndata <- data
}
Expand Down
2 changes: 1 addition & 1 deletion R/feature_importance.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ feature_importance.default <- function(x,
sampled_rows <- sample(1:nrow(data), N)
}
}
sampled_data <- data[sampled_rows, ]
sampled_data <- data[sampled_rows, , drop = FALSE]
observed <- y[sampled_rows]
# loss on the full model or when outcomes are permuted
loss_full <- loss_function(observed, predict_function(x, sampled_data))
Expand Down
2 changes: 1 addition & 1 deletion R/partial_dependence.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ partial_dependence.default <- function(x,
variable_type = "numerical") {
if (!is.null(N) && N < nrow(data)) {
# sample N points
ndata <- data[sample(1:nrow(data), N),]
ndata <- data[sample(1:nrow(data), N), , drop = FALSE]
} else {
ndata <- data
}
Expand Down

0 comments on commit 019af85

Please sign in to comment.