LOST-STATS / lost-stats.github.io

Source code for the Library of Statistical Techniques
https://lost-stats.github.io/
GNU General Public License v2.0
257 stars 166 forks source link

Julia implementation for ANNs page #187

Closed gabriel-fallen closed 1 year ago

gabriel-fallen commented 1 year ago

I've added Julia implementation that mostly corresponds to the Python one but more explicit.

NickCH-K commented 1 year ago

Great, thank you very much! Again, let me know about the tag and I'll merge.

gabriel-fallen commented 1 year ago

@NickCH-K I'm glad to know you find my contribution useful! I though about these two as a kinda warm up and considering levelling up to more substantial ones.

NickCH-K commented 1 year ago

Awesome! And thank you

gabriel-fallen commented 1 year ago

@NickCH-K you're very welcome! 😸 Thanks for accepting.

I was also thinking about adding an example of how to move everything to a GPU, do you think that would be useful and aligned with the gist of LOST?

NickCH-K commented 1 year ago

I could see that going under Other, sure.

gabriel-fallen commented 1 year ago

In reality that would look like

using CUDA

gpu_model = gpu(model)
gpu_train_data = gpu(train_data)
ps = gpu(Flux.params(gpu_model)

Flux.train!(loss, ps, eachobs(gpu_train_data), opt)

so that's a small addition to existing example (which is the point).

Thus I don't think it's worth extraction to Other section. OTOH even ANNs are pretty tangential to Statistical Techniques and training on GPU is even further away, so I have no issues with just dropping this part.

That's why I decided to consult with you before writing the code, to align with the overall logic behind LOST. 😺

NickCH-K commented 1 year ago

Oh I see. Yes, maybe add that as an additional step to the existing example.

On Oct 31, 2022 9:24 AM, Alexander Chichigin @.***> wrote:

In reality that would look like

using CUDA

gpu_model = gpu(model)

gpu_train_data = gpu(train_data)

ps = gpu(Flux.params(gpu_model)

Flux.train!(loss, ps, eachobs(gpu_train_data), opt)

so that's a small addition to existing example (which is the point).

Thus I don't think it's worth extraction to Other section. OTOH even ANNs are pretty tangential to Statistical Techniques and training on GPU is even further away, so I have no issues with just dropping this part.

That's why I decided to consult with you before writing the code, to align with the overall logic behind LOST. 😺

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLOST-STATS%2Flost-stats.github.io%2Fpull%2F187%23issuecomment-1297346169&data=05%7C01%7Cnhuntington-klein%40seattleu.edu%7C0d1cbb72b02d4f41971008dabb5c504d%7Cbc10e052b01c48499967ee7ec74fc9d8%7C0%7C0%7C638028302401927806%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JLUEqJMY%2F0Cj1yjKe7mZ%2Fas85PTuATg75ni17EDnJp4%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKV5TDKEDADTXTWKVPUE36TWF7XB5ANCNFSM6AAAAAARSJXUTE&data=05%7C01%7Cnhuntington-klein%40seattleu.edu%7C0d1cbb72b02d4f41971008dabb5c504d%7Cbc10e052b01c48499967ee7ec74fc9d8%7C0%7C0%7C638028302401927806%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Hxf5DEafTjFZwjzAXaXbpuu6GLqcO3x5QU1Tkp4ZHqU%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

gabriel-fallen commented 1 year ago

OK, I'll prepare actually working code example then, make another PR, and we can see and decide if it fits. 👍

NickCH-K commented 1 year ago

To be clear I think it would make sense to keep what you already have, but then have an addendum that alternately puts the calculations on the gpu

On Oct 31, 2022 10:05 AM, Alexander Chichigin @.***> wrote:

OK, I'll prepare actually working code example then, make another PR, and we can see and decide if it fits. 👍

— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FLOST-STATS%2Flost-stats.github.io%2Fpull%2F187%23issuecomment-1297398249&data=05%7C01%7Cnhuntington-klein%40seattleu.edu%7C0cf590cc969d48825e3c08dabb621c72%7Cbc10e052b01c48499967ee7ec74fc9d8%7C0%7C0%7C638028327320482977%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OeE2V7adAvsMEBDx4VBXz9t0SNiTF7U7D7MV7OCr74M%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKV5TDLWYZA4XG32Z2THDNTWF735PANCNFSM6AAAAAARSJXUTE&data=05%7C01%7Cnhuntington-klein%40seattleu.edu%7C0cf590cc969d48825e3c08dabb621c72%7Cbc10e052b01c48499967ee7ec74fc9d8%7C0%7C0%7C638028327320482977%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=gcx8z8uc0LyIehk9v1XT7dcGqJEqhFRJKFfM1QkTl6I%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

gabriel-fallen commented 1 year ago

@NickCH-K yep, that was the idea. 😸