Skip to content

Commit bdb4ee1

Browse files
fixed dependency in honest tree tests
1 parent d75a79b commit bdb4ee1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

sklearn/tree/tests/test_tree.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,28 @@
198198
}
199199

200200

201+
def _moving_avg_cov(n_dim, rho):
202+
# Create a meshgrid of indices
203+
i, j = np.meshgrid(np.arange(1, n_dim + 1), np.arange(1, n_dim + 1), indexing="ij")
204+
205+
# Calculate the covariance matrix using the corrected formula
206+
cov_matrix = rho ** np.abs(i - j)
207+
208+
# Apply the banding condition
209+
cov_matrix[abs(i - j) > 1] = 0
210+
return cov_matrix
211+
212+
213+
def _autoregressive_cov(n_dim, rho):
214+
# Create a meshgrid of indices
215+
i, j = np.meshgrid(np.arange(1, n_dim + 1), np.arange(1, n_dim + 1), indexing="ij")
216+
217+
# Calculate the covariance matrix using the corrected formula
218+
cov_matrix = rho ** np.abs(i - j)
219+
220+
return cov_matrix
221+
222+
201223
def make_trunk_classification(
202224
n_samples,
203225
n_dim,

0 commit comments

Comments
 (0)