Live data from Hacker News

OCaml bindings for PyTorch

github.com

1–10 of 23 posts

Re: OCaml bindings for PyTorch

#3

Do bindings like this help much with the day to day work of machine learning research? Are the kinds of errors you encounter the kind that could be avoided with a smarter type checker?

There places where types will help when reading unfamiliar code. They'll also help when you're putting together more complex algorithms for novel architectures. They're less helpful if you're only stacking layers like lego-blocks and tuning hyper parameters of existing models.

If you look at the issues, you'll see the developer contemplating GADTs to deal with tensor shape matching (but even phantom types will do). This is an issue that causes headaches for just about anyone whose dealt with neural nets.

Re: OCaml bindings for PyTorch

#4

Do bindings like this help much with the day to day work of machine learning research? Are the kinds of errors you encounter the kind that could be avoided with a smarter type checker?

I would say so. There are 4,500 results on Stack Overflow for '[pandas] typeerror': https://stackoverflow.com/search?q=%5Bpandas%5D+typeerror

Re: OCaml bindings for PyTorch

#5

Do bindings like this help much with the day to day work of machine learning research? Are the kinds of errors you encounter the kind that could be avoided with a smarter type checker?

I would say so. There are 4,500 results on Stack Overflow for '[pandas] typeerror': https://stackoverflow.com/search?q=%5Bpandas%5D+typeerror

I'm not sure that's a good metric. After all type checking does not really answer a question a developer has about type errors, it just informs you of a type error before you run your program.

In fact I'd wager your average Haskell type error has generated more than a few frustrated stackoverflow questions.

Re: OCaml bindings for PyTorch

#6

Do bindings like this help much with the day to day work of machine learning research? Are the kinds of errors you encounter the kind that could be avoided with a smarter type checker?

I would say so. There are 4,500 results on Stack Overflow for '[pandas] typeerror': https://stackoverflow.com/search?q=%5Bpandas%5D+typeerror

I guess instead of "smarter" I should have said "smarter than what python does already".

Re: OCaml bindings for PyTorch

#7
post #5

Earlier quoted context omitted.

I would say so. There are 4,500 results on Stack Overflow for '[pandas] typeerror': https://stackoverflow.com/search?q=%5Bpandas%5D+typeerror

I'm not sure that's a good metric. After all type checking does not really answer a question a developer has about type errors, it just informs you of a type error before you run your program. In fact I'd wager your average Haskell type error has generated more than a few frustrated stackoverflow questions.

Fair point. I guess it's fair to say that a typechecker would have avoided (almost) all runtime type errors and a fair portion of compile-time type errors provided the developer had type-guided tool assistance.

Re: OCaml bindings for PyTorch

#8

Do bindings like this help much with the day to day work of machine learning research? Are the kinds of errors you encounter the kind that could be avoided with a smarter type checker?

So, this doesn't apply to torch specifically, but to give an example from my own experience... I have a tensorflow model that takes 45 minutes just to build the graph. You can imagine how frustrating it is to wait most of an hour to run your code, only to see it crash due to some trivial error that could have been caught by a compiler.

Although this is somewhat of an extreme example, I'd say most of my tensorflow models take at least several minutes to build a graph. Anything that reduces the possibility of runtime errors would therefore speed up my development cycle dramatically. I'll also note that the OCaml compiler is lightning-fast compared to say, gcc.

Re: OCaml bindings for PyTorch

#9
post #5

Earlier quoted context omitted.

I would say so. There are 4,500 results on Stack Overflow for '[pandas] typeerror': https://stackoverflow.com/search?q=%5Bpandas%5D+typeerror

I'm not sure that's a good metric. After all type checking does not really answer a question a developer has about type errors, it just informs you of a type error before you run your program. In fact I'd wager your average Haskell type error has generated more than a few frustrated stackoverflow questions.

Type errors in functional languages (except Elm) are so unhelpful, you just get used to their general shape and your context to figure what the problem might be. Eventually these are rarely ever a problem but I agree that for beginners, type errors can be quite hostile.

I'll say however, the benefit of an ML like Ocaml is less so the types than that functional languages are the most advanced in providing tools which allow for domain modeling in terms of composition and defining tailored algebras. This is something that fits both applied and experimental machine learning especially well.

Post reply on HN