This text was written by an exterior contributor.
Go is an open-source programming language initially designed by Google to optimize the development and use of system-level companies, work simply on massive codebases, and make the most of multi-core networked machines. Initially launched in 2009, Go, as a statically typed and compiled programming language, is closely influenced by C with a deal with simplicity, security, and concurrency.
Go has most notably been used to create large-scale functions akin to Docker and Kubernetes. As well as, it’s broadly utilized in firms akin to Netflix, PayPal, and Uber on account of its low latency, environment friendly cross-platform efficiency, and straightforward scalability. Nevertheless, regardless of its many benefits, Go has not been usually utilized in machine studying (ML).
On this article, you’ll discover the challenges of actively utilizing Go for ML and the methods through which Go can achieve a foothold within the ML area over time.
Essential challenges for utilizing Go for machine studying
Go is a robust and environment friendly programming language and is quick and performant sufficient for the CPU-intensive, high-computation calculations that AI options require. It’s sooner than Python and affords varied benefits, akin to ease of use, effectivity, and concurrency, making it superior to a number of different languages utilized in ML in sure instances.
Regardless of Go’s potential for creating sturdy and scalable ML functions and even its superior efficiency in comparison with among the competitors, it stays an ignored possibility for ML. Go’s low adoption in ML may be primarily attributed to some vital challenges it faces, which older programming languages within the ML area have already resolved. These challenges embrace an absence of high-level libraries, no native bindings for CUDA, and fewer well-developed statistics and visualization capabilities.
Lack of high-level libraries
As a comparatively new language, Go has a a lot smaller set of instruments and libraries in comparison with different languages which were round for many years and have well-established ecosystems and libraries for ML. In consequence, Go has fewer high-quality libraries and instruments accessible for ML duties.
Because of this builders who wish to use Go for ML must spend extra time constructing customized options or integrating with present libraries and frameworks that weren’t designed particularly for Go.
There have been vital enhancements in Go libraries over time, with GoLearn providing scikit-learn-style match and predict capabilities, in addition to test-splitting and cross-validation utility features; GoMind providing neural community capabilities; and Gorgonia, a graph computation ML library just like TensorFlow with scaling capabilities.
General, even these libraries would not have the depth of Python-centric libraries with many years of growth, and there are capabilities the place vital gaps can nonetheless be felt in Go, akin to in pure language processing (NLP) duties, particularly when in comparison with spaCy and NLTK.
No native bindings for CUDA
Compute Unified Machine Structure (CUDA) is a parallel computing platform and programming mannequin developed by NVIDIA for programming graphics processing items (GPUs). It permits builders to make use of the high-performance computing capabilities of NVIDIA GPUs to speed up a variety of functions, akin to ML, scientific computing, picture and video processing, and extra.
The primary benefit of CUDA is that it means that you can use the large parallelism of GPUs to hurry up computations that may be parallelized. Sadly, Go doesn’t have native bindings to CUDA as Python does.
To make the most of CUDA in your Go code, it’s essential to import and make the most of C features that create CUDA bindings. To be truthful, C code is embedded in Go together with the cgo command, which allows the creation of Go packages that decision C code. Nevertheless, reliance on C code and cgo requires a powerful proficiency in C for environment friendly coding and debugging. It may possibly create vital overhead whereas additionally opening you as much as C-specific points, akin to reminiscence security instances and safety vulnerabilities.
There are additionally third-party code packages with utility features for Go bindings for CUDA, akin to cuda.
Experimentation constraints
Inherently, Go shouldn’t be the very best for experimentation. As a compiled language, Go code is reworked into machine code that may be executed immediately by the CPU reasonably than being interpreted by a runtime surroundings at runtime. This characteristic is useful because it contributes to Go’s pace and effectivity; nonetheless, you can’t write and execute Go code with out compiling it first. This makes it comparatively more durable to check out completely different concepts and check completely different approaches to an issue in Go than in interpreted languages like Python, and R.
Go shouldn’t be as abstracted from the underlying {hardware} as another languages. This is usually a plus for duties that require low-level optimization or shut management over {hardware} sources, however it might additionally make Go code extra verbose and require extra up-front setup and configuration in comparison with languages like Python, which may be extra versatile and simpler to work with in some instances. Contemplating the depth of libraries and frameworks like scikit-learn and TensorFlow, and the supply of simpler options for duties like characteristic extraction, clustering, and dimensionality discount in a single bundle, Go shouldn’t be probably the most best selection for experimentation in ML.
Compiled languages like Go are often a better option for high-performance duties, akin to server-side programming and optimizing real-time functions.
Inadequate math and statistics capabilities
As talked about, Go lacks the depth of business heavyweights akin to Python. It has fewer specialised libraries and packages targeted on statistics, calculus, and matrix manipulation, which is a big a part of ML and synthetic intelligence growth.
This may not be a significant drawback for everybody; some builders welcome the prospect to actively write out the code for his or her ML algorithm or math logic. Nevertheless, it nonetheless implies that Go’s ease of use for a similar knowledge manipulations, evaluation, and predictive algorithms is comparatively poorer in comparison with Python.
General, Python, R, and Julia have a powerful foothold within the ML neighborhood as a result of they have been right here first. So, positioning itself as a viable various is an uphill battle for Go, significantly as a result of these established programming languages regularly develop to be higher, simpler, and extra environment friendly for ML and AI capabilities.
Excessive-level libraries in Go
Go has some high-level libraries like Gonum, Gorgonia, and GoLearn, which offer instruments for constructing and coaching neural networks, performing numerical computations, and different ML duties.
Nevertheless, they aren’t as feature-rich as their Python library counterparts. These Python libraries and frameworks, akin to TensorFlow, scikit-learn, and spaCy, are fashionable within the ML business and have been created and iteratively developed to suit the wants of ML builders. They provide options for pure language processing, picture embedding, neural networks, and different ML pursuits.
You possibly can obtain these identical capabilities in Go, and they’d be probably extra highly effective and environment friendly on account of Go’s benefits over different programming languages akin to networking, concurrency, and knowledge processing.
Nevertheless, in the intervening time, creating these capabilities is barely helpful for the Go neighborhood, as Go isn’t as fashionable or broadly used within the ML neighborhood as another languages like Python or R. It additionally suffers from a big hole in contributors in comparison with its older counterparts, resulting in a relatively smaller ecosystem of libraries and instruments, which may make it more durable to seek out preexisting options to sure issues.
Is the scenario altering?
Go is rising in popularity, and the neighborhood as an entire is rising. At present, StackShare places the variety of firms utilizing Go at 2,751, together with Uber, Twitch, Shopify, and Slack. Moreover, in response to the 2021 Stack Overflow Developer Survey, Go is utilized by round 9.55 p.c of builders, rating it because the 14th hottest programming language.
Whereas that is excellent news for the Go neighborhood, it doesn’t actually translate to the ML area. Go is most notably identified for its capabilities in creating scalable servers and enormous software program programs, writing concurrent packages, and launching speedy and light-weight microservices. Nevertheless, even the official Go web site doesn’t checklist ML as one in every of its notable use instances.

That is indicative of Go’s present leaning away from the ML area and its lack of a foothold within the ML neighborhood.
Future use instances
There haven’t been notable showcases of Go in ML. Nevertheless, trying on the strengths of the language, it’s doable to pivot from pondering of Go as a language for growing ML fashions and as an alternative have a look at it as a language for serving ML fashions.
Go can be utilized to construct ML mannequin servers, which permit fashions to be accessed and utilized by different functions or programs. This may be helpful for deploying ML fashions in manufacturing or for constructing ML APIs that may be accessed by different builders or customers. It may be used to construct ML functions akin to ML-powered advice engines or pure language processing instruments. It can be used to construct the backend infrastructure or user-facing interfaces for all these functions.
Creating extra toolkits and frameworks that allow sooner and extra environment friendly server-side ML may very well be a helpful means for the Go neighborhood to open up the codebase for extra experimentation within the ML area.
Conclusion
On this article, you explored Go’s potential benefits for machine studying, the challenges presently stopping the widespread use of Go on this discipline, how enhancements may be made, and what future use instances for Go would possibly appear like.