In order to set up a Jupyter Notebook session with a virtual environment, first create your virtual environment and activate it. See link for a How To:
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/26/python-virtual-env/
Then within the activated virtual environment run pip install ipython
and pip install ipykernel
.
This will allow you to install a new kernal to appear in your jupyter notebook:ipython kernel install --user --name=deep_learning_venv
Now you can select deep_learning_venv
in the New Notebook dropdown.
To use Tensorflow you can then treat the virtual environment as usual. i.e pip install tensorflow
, then you can import tensorflow as tf
in the actual notebook cells.
I also installed matplotlib in order to view some of the neural network training data as an image directly in jupyter notebook.
E.g:
import matplotlib.pyplot as plt
plt.imshow(x_train[0], cmap=plt.cm.binary)
plt.show()
You can now start training a model.