I am new to TensorFlow and I need to understand the capabilities and shortcomings of TensorFlow before I can use it. I know that it is a deep learning framework, but apart from that which other machine learning algorithms can we use with tensor flow. For example can we use SVMs or random forests using TensorFlow? (I know this sounds crazy)

In short, I want to know which Machine Learning Algorithms are supported by TensorFlow. Is it just deep learning or something more?

  • 1
    $\begingroup$ Support vector machine implemented in TensorFlow: github.com/AidanGG/tensorflow_tmva/wiki/Support-Vector-Machine $\endgroup$ – Neil Slater Jul 21 '16 at 19:29
  • 3
    $\begingroup$ Just to make sure: TensorFlow IS NOT a deep learning library. Keras (which can use TensorFlow as Backend) is such a library. TensorFlow is a smart way to handle heavy computations (using a computational graph) in order to execute them on multiple hardware (CPU, GPU and others). $\endgroup$ – debzsud Feb 8 '18 at 14:04

This is a big oversimplification, but there are essentially two types of machine learning libraries available today:

  1. Deep learning (CNN,RNN, fully connected nets, linear models)
  2. Everything else (SVM, GBMs, Random Forests, Naive Bayes, K-NN, etc)

The reason for this is that deep learning is much more computationally intensive than other more traditional training methods, and therefore requires intense specialization of the library (e.g., using a GPU and distributed capabilities). If you're using Python and are looking for a package with the greatest breadth of algorithms, try scikit-learn. In reality, if you want to use deep learning and more traditional methods you'll need to use more than one library. There is no "complete" package.

  • $\begingroup$ Is this answer still valid two years later? It looks like TensorFlow has grown a lot since then. $\endgroup$ – john sullivan Nov 7 '18 at 17:12

TensorFlow is especially indicated for deep learning, i.e. neural networks with lots of layers and weird topologies.

That's it. It is an alternative to Theano, but developed by Google.

In both TensorFlow and Theano, you program symbolically. You define your neural network in the form of algeabreic operations (these nodes are multiplied by these weights and then a non-linear transformation is applied, bla bla bla), which internally are represented by a graph (which in the case of TensorFlow, but not Theano, you can actually see in order to debug your neural network).

Then, TensorFlow (or Theano) offer optimization algorithms which do the heavy-work of figuring out what weights minimize whatever cost function you want to minimize. If your neural network is meant to solve a regression problem, you might want to minimize the sum of squared differences between the predicted values and the true values. TensorFlow does the heavy work of differentiating your cost function and all that.

EDIT: Forgot to mention that, of course, SVMs can be seen as a type of neural network, so obviously, you can train a SVM using TensorFlow optimization tools. But TensorFlow only comes with gradient descent-based optimizers which are a bit stupid to use to train a SVM unless you have lots of observations, since there are specific optimizers for SVM that do not get stuck in local minima.

Also, probably worth mention, that TensorFlow and Theano are pretty low-level frameworks. Most people use frameworks that are built on top of them, and are easier to use. I won't suggest here none, because that would generate its own discussion. See here suggestions for easy to use packages.

  • 1
    $\begingroup$ Theano is not developed by Google. According to their website, it is “primarily developed by academics.” Tensorflow was developed by Google. $\endgroup$ – dantiston Apr 5 '18 at 13:46
  • 1
    $\begingroup$ @dantiston yes, I know. I meant to say "TensorFlow is an alternative to Theano and TensorFlow is developed by Google". I was referring to TensorFlow, not Theano. Bad wording, sorry. $\endgroup$ – Ricardo Cruz Apr 6 '18 at 0:22

Ryan Zotti offers a good answer, but this is changing. With the addition of Random Forest, Gradient Boosting, and Bayesian methods to TensorFlow, it is headed in the direction of becoming a one-stop solution. More traditional algorithms are listed here. TensorFlow has particular promise, as it is designed to scale well and supports GPU operations. However, scikit learn is the traditional one-stop shop where you can find many standard algorithms. They usually aren't the latest and greatest, so you will likely want specialized libraries as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.