What is deep learning?¶
The following videos showcase some interesting applications of the technique.
We can run a generative model locally using ollama. To do so, start the ollama service as follows.
- In JupyterLab, navigate to the
Filemenu. - Select
Newfrom the drop-down menu and chooseTerminal. - The terminal window will appear. You can use this terminal to run a shell command. Enter the following command into the terminal prompt and hit enter.
ollama serve
Load the JupyterAI magics by running the following cell.
- Select the following cell.
- Press
Shift+Enter.
%reload_ext jupyter_ai_magicsRun the following cell to generate an explanation of what generative AI is.
%%ai diveai:codellama
Explain what is generative AI.Try a few other examples:
%%ai diveai:codellama -f math
Generate the Pythagoras theorem in LaTeX surrounded by `$$`. Do not include an explanation.%%ai diveai:codellama -f html
Create a right-angled triangle using SVG with a black border and white fill.There is also a Jupyternaut chatbot:
- Click the chat icon on the left menu bar. A chat panel will open.
- Click the gear icon on the chat panel to set up the provider.
- Select the
Completion modelasAI :: codellama, the Embedding model asAI :: mxbai-embed-large, and click the Save Changes button. - Click the back arrow at the top to go back to the chat window.
- Enter how are you today? to see a response. You can also ask Jupyternaut to learn local data.
Different models may be of different sizes and may be good at different things. You may try other models from the list below such as llama3.
!ollama listHow to train a neural network?¶
Deep learning is a technique of
- training a neural network with
- many layers of computational units called neurons.
Tensorflow playground¶
Let’s visualize the training process!
The following trains a neural network that predicts the color of a point :
- Choose a data set from the
DATAcolumn. - Click the
playbutton to start training the network. Epochis the number of times a neural network is trained iteratively using the data selected.- In the
OUTPUTcolumn,- points in the blue region are predicted blue, and
- points in the orange region are predicted orange.
The above app is a slight modification of the open source project Tensorflow Playground with the additional features that:
- You can save your configuration to the browser session by clicking the button
Save to browser session. If you reopen the browser, it will load your previously saved configuration automatically. - You can reset the configuration by clicking the
Resetbutton. - The last button
Copy permalink to clipboardcopies the permalink to your configuration to the clipboard. You can save/share multiple configurations permanently using their the permalinks.
For instance, the following uses the permalink to initialize the simplest neural network for a linearly separable data:
Solution to Exercise 1
One possible solution is to add the features and , and add 4 more nodes to the first hidden layer:
Teachable machine¶
It is possible to train a practical neural network without any coding, by using a service called the Teachable Machine.
E.g., click the play button at the bottom of the interactive slides below to train a machine that recognizes musical notes.
Solution to Exercise 2
The following links to a machine that classifies three musical notes: “Doe”, “Ray”, and “Me”:
https://