TensorFlow
FAQ
Welcome our new artificial intelligence overlords by tinkering with their gray matter.
Q: Let's start at the beginning. What are tensors, and where should they flow?
A: Without getting too bogged down in mathematics, tensor is just a fancy word for multidimensional array. These arrays flow through a series of steps to arrive at some calculation. Basically, TensorFlow is a programming tool for pushing big bits of data through a predefined series of steps.
Q: Ah, that's interesting, but it sounds like an awfully complicated way of programming. Why would I want to go to all the trouble of flowing tensors?
A: TensorFlow isn't really a programming language. It's a toolset for performing intensive mathematical computation. Although it's fairly general purpose, it was created initially for creating neural networks.
Q: A what-network?
A: A neural network is a computational model that's inspired by the way our brains work. Our brains are made up of billions of neurons. Each one on its own is quite simple: It collects values from other neurons, applies a weighting to each value, and combines them through a function to create an output. This output is then sent to all the neurons that are connected to it (which typically aren't the same ones that it got the input values from).
Q: I sort of understand; is there a way to get a better idea of what's going on?
A: Yes! The best beginner's visualization for this that we've come across is the TensorFlow Playground [1], which allows you to run a simple neural network in your browser (Figure 1). The playground has a simple task: Given a pattern of dots where some are orange and some are blue, the neural network has to correctly work out which dots are which color by looking at where they are on the graph. You can change the pattern you're using in the data section on the left-hand side. Some of the patterns are quite simple; others are more complicated (particularly the swirl).
In the playground, the neural network consists of a set of inputs, one or more hidden layers, and an output. In each layer, there are one or more neurons that combine the output from all the neurons at the previous level and assign a weight to them. (You can see the weighting of a particular link by the boldness of the line connecting two neurons.) In each epoch, data flows through the network, and each time the network correctly classifies a datapoint, the connections that were correct are strengthened.
Click on the play arrow to start training your network, and you should see it gradually get better at classifying the orange and blue dots. Playing with the various settings to see how well different configurations can classify dots can get addictive as it's interesting to see how the different settings can make the machine more or less intelligent.
Q: That's fun, but what an earth could that be used for?
A: This type of problem is known as a classification problem. Given a bit of data, you have to classify it as a particular type. In this case, given a dot, you have to classify it as either orange or blue, which is quite simple, but more complex cases could be recognizing what objects appear in an image or what words appear in a piece of audio. Essentially, any time you need to recognize something, you have a classification problem that potentially could be done in this way.
Q: So all you need to do is set up your neural network, feed in some data, and you can recognize stuff? That sounds awesome.
A: On one level, that's correct, but there's quite a lot involved in the phrase "set up your neural network." For the simple dots classification, most networks manage to be fairly accurate, but when the problems become more complex, the particular parameters, setups, and configurations become vitally important to the accuracy of the classification.
Q: Ah, OK. My machine struggles a bit with the few layers needed to classify the spiral in the playground. How on earth am I supposed to run more complex networks?
A: The web browser version isn't full TensorFlow, and it isn't anywhere near as efficient as running it natively. That said, neural networks can be quite processor intensive. There's a version of TensorFlow that runs on Nvidia GPUs, and you can distribute your programs across many machines.
TensorFlow originated at Google, and the search giant has developed special chips designed to run TensorFlow programs as efficiently as possible.
Q: Developed by Google you say? Does that mean they've fed my search history through a network to try and work out what sort of person searches for obscure Linux error messages and wild mushroom identification features?
A: We couldn't say for sure. It's certainly possible that they use some form of artificial intelligence to try to target advertisements more effectively, but they're also probably moving into the more general area of classification, because the better you can classify something, the easier you can search for it.
Through their subsidiary DeepMind, Google is also pushing into a whole host of other areas including a controversial partnership with Britain's National Health Service (NHS). In 2016, DeepMind started a collaboration with the Royal Free London NHS Trust to work with kidney injuries. Unfortunately, neither the NHS Trust nor DeepMind actually got consent from the patients before running the data through their artificial intelligence systems.
Q: Ugh. This is why we can't have anything nice.
A: The field of artificial intelligence does pose some difficult questions for privacy. After all, doctor's notes are routinely stored on computers, and there are various standards that they have to meet. Does the fact that the computer has some potential level of intelligence affect this? Is there a point where computers are sufficiently intelligent that we have to consider our privacy from them not just their operators?
Q: Invasion of privacy and philosophical questions aside, this all sounds really interesting. I suppose that you need to learn some obscure programming language known only to PhD students before you can get started with TensorFlow?
A: Nope. Python is by far the most popular language for working with TensorFlow, but there are also bindings for C++, Java, and Go. The mechanics of using TensorFlow are actually quite straightforward once you've got your head around the flow graphs. However, understanding what you need to set up to get the artificial intelligence you want can be quite challenging. That said, provided you start slowly and build up your understanding, TensorFlow is within the abilities of the average geek. The getting started guide [2] will, as the name suggests, help you get started (Figure 2).
Infos
- TensorFlow Playground: http://playground.tensorflow.org
- TensorFlow Getting Started Guide: https://www.tensorflow.org/get_started/get_started
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.