# Should use sklearn or tensorflow for neural networks?

I have just started learning Neural Networks for deep learning from cs231. I am trying to implement Neural Network in Python. I am looking at using Tensorflow or scikit-learn. What are some pros and cons of these libraries for this application?

Sklearn doesn't have much support for Deep Neural Networks. Among the two, since you are interested in deep learning, pick tensorflow.

However, I would suggest going with keras, which uses tensorflow as a backend, but offers an easier interface.

In the cs231n course, as far as I remeber, you spend most the time implementing neural networks yourself using nothing but NumPy! that was definitely an amazing learning experience for me.

After that, in the last assignments, you definitely need to be looking at either TensorFlow (examples) or Pytorch (examples) to build more complicated networks. These frameworks were built by people like those creating courses like CS231n - researchers and industry experts.

The SciKit Learn neural network module consists of feed-forward networks for either classification or regression, but nothing fancier, such as convolutional networks (CNNs), recurrent networks (RNNs) or other more exotic components, such as separate activation functions.

I agree with Djib2011, that that Keras is a great alternative to get started - and will let you choose between TensorFlow, CNTK or Theano as a backend. Keras is a nice uniform wrapper around all of the three monster frameworks, so let's you get things up and running very quickly. Here is a reletively recent and useful comparison of Keras with Pytorch

Once you are familiar with a tool like Keras, it will be faster to use that than the simple offerings in SciKit Learn.

I know you didn't ask about PyTorch, but I thought I'd mention it, as one of the original creators of CS231n, Andrej Karpathy, says it is the best framework(source 1, source 2).

• While we are talking about Pytorch : it is far above other frameworks when it comes to variable-length recurrent networks Aug 13 '18 at 11:07
• @Evpok - We should probably also mention that Tensorflow now supports dynamic networks using its tf.eager api, which is comparable to to PyTorch. Aug 13 '18 at 11:25