Getting Started with Machine Learning in Python 2023
- Step 1: What is machine learning: Overview.
- Step 2: Machine Learning Workflow.
- Step 3: Install the Anaconda dependencies.
- Step 4: Or you can install the individual libraries.
- Step 5: Getting Started With Python Jupyter Notebook.
- Step 6: Learn the markdown editor.
- Step 7: Write the code in the Markdown editor.
- Step 8: Practice Machine Learning with Small In-Memory Datasets.
- Step 9: Build a Machine Learning Portfolio.
- Step 10: Machine Learning For Money or applying for the machine learning job.
If you do not want to install all the packages individually, you can install only one software called Anaconda. Although it will install Python3 and others, 150 packages will help you build your development environment very smoothly, and you do not even think about installing all the dependencies.
What Is Machine Learning?
Machine Learning is the application of Artificial Intelligence (AI) that allows systems to learn and improve from the previous experience without being explicitly programmed automatically.
Machine learning focuses on developing computer programs that can access and use data to determine future decisions.
The learning process begins with the measurements or observations of data, such as examples, direct experience, or instruction, to look for patterns in data and make better decisions in the future based on the models we can provide.
The primary focus is to allow computers to learn automatically without human intervention or assistance and adjust actions accordingly.
Machine Learning is the art of computing, in which we need first to prepare the data, if not in well-formed condition and then use that accurate data to train the models.
The models are built on different algorithms, which the programmers need to write in a programming language, and in our case, it is Python.
Based on the previous output of the data and algorithmic logic, the Machine starts to learn themselves. The future values’ accuracy is based on the vast amount of data we have collected.
Finding good programming laptops for machine learning is not an issue here because technologies have improved so much, and you can buy a new laptop for machine learning programs easily with top-notch specs.
Machine Learning Workflow
The necessary steps are the following.
- We must ask ourselves, what are the main problems that can solve by machine learning?
- After identifying the problem, we need to start preparing the data. If the data is not well organized,d then we need to organize it to train the model based on accurate data.
- The next step is to select an algorithm that can solve the problem. There are many algorithms to work with, but we need to identify the perfect algorithm to meet our requirements.
- After selecting the Algorithm, we need to train the model based on that.
- The last step is to test that model to predict future values.
Get Started With Machine Learning In Python
The first thing we will do is install Python 3 and other machine-learning libraries that we can use to develop and train the models.
I am using Mac, but if you are a windows user, you can follow up on this tutorial, although installation instructions might be different on the Windows platform.
You can easily google for that. Not a big deal. Once you install all the libraries, you are ready to go with this tutorial.
You can install all the dependencies in many ways, but I am showing two methods from them.
- Install the Anaconda package that covers all the installation libraries. Next, you need to launch the Navigator and open the Jupyter Notebook, and you are good to go.
- We will install all the dependencies one by one on Mac.
Method: 1 Install Dependencies Using Anaconda.
Step 1: Install Anaconda
Go to the downloads directory https://www.anaconda.com/download/#macos
For Windows users, choose your platform’s executables, download the package, and install it on your Machine.
During the installation, you have an option that tells us whether or not you need to install the Visual Studio Code or not. If you have not downloaded it, please download and install it on your Machine.
Step 2: Open Anaconda Navigator
After installing, we need to open the application from Launchpad called Anaconda-Navigator.
I have already installed VSCode, so I do not need to install it from here. But almost our interface looks the same.
Step 3: Launch Jupyter Notebook.
It will start a server at default PORT: 8888. Also, it will open the browser window and take you to this local URL: http://localhost:8888/tree.
Please do not close the terminal that opens with Jupyter Notebook; otherwise, our local server will stop working, and we will not be able to run the Jupyter Notebook. So we are all set up to start Machine Learning.
Method 2: Install Individual Libraries.
First, check your Python version using the following command.
I have preinstalled Python on my MacBook, and its version is 2.7. But we need a different version, and that is Python 3.
Do not uninstall the old version because otherwise, some of the mac applications will be stopped. Instead, pull another version of Python by the following command.
brew install python3
Okay, so it will install Python3, and now you can check it using the following command.
Now, you can see that Python3 is installed on our Machine.
Finally, install the following packages using Pip. It is the Python package manager.
python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
So it will install all the dependencies. Now, go to your terminal and hit the following command to start the Jupyter server.
Now, switch to the browser and type this URL: http://localhost:8888/tree
You can see that our Jupyter Notebook server is running correctly.
Getting Started With Jupyter Notebook.
We need to create one notebook. Go into your project folder, and in my case, it is AnacondaProjects.
It is empty, so press the new drop-down in the upper right corner and select python3. You will see something like this below.
I have renamed the title to FirstML. Yours would be untitled. My Browser URL is like this: http://localhost:8888/notebooks/AnacondaProjects/FirstML.ipynb.
Your URL will be different based on your folder structure.
If you have used GitHub before, then I guess you know Markdown Language.
In Github, we are writing this language inside readme.md file. So that the project can be described very well and it can be documented very well.
In Jupyter Notebook, when we need to write something that is not code, we can change it via a drop-down, select the markdown instead, and write some text in markdown language.
For example, If we need to write H1 text in markdown, we can write it using the following syntax.
# Hello Machine Learning
So it will print as an H1 text. Same if we define two hashes, then H2 text, and go on.
Code in Jupyter Notebook.
We can write the code and run the code like the following.
First, if your dropdown says markdown, change it to code and write the code. After that, to run that code type, shortcut shift + enter(return)
You will get an output like the above image. Great!!. So we have set it up all correctly.
This is a basic overview of machine learning and installing the dependencies related to machine learning.
To become a data scientist, R-lang is another great choice to pursue.
That’s it for this tutorial.