5 ms·
I don't see the point of writing a machine learning package in Go. Go is designed for system programming, which is the opposite of scripting. In scientific co
by thinxer 10y ago
I don't see the point of writing a machine learning package in Go.
Go is designed for system programming, which is the opposite of scripting. In scientific computing, interactivity is an important feature. Softwares like MATLAB and IPython(now Jupyter) become popular because of this. Go doesn't have a nice REPL like IPython, and it never will. Besides, Go doesn't allow operator overload, which leads to verbose programs. Compare `c = a @ b` with `c := Must(Mul(a, b))`, the former Python statement is much cleaner than the Go one.
Usually, researchers use MATLAB, R, and Python for prototyping and training. The final model will be put into production by using something like TensorFlow Serving or by hand written C++ for performance. Even if the final product uses Go for serving, the Go program mostly runs the model via cgo or RPC.
Write in C/C++, and wrap the library in Python and Go is a much saner option. TensorFlow and MXNet are both good examples.
- chewxy 10y agoI agree with you in general. However, I contend that people are lazy. Part of the reason why I wrote Gorgonia was because I spent waay too long trying to deploy theano on the cloud (this was circa 2 years ago). Also, thanks for informing me about MXNet. I've never seen that before. Kinda cool.
- pjmlp 10y ago> I don't see the point of writing a machine learning package in Go. If nothing else, to prove a point that there are solid alternatives to C and C++, in memory safe languages.
- solidsnack9000 10y agoIf the point is feasibility, Java has shown us that for a long time...unless we consider the null pointer evidence of something not memory safe.
- pjmlp 10y agoNot only feasibility, but having a GC enabled programming language with AOT compilation to native code (until Java 10, you will need to buy such compilers as the FOSS aren't as good). After all the OP mentioned that only C and C++ were valid alternatives, hence why it is so important to implement such tools in other safer languages. If people don't do it, as usual there will be a myth that only those languages are able to produce such type of applications. Similar to the myth that C was the first systems programming language, when many of us were using something else before UNIX got widespread in the industry.
- solidsnack9000 10y agoThis is starting to seem fairly specific -- machine learning with memory safe languages that have AOT compilation to native code. It's not even, memory-safe languages that are performant -- because Java would totally match that requirement. What I'm suggesting here is that there is nothing really remarkable about it, from either a research or implementation perspective, given the achievements of the Java community in recent years.
- deleted 10y ago[deleted]
- zik 10y ago> Go doesn't have a nice REPL like IPython, and it never will. https://github.com/motemen/gore https://github.com/motemen/gore There are a few others too.
- IshKebab 10y agoIt's not a real repl. It just records everything you've typed, puts it in a file, and compiles and runs it. It does that every time you add a new line. It's a huge hack and doesn't behave like you'd expect at all.
- d0vs 10y agohttps://godoc.org/golang.org/x/tools/go/ssa/interp https://godoc.org/golang.org/x/tools/go/ssa/interp
- jerf 10y agoYes, but that's not exactly a REPL, is it? It's just an incomplete tool that may someday be used to create a REPL. Go is not set up to have a REPL; even if someone develops one someday it's always going to be limited compared to a language that was designed to do it. REPLs are actually pretty hard; even some languages designed with them from day one (or at least very early) like Haskell still come with an interesting list of caveats about the REPL.
- sbinet 10y agoI beg to differ. See: https://github.com/sbinet/igo https://github.com/sbinet/igo It is a true REPL (not like "gore", mentioned somewhere in that thread). It doesn't implement the whole Go specs, but there's AFAICT nothing in the Go specs that prevent `igo` to implement the whole Go specs. It's "just" work. Moreover, with the introduction of the "buildmode=plugin" in the yet-to-be-released Go-1.8, import-ing packages on the fly should be easy implementable. ("my" new vehicle to provide a true REPL for Go is at https://github.com/go-interpreter https://github.com/go-interpreter)
- howeman 10y agoInteractivity can be an important feature for scientific programming, but so is having correct underlying algorithms that are implemented in a clean, composable way. Go is a good language for such implementations. > Go doesn't have a nice REPL like IPython, and it never will. https://github.com/gopherds/gophernotes https://github.com/gopherds/gophernotes
- marmaduke 10y agoI've been > scientific computing for quite some time, and I've the value of a REPL steadily in decline: what's far more useful is a tested code snippet or function & a debugger, occasionally. Also, if a scientific stack were available in Go, I'd jump on it, because deploying Go is so much simpler than Python. Python's deployment story for scientific software often starts with either )a) create the perfect storm of dependency versions or (b) use Anaconda. Even MATLAB is way better in this regard.
- vegabook 10y agoIn fairness, "use Anaconda" usually nullifies this dependency / deployment problem completely.
- NegatioN 10y agoThe "perfect storm of dependency versions" is a problem in Go as well though?
- eikenberry 10y agoNot in practice. The vendoring solution that they are standardizing on makes versioning issues very manageable.
- 10y ago
- solidsnack9000 10y agoThe problem I see with it is not so much that you don't want a native, compiled implementation of a machine learning as that you want to be able to call it from Python, MatLAB and R. It is somewhat less straightforward to go Python<->Go than Python<->C or even Python<->Rust.
- sbinet 10y agohttps://github.com/go-python/gopy https://github.com/go-python/gopy it automatically creates a CPython-2 extension module out of a Go-1.5 package. I plan to update it for Go>=1.6 and also directly generate a "cffi" python module so CPython-{2,3} and PyPy can be directly supported out of the box.
- scrollaway 10y agoWoah. Sorry, I have nothing of substance to say, but this deserves more than an upvote.
- SEJeff 10y agoFWIW: there is a virtual identical golang equiv to Jupyter in the golang tour (which is all open source).