From 69136745549f350f494a30be868cc3af9c819554 Mon Sep 17 00:00:00 2001 From: YuxinB Date: Fri, 23 Jun 2023 20:43:57 +0000 Subject: [PATCH 1/4] modified: sktree/tree/manifold/_morf_splitter.pyx --- sktree/tree/manifold/_morf_splitter.pyx | 47 +++++++++++++++++-------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/sktree/tree/manifold/_morf_splitter.pyx b/sktree/tree/manifold/_morf_splitter.pyx index e4458b205..c6b0ca60d 100644 --- a/sktree/tree/manifold/_morf_splitter.pyx +++ b/sktree/tree/manifold/_morf_splitter.pyx @@ -281,21 +281,38 @@ cdef class BestPatchSplitter(BaseDensePatchSplitter): # (\prod_i self.patch_dims_buff[i]) cdef SIZE_t patch_size - for proj_i in range(0, max_features): - # now get the top-left seed that is used to then determine the top-left - # position in patch - # compute top-left seed for the multi-dimensional patch - top_left_patch_seed, patch_size = self.sample_top_left_seed() - - # sample a projection vector given the top-left seed point in n-dimensional space - self.sample_proj_vec( - proj_mat_weights, - proj_mat_indices, - proj_i, - patch_size, - top_left_patch_seed, - self.patch_dims_buff - ) + rand_feature_set = rand_int(0,1,random_state) + if rand_feature_set == 0: + for proj_i in range(0, max_features): + # now get the top-left seed that is used to then determine the top-left + # position in patch + # compute top-left seed for the multi-dimensional patch + top_left_patch_seed, patch_size = self.sample_top_left_seed() + + # sample a projection vector given the top-left seed point in n-dimensional space + self.sample_proj_vec( + proj_mat_weights, + proj_mat_indices, + proj_i, + patch_size, + top_left_patch_seed, + self.patch_dims_buff + ) + else: + for proj_i in range(n_features/2, n_features/2 + max_features): + # now get the top-left seed that is used to then determine the top-left + # position in patch + # compute top-left seed for the multi-dimensional patch + top_left_patch_seed, patch_size = self.sample_top_left_seed() + + # sample a projection vector given the top-left seed point in n-dimensional space + self.sample_proj_vec( + proj_mat_weights, + proj_mat_indices, + proj_i, + patch_size, + top_left_patch_seed, + self.patch_dims_buff) cdef void sample_proj_vec( self, From 13a77ef19a39a68ecbd06c86e4ae3401890448c8 Mon Sep 17 00:00:00 2001 From: YuxinB Date: Fri, 23 Jun 2023 20:47:28 +0000 Subject: [PATCH 2/4] modified: sktree/tree/manifold/_morf_splitter.pyx --- sktree/tree/manifold/_morf_splitter.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sktree/tree/manifold/_morf_splitter.pyx b/sktree/tree/manifold/_morf_splitter.pyx index c6b0ca60d..6804f8e7d 100644 --- a/sktree/tree/manifold/_morf_splitter.pyx +++ b/sktree/tree/manifold/_morf_splitter.pyx @@ -299,7 +299,7 @@ cdef class BestPatchSplitter(BaseDensePatchSplitter): self.patch_dims_buff ) else: - for proj_i in range(n_features/2, n_features/2 + max_features): + for proj_i in range(self.n_features/2, self.n_features/2 + max_features): # now get the top-left seed that is used to then determine the top-left # position in patch # compute top-left seed for the multi-dimensional patch From 6c486f592bda83477eb4e7046d5efcedc8d7130b Mon Sep 17 00:00:00 2001 From: YuxinB Date: Fri, 23 Jun 2023 20:55:02 +0000 Subject: [PATCH 3/4] modified: sktree/tree/manifold/_morf_splitter.pyx --- sktree/tree/manifold/_morf_splitter.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sktree/tree/manifold/_morf_splitter.pyx b/sktree/tree/manifold/_morf_splitter.pyx index 6804f8e7d..e17ae9df3 100644 --- a/sktree/tree/manifold/_morf_splitter.pyx +++ b/sktree/tree/manifold/_morf_splitter.pyx @@ -299,7 +299,7 @@ cdef class BestPatchSplitter(BaseDensePatchSplitter): self.patch_dims_buff ) else: - for proj_i in range(self.n_features/2, self.n_features/2 + max_features): + for proj_i in range(n_features/2, self.n_features/2 + max_features): # now get the top-left seed that is used to then determine the top-left # position in patch # compute top-left seed for the multi-dimensional patch From 65694e0e4ed657aace60f0f4a4fde9a301d36702 Mon Sep 17 00:00:00 2001 From: YuxinB Date: Fri, 23 Jun 2023 20:55:18 +0000 Subject: [PATCH 4/4] modified: sktree/tree/manifold/_morf_splitter.pyx --- sktree/tree/manifold/_morf_splitter.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sktree/tree/manifold/_morf_splitter.pyx b/sktree/tree/manifold/_morf_splitter.pyx index e17ae9df3..6804f8e7d 100644 --- a/sktree/tree/manifold/_morf_splitter.pyx +++ b/sktree/tree/manifold/_morf_splitter.pyx @@ -299,7 +299,7 @@ cdef class BestPatchSplitter(BaseDensePatchSplitter): self.patch_dims_buff ) else: - for proj_i in range(n_features/2, self.n_features/2 + max_features): + for proj_i in range(self.n_features/2, self.n_features/2 + max_features): # now get the top-left seed that is used to then determine the top-left # position in patch # compute top-left seed for the multi-dimensional patch