New to Machine Learning? Setting up a project is super easy. In this article we’re learning how to install Miniconda, setup the Jupyter Notebook and run a sample Tensorflow Machine Learning project. Main programming language will be Python, but in future tutorials I’m going to leverage Javascript as well in order to explore a new realm. 🙂
I’m super excited to start off this new topic since I’m quite new to the subject and eager to learn along! In preparation for these articles, I’m doing some research beforehand and I can say that some concepts are still nuclear. With small steps we can learn everything and get where we want to go!
The lovely code for the machine learning tutorials is being published to this Github repo for you to use. If you have any improvements, you are more than welcome to propose changes.
What is machine learning?
It’s important to understand a bit of what machine learning is and how it works under the hood. In essence, a traditional app is designed to work empirically according to some rules. It’ll do nothing less and nothing more than the boundaries imposed by the rules it was developed with. Machine learning, on the other hand, goes further by adapting to new sets of input data without much intervention from the programmer.
By using neural network algorithms, the software is able to learn from training data sets storing information inside a model. A model can be seen exactly as a human brain, with synapses and neurons. The app equipped with this model will be able to take real-world decisions. Plus, in some regards, it may learn and adapt to newly provided data, improving the efficiency.
You can read more information on this Tensorflow page which contains rich information about machine learning.
Install Miniconda
Miniconda is part of the Conda suite which provides a way for Python projects to use multiple environments and configurations in a super elegant fashion. Conda is available on all platforms and in our scenario I will install it on my Linux Mint machine by downloading the executable from the Miniconda page and running it.
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ chmod +x ./Miniconda3-latest-Linux-x86_64.sh
$ ./Miniconda3-latest-Linux-x86_64.sh
During installation, you’ll be prompted to supply the destination path. I chose /home/afivan/Apps/miniconda/ but you may chose another one. After the installation is complete, you’ll need to run this command to enable the conda command in your path. Just make sure to replace the /home/afivan/Apps/miniconda with your actual path:
$ eval "$(/home/afivan/Apps/miniconda/bin/conda shell.bash hook)"
Now, if you didn’t get any error, the conda executable should be available in your shell. Just a few more steps to complete before running the Jupyter notebook. So, we will now need to create a new environment where the Jupyter will be installed:
$ conda create -n mlt python=3.12
The above command will create an environment called “mlt” with Python version 3.12. After the creation is done, it’s time to activate and check it using this command:
$ conda activate mlt
(mlt) $ python --version
Python 3.12.7
Hopefully you’ll get the same output as above, meaning that your Conda environment is working fine. You also notice the (mlt) thing appearing to the left. The final step is to install and run Jupyter:
(mlt) $ pip install notebook
(mlt) $ jupyter notebook
Should you navigate to http://localhost:8888/tree you can see the Jupyter interface up and running. That’s superb, it means you managed to install it correctly!
Using the Jupyter Notebook
If you clone this Github repo and run the Jupyter in that folder you should see something very similar like above. Try to open the Basics-Tensorflow.ipynb file. You can notice that each cell contains the commands that I ran for the sample Tensorflow tutorial since practically those are Python interpreter commands, except for the pip install tensorflow which Jupyter ran as a shell command.
In the menu you can notice this button with a fast forward icon. Clicking it will run all cells from the notebook in order and they should give you a very similar output to what I received when I created the tutorial.
That’s the beauty of Jupyter: you can share the notebook at which you worked hard and the other person should be able to see the same output regardless of the machine configuration. This makes Jupyter a powerful and enjoyable tool for Machine Learning purposes!
I will let you play around with the notebook and have fun with it. It basically follows along with the sample they provided on the Tensorflow website.
Conclusion
In this realm there’s a lot of learning to do, not only for the machine but for you as a programmer as well. I’m eager to continue my studies in order to produce more articles on advanced topics, making use of Tensorflow and the Javascript version called TensorflowJS. Once I get this know-how steady I plan to jump into LLM models, prompts and chatbots so stay tuned with the latest technology trends.
As for you, what sort of future will these new machine learning capabilities bring to us? Let me know in the comments below, Cheers! 😄
Thanks for reading, I hope you found this article useful and interesting. If you have any suggestions don’t hesitate to contact me. If you found my content useful please consider a small donation. Any support is greatly appreciated! Cheers 😉