Live data from Hacker News

Building a neural network from scratch in Haskell

www-cs-students.stanford.edu

21–30 of 38 posts

Re: Building a neural network from scratch in Haskell

#22

Maybe it's just me, but this looks like a bunch of incomprehensible gibberish code. I'm sure I could understand it if I spent many hours pouring over it, but why would you ever do that? When written out in Python (or even in JS!), the whole thing is so much simpler looking and more closely resembles the underlying math. This is especially true if you use a package like Numpy. I know he said he didn't want to use any…

You’re exactly right. But why use python in the Age of Rust?

Re: Building a neural network from scratch in Haskell

#23
post #16

Earlier quoted context omitted.

People have done this but with hasktorch. Which are haskell bindings to the pytorch C++ libraries. The static typing definitely helps when you want to ensure that the input/output shapes of a layer are consistent.

Can you please point to such a tutorial? I am interested.

There's no proper tutorial AFAIK. Just examples in the hasktorch repo.

Re: Building a neural network from scratch in Haskell

#24

Maybe it's just me, but this looks like a bunch of incomprehensible gibberish code. I'm sure I could understand it if I spent many hours pouring over it, but why would you ever do that? When written out in Python (or even in JS!), the whole thing is so much simpler looking and more closely resembles the underlying math. This is especially true if you use a package like Numpy. I know he said he didn't want to use any…

If someone told me they wrote a neural net in Haskell, my first reaction would be "wow that's Cool!", after all I don't think I can do that. I wouldn't care if the code was gibberish.

Re: Building a neural network from scratch in Haskell

#25
post #6

Earlier quoted context omitted.

fast.ai did this with swift in their course https://course.fast.ai/part2

I have been casually playing around with TensorFlow for Swift since it was announced. It shows promise but I question long term support and development. The Julia language with the Flux deep learning library is another very interesting but not mainstream path to take.

What are your concerns around the support / dev?

Google has a fairly sizable team around it, it has a fast path to adoption by the large pool of swift devs and fast.ai, and of course, google hype.

Chris leaving doesn't seem to be an issue: https://twitter.com/clattner_llvm/status/1222032740897284097

Re: Building a neural network from scratch in Haskell

#26

Maybe it's just me, but this looks like a bunch of incomprehensible gibberish code. I'm sure I could understand it if I spent many hours pouring over it, but why would you ever do that? When written out in Python (or even in JS!), the whole thing is so much simpler looking and more closely resembles the underlying math. This is especially true if you use a package like Numpy. I know he said he didn't want to use any…

Very few comments or type signatures, as well as formatting and syntax highlighting is a little odd there, make it less readable.

Re: Building a neural network from scratch in Haskell

#27
post #25

Earlier quoted context omitted.

I have been casually playing around with TensorFlow for Swift since it was announced. It shows promise but I question long term support and development. The Julia language with the Flux deep learning library is another very interesting but not mainstream path to take.

What are your concerns around the support / dev? Google has a fairly sizable team around it, it has a fast path to adoption by the large pool of swift devs and fast.ai, and of course, google hype. Chris leaving doesn't seem to be an issue: https://twitter.com/clattner_llvm/status/1222032740897284097

Google has kind of a reputation for killing projects.

Re: Building a neural network from scratch in Haskell

#28

Maybe it's just me, but this looks like a bunch of incomprehensible gibberish code. I'm sure I could understand it if I spent many hours pouring over it, but why would you ever do that? When written out in Python (or even in JS!), the whole thing is so much simpler looking and more closely resembles the underlying math. This is especially true if you use a package like Numpy. I know he said he didn't want to use any…

I agree that this would look more readable if they used a library for the vector math, instead of doing everything by hand.

Re: Building a neural network from scratch in Haskell

#29
post #12
post #10

Earlier quoted context omitted.

Learning the basics has its place. People have to start somewhere. A tutorial for more complex, real world problems is a totally different thing. Both are interesting in their own ways.

If you have no background, why would you want to learn the basics in a language no one uses rather than the dominant language / framework of the specific domain? Seems to me an extra cognitive load to bear.

I have written quite some Haskell in my life, but never a line of python. For me this tutorial makes sense, it shows the underlying maths. So I don’t really understand your negative attitude.

Re: Building a neural network from scratch in Haskell

#30

played with this for ~5 mins and it's insanely bad (maybe it "guessed" right 3/15 tries?) i.e. slightly better than random guesses, even with very clear handwriting :(

You had bad luck I guess. I just did 15 tries and it only got one wrong. Not really sure what this says though.
Post reply on HN