Skip to content

Conversation

@YuxinB
Copy link
Member

@YuxinB YuxinB commented Mar 30, 2025

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Any other comments?

Copy link
Collaborator

@adam2392 adam2392 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks correct, but I have not validated it, and also it's usually a bit hard to validate Cython code.

I would recommend writing a small test Cython test class that you can invoke in Python, which then calls the sample_proj_mat for an input array. You can then visualize and verify that it will do what you want it to do for a set of features. You can then manually show that the MultiViewObliqueSplitter samples what you would expect to be the right projection matrix for multiple sets of features.

For example, see the MultiViewSplitterTester I wrote for test the MultiViewSplitter, and plot_multiview_axis_aligned_splitter.py.


# here, axis-aligned splits are entirely weights of 1
weight = 1 # if (rand_int(0, 2, random_state) == 1) else -1
weight = 1 if (rand_int(0, 2, random_state) == 1) else -1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the axis-aligned multi view-splitter I think(?)

Copy link
Member Author

@YuxinB YuxinB Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, I will change it back, it should be just 1, instead of 1 or -1

@YuxinB
Copy link
Member Author

YuxinB commented Mar 31, 2025

I think this looks correct, but I have not validated it, and also it's usually a bit hard to validate Cython code.

I would recommend writing a small test Cython test class that you can invoke in Python, which then calls the sample_proj_mat for an input array. You can then visualize and verify that it will do what you want it to do for a set of features. You can then manually show that the MultiViewObliqueSplitter samples what you would expect to be the right projection matrix for multiple sets of features.

For example, see the MultiViewSplitterTester I wrote for test the MultiViewSplitter, and plot_multiview_axis_aligned_splitter.py.

Will do!

Copy link
Member

@PSSF23 PSSF23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the changes in forest.py is to remove the multi-class restrictions? Then we can just remove the assertion line instead of commenting it out.

@PSSF23 PSSF23 changed the title Update Multiview oblique ENH enable multiview-oblique splitting & unlock multiclass restrictions Mar 31, 2025
YuxinB added 2 commits April 1, 2025 12:03
Add test for using same number of max_feature for each view
@YuxinB
Copy link
Member Author

YuxinB commented Apr 1, 2025

@adam2392 Can you help me recheck with Multiview Oblique splitter when uniform sampling condition is true. I modified it to be more reasonable to achieve uniform sampling.

@adam2392
Copy link
Collaborator

adam2392 commented Apr 2, 2025

@adam2392 Can you help me recheck with Multiview Oblique splitter when uniform sampling condition is true. I modified it to be more reasonable to achieve uniform sampling.

Did a loose check, and it looks in the right direction. Will do an in-depth review after we can visually verify the projection matrix makes sense.

@adam2392
Copy link
Collaborator

adam2392 commented Apr 3, 2025

I'm unsure why the docs are broken, but it would be nice to be able to check the output visually here: https://output.circle-artifacts.com/output/job/96dcd4fa-4fbc-4b29-b358-314687b9af0b/artifacts/0/dev/use.html via the circleCI job: https://circleci.com/gh/neurodata/treeple/561. It makes reviewing easier/trivial even.

This is what I got though when I ran plot_multiview_oblique.py locally. To me this seems weird because your feature_combinations is 2, but on average, you're definitely sampling more than 2 feature indices per projection vector. Also, if this is an oblique combination, I'm unsure why the projection weights are only of value +1? For axis-aligned, we make them +1, but for oblique, we made them +/- 1, or 0. Without giving the code a deeper look, I conclude there's something not working. Open to being convinced tho.

Figure_1

@YuxinB
Copy link
Member Author

YuxinB commented Apr 3, 2025

When I directly output the projection matrix from plot_multiview_oblique.py, I got matrix:
image
The feature_combination is around 2 on average. And there are -1s, 0s and 1s.

@YuxinB
Copy link
Member Author

YuxinB commented Apr 3, 2025

Done with with visualization bug:
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants