tstandley / taskgrouping

Code for Which Tasks Should Be Learned Together in Multi-task Learning?
Other
93 stars 14 forks source link

Network Selection Implementation #5

Closed weimingwill closed 2 years ago

weimingwill commented 2 years ago

Hi, thank you for the work. Are there any specific reasons that the network selection is implemented in C++?

tstandley commented 2 years ago

Yes. The c++ implementation is able to be much faster. I also implemented it in python initially. The c++ implementation is 10-100x faster.

On Tue, Nov 2, 2021, 7:59 AM Zhuang Weiming @.***> wrote:

Hi, thank you for the work. Are there any specific reasons that the network selection is implemented in C++?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tstandley/taskgrouping/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDABXXWA7VFYGROUEWJYPLUJ74D5ANCNFSM5HGVQBEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

weimingwill commented 2 years ago

May I know which parts are computational intensive? It seems that they are reading from txt files as inputs and the txt files are rather small.

Btw, would you mind sharing the Python version? Thanks.

tstandley commented 2 years ago

Hey,

It shouldn't really be surprising that the algorithm is computationaly demanding. The problem is NP-hard after all. Reading the files takes no time. The search through the exponential space of solutions is what is hard. Even if the algorithm prunes most of it.

The python implementation has fallen into disrepair, and was programmed with limitations that make it unlikely to generalize to whatever you want to use it for. Plus it's super slow, so I'm not going to share it. You should really use the c++. I prefer not to have a python version out there confusing people.

If you have to have a python version, it shouldn't be too difficult to adapt the c++. You could refer to the pseudcode on slide 27 of the talk I posted on my website. You could even use the c++ and the included input files to test your implementation. But I don't think you'd be able to overcome the slowness. Python is just not good for doing any heavy algorithm stuff.

What were you planning to use it for? Maybe you could wrap the c++ and call it from python.

Best, Trevor

On Tue, Nov 2, 2021, 9:41 AM Zhuang Weiming @.***> wrote:

May I know which parts are computational intensive? It seems that they are reading from txt files as inputs and the txt files are rather small.

Btw, would you mind sharing the Python version? Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tstandley/taskgrouping/issues/5#issuecomment-957930532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDABXXK2FUFMABTA4LB5KLUKAICFANCNFSM5HGVQBEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

weimingwill commented 2 years ago

Thank you very much for this long comment. I will adopt the c++ version and start from there.