Skip to content

Commit 07f7dae

Browse files
authored
DS-5479: Fix shapley code to allow RcppEigen upgrade (#95)
Fixes the build issue of the shapley C++ code with the new RcppEigen dependency. Will allow RcppEigen to be unpinned.
1 parent 90e68d1 commit 07f7dae

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: flipRegression
22
Type: Package
33
Title: Estimates standard regression models
4-
Version: 1.3.66
4+
Version: 1.3.67
55
Author: Displayr <opensource@displayr.com>
66
Maintainer: Displayr <opensource@displayr.com>
77
Description: Regression models according to the flip Project
@@ -51,7 +51,7 @@ Remotes:
5151
Displayr/rhtmlHeatmap,
5252
Displayr/verbs,
5353
LinkingTo: Rcpp (>= 0.12.15),
54-
RcppEigen (<= 0.3.3.9.4)
54+
RcppEigen
5555
VignetteBuilder: knitr
5656
RoxygenNote: 7.3.2
5757
Encoding: UTF-8

src/shapley.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ double regressorSubsetRsquared(NumericVector combination_indices,
7373

7474
for (int i = 0; i < combination_size; i++)
7575
for (int j = 0; j < combination_size; j++)
76-
corr_regressors_submatrix(i, j) = corr_regressors(combination_indices[i],
77-
combination_indices[j]);
76+
corr_regressors_submatrix(i, j) = corr_regressors(static_cast<int>(combination_indices[i]),
77+
static_cast<int>(combination_indices[j]));
7878
for (int i = 0; i < combination_size; i++)
79-
corr_xy_subvector[i] = corr_xy[combination_indices[i]];
79+
corr_xy_subvector[i] = corr_xy[static_cast<int>(combination_indices[i])];
8080

8181
// v'M^1v, where v = corr_xy_subvector and M = corr_regressors_submatrix
8282
return (double)(corr_regressors_submatrix.llt().solve(corr_xy_subvector).dot(corr_xy_subvector));
@@ -176,4 +176,3 @@ NumericVector shapleyImportance(Eigen::MatrixXd & corr_regressors,
176176

177177
return importance;
178178
}
179-

0 commit comments

Comments
 (0)