graspologic icon indicating copy to clipboard operation
graspologic copied to clipboard

Add unscaled option for embeddings (at least ASE/LSE)

Open bdpedigo opened this issue 4 years ago • 22 comments

Is your feature request related to a problem? Please describe.

Working on something now where I often want the unscaled version of the ASE/LSE embedding, that is, just the left or right singular vectors without scaling each by sqrt(singular value).

Describe the solution you'd like

Would like a scaled=False keyword argument, default kept as it is.

Describe alternatives you've considered

Obviously easy to unscale after getting the current embedding, just less convenient. Does make the embeddings even closer to just SVD, but ASE at least has diag_aug, and LSE has some preprocessing to form the Laplacian.

Provide references (if applicable)

At least one of the very early embedding papers had unscaled as an option: https://arxiv.org/abs/1108.2228

Additional context

Would also make code in MASE simpler I think? https://github.com/microsoft/graspologic/blob/dev/graspologic/embed/mase.py#L158 could just use the new ASE, passing down scaled

bdpedigo avatar Dec 17 '20 14:12 bdpedigo

@bdpedigo I want to work on this

rajpratyush avatar Feb 02 '21 05:02 rajpratyush

sounds good @rajpratyush ! note that some knowledge of linear algebra would be helpful here, I'm not sure what your background is?

bdpedigo avatar Feb 02 '21 13:02 bdpedigo

yes @bdpedigo I love mathematics and as I am a penultimate year Engineering student highly interested in machine learning so linear algebra and statistics is in my core knowledge set so I will be able to understand if you guide me

rajpratyush avatar Feb 02 '21 13:02 rajpratyush

https://github.com/microsoft/graspologic/blob/7213df8d26e1a5724cb136bfa3ec05d09122e818/graspologic/embed/base.py#L100 on this line in the base class, a matrix (U) is having its columns scaled. All we want is an option (in the base class as well as the classes that inherit from it) to not perform this scaling. So there would be a kwarg in the __init__() for say AdjacencySpectralEmbed where one could specify scaled=False as an option.

bdpedigo avatar Feb 02 '21 14:02 bdpedigo

after that is done, see the link in the original comment about MultipleASE

bdpedigo avatar Feb 02 '21 14:02 bdpedigo

@bdpedigo will adding the option scaled=False in init() function in the base.py will for work or not?? as I am thinking lil bit of guiding is nescessary

rajpratyush avatar Feb 04 '21 15:02 rajpratyush

hi @rajpratyush, it would help me if you clarified what you dont understand about the explanation above

bdpedigo avatar Feb 04 '21 17:02 bdpedigo

I haven't worked with kwargs and i understand the issue just i m cnfused if I just add scaled=false in init() function in base.py will it solve the problem? @bdedigo

rajpratyush avatar Feb 05 '21 03:02 rajpratyush

you will have to add scale=False in the init, but you'll also have to modify the code on the line that I mention above that does the actual scaling.

bdpedigo avatar Feb 05 '21 15:02 bdpedigo

@bdpedigo Thanks for this explanation and being so patient. I have understood it well and will push a PR by Tuesday.

btw I also wanted to know if Graspologic will participate in GSoC

rajpratyush avatar Feb 05 '21 15:02 rajpratyush

btw I also wanted to know if Graspologic will participate in GSoC

still not sure

bdpedigo avatar Feb 08 '21 15:02 bdpedigo

@rajpratyush

btw I also wanted to know if Graspologic will participate in GSoC

Pedigo did send out a mass communication to see if there was interest, so we will see!

loftusa avatar Feb 08 '21 16:02 loftusa

well Me and my friends have shown huge interest towards graspologic and they are all willing to contribute to it in GSoC'21 @loftusa and as the word will spread many more will show interest and join hands to contribute to this project

rajpratyush avatar Feb 08 '21 16:02 rajpratyush

I haven't responded because I have literally no idea what it entails. I keep meaning to look into it but if there's a song and dance routine involved, I am required by law to tell you that I am forbidden from either singing or dancing in 49 of 50 states and that's only due to a technicality it isn't universal.

These hips absolutely lie.

(Joking aside, I'll figure out what's involved and whether I'm for it or against it ;D)

daxpryce avatar Feb 08 '21 17:02 daxpryce

I haven't responded because I have literally no idea what it entails. I keep meaning to look into it but if there's a song and dance routine involved, I am required by law to tell you that I am forbidden from either singing or dancing in 49 of 50 states and that's only due to a technicality it isn't universal.

These hips absolutely lie.

(Joking aside, I'll figure out what's involved and whether I'm for it or against it ;D)

Don't worry, you can opt out of the song-and-dance routine if you opt into the olympic gladiator and cage-fighting minigame, or if you find and post a minimum of 10 embarrassing videos of yourself from early-mid high school.

loftusa avatar Feb 08 '21 17:02 loftusa

@dwaynepryce let the dev community decide the fate of graspologic in GSoC

rajpratyush avatar Feb 08 '21 17:02 rajpratyush

@rajpratyush I'm not sure if it's that easy - let me check with the folks in charge of Microsoft's Open Source initiatives and make sure it's something we can participate in or not and I'll get back to everyone on it. There are just some decisions I'm not allowed to make on my own and this one might be one of them :)

daxpryce avatar Feb 08 '21 18:02 daxpryce

@dwaynepryce surely

rajpratyush avatar Feb 09 '21 03:02 rajpratyush

@bdpedigo Thanks for this explanation and being so patient. I have understood it well and will push a PR by Tuesday.

btw I also wanted to know if Graspologic will participate in GSoC

Hi @rajpratyush - unfortunately doesn't look like we'll be participating in GSoC this year, we didn't have anyone on our end that had the bandwidth to take on any mentees.

bdpedigo avatar Feb 19 '21 13:02 bdpedigo

@bdpedigo i dont care if graspologic comes in gsoc or not i will be actively contributing to it just i hoped with gsoc i will be able to showcase my work to my resume

rajpratyush avatar Feb 19 '21 13:02 rajpratyush

@rajpratyush if there's any other ways we can help you highlight your contributions for your resume, let us know. We really appreciate your contributions and work on this project with us - you've cleaned up so many of our "we want to get to this but don't know when we'll have the time" tasks that we'd be way worse off without all the help you've given.

So if there's some other way we can assist, please reach out - it's the least we can do!

daxpryce avatar Feb 19 '21 16:02 daxpryce

@dwaynepryce just keep me guiding and mentoring so that one day I could be a collaborator to this project. That will be enough. I would really be grateful if you help me out gaining an internship. Most companies filter out tier 3 college guys in india

rajpratyush avatar Feb 19 '21 16:02 rajpratyush