What Is Machine Learning? A 2024 Guide to ML Basics
Learn about the basics of machine learning. Gain a solid footing in the fundamental concepts and applications and learn more about AI fundamentals.
Machine learning is currently one of the big technology buzzwords, in large part because its application across multiple industries is growing rapidly. In fact, you’ve likely encountered it multiple times during your daily routine.
For instance, when scrolling through social media, the articles you’re fed are based on an algorithm. The platform learns what you “like” and in turn shows you more of it. Another common use case for machine learning is voice assistants, such as Siri and Alexa. Because they’ve been fed recordings of human conversations, they understand how to answer your questions.
But what exactly is machine learning and why is it becoming increasingly popular? In this article, we’ll go through the basics of machine learning, the importance of the technology today, and how it relates to terms such as AI and neural networks. More specifically, we’ll cover:
- What is machine learning?
- Why is machine learning important?
- What is the difference between machine learning and AI?
- What is the difference between machine learning and neural networks?
- How does machine learning work?
- What are the types of machine learning algorithms?
- Bias in machine learning
- Cross-validation in machine learning (rotation estimation)
- Regression in machine learning
- Common code languages for machine learning
- Truths about machine learning
What is machine learning?
Machine learning is a form of data science technology where a computer is provided with large data sets and processes them to identify patterns and creates a model based on the data. The more data the computer takes into account, the more accurate and sophisticated its model becomes without developers having to write additional lines of code.
Imagine a simple equation, such as:
x = 2y
x = 2
y = ?
This equation can be very easily solved without machine learning; we don't even need a computer at all. Given an input, we calculate an output. This is how many applications work today: We give the program an input, such as a push of a button, and the application responds with an output.
In machine learning, however, we give the application an input and an output and let the application form the equation that produces the correct output. In our simple example above, we might provide the application with different values of x and y and let the application provide us with the equation: x = 2y.
A non-mathematical example could be a machine learning algorithm that can determine if a picture is of a cat or not. To create the algorithm, we must provide the machine learning application with a data set containing inputs and outputs. The input, in this case, would be a picture of either a cat or something else and an output, which answers if the picture is of a cat or not with a simple yes or no. This is not necessarily a problem with a clear answer—it leaves room for interpretation (e.g., whether a lion should be considered a cat or not). This is why machine learning is such an interesting topic: Given the right data, it might see patterns that even humans might miss.
Why is machine learning important?
One of the most important aspects of machine learning is that it enables decision-making without human intervention. This can save a lot of time for businesses when decisions have to be made based on a clearly defined input because it allows for automation. Machine learning will also eliminate the risk for human error, leaving it to the quality and quantity of the data set fed to the model to determine the output.
In data analysis, mathematical models have previously been created with huge spreadsheets and hours of mining data. Today, however, open-source machine learning and data mining tools can be used even for smaller projects to create the same models with a fraction of the resources spent.
When scaling up your machine learning efforts to handle more complicated problems, you need to process an ever-increasing amount of data to improve your model. This is when you really need to utilize modern cloud computing that provides you with tools for storing and processing large data sets without having to manage the infrastructure yourself. These tools enable you to train your model faster and with larger amounts of data.
What is the difference between machine learning and AI?
Artificial intelligence (AI) is a broader term meaning the creation or simulation of intelligence in machines. Machine learning is one of the tools that we can use to create a type of AI where we give machines access to data and let them learn from the data themselves.
The most basic form of AI software is nothing more than pure logic based on the input it receives. In some cases, these types of software might appear intelligent while the underlying technology has been around since the dawn of programming. Machine learning brings us closer to real intelligence, enabling the software to learn and improve itself based on new data.
What is the difference between machine learning and neural networks?
A neural network is a model whose structure is inspired by the human brain. The network is based on a collection of connected units, called nodes, which each perform a simple computation to act as an input to the nodes it is connected to. The result of all these computations will be the output of the model. A neural network can be used as the underlying model for a machine learning application.
How does machine learning work?
Machine learning is a form of artificial intelligence (AI) that enables computers to learn based on input data and feedback from past experiences, similar to how humans learn. The technology works by processing a data set, identifying a pattern and using that pattern to solve a problem or answer a question. The pattern that it develops is called an algorithm, and is used to sort similar data in the future. Most tasks that today are solved with a pattern defined by data or logical rules can be automated with machine learning.
In practice, all forms of machine learning efforts start with a problem that you want to solve and a data set that you can use to train your model.
The process to start a machine learning application can be summarized as follows:
- Define your question. This is the problem that you want to solve. For example: Given a product on an e-commerce site, what other products are the visitor likely to be interested in? Given the transaction history of a bank account, what is the possibility the account is used for money laundering?
- Collect your data. To be able to create a reliable machine learning model, you need qualitative data for training it. You also need a plan on how to collect fresh data to be able to re-train your model with an up-to-date data set. In the e-commerce use case, you might supply the algorithm with an input of a single purchased product and use the products that the users have bought alongside that product as the output.
- Train your model. Use your data set to train your model and create a testable version.
- Test the model. Test your model by supplying different inputs and observing the output to make sure that it is accurate enough. If needed, refine the model by supplying different data sets or tune the machine-learning framework that you are using until you are satisfied with the result.
These high-level steps are what it takes to create a functional machine learning model. In a real-world use case, models usually need a lot of testing and refining before they can be used in production. Later on, we will go through more detailed examples of frameworks used for machine learning and how they work.
If you want help with starting your machine learning project, make sure to hire machine learning developers on Upwork.
What are the types of machine learning algorithms?
There are many different algorithms that you can use to train and create your model—often referred to as deep learning. In this section, we go through the most common algorithms and how they work.
Supervised machine learning
Supervised learning refers to using labeled data sets to predict outcomes. This is an algorithm that you can use when the output data is already known and is part of the data set that you use to train your model. A real-world example is training your email to correctly classify spam.
Reinforcement learning
Reinforcement learning works by training the model with positive and negative feedback. Given an output from the model, positive or negative feedback is given and the model adjusts accordingly. One example of reinforcement learning is AlphaGo, the AI Go algorithm that ended up becoming the greatest Go player of all time. By playing millions of Go games and getting positive feedback from a win and negative feedback from a loss, the algorithm eventually learned how to play the game in the most optimal way.
Unsupervised learning
In unsupervised machine learning, the training data consists of a set of input parameters without any corresponding output values. The algorithm can then discover hidden patterns or data groupings without the need for human intervention. This makes it a good solution for exploratory data analysis, segmenting customers and image recognition.
Clustering
The grouping of the input values in unsupervised learning is called clustering. Clustering algorithms are used to process data into groups expressed as patterns or structures in the data set. Marketers, for example, can use clustering to help identify different segments within their target audience.
Dimensionality reduction
Dimensionality reduction can be used when the number of features or dimensions in a data set is too high. Using dimensionality reduction, data can be transformed to reduce the number of dimensions to simplify analysis or further processing.
Semi-supervised learning
In semi-supervised learning, the data set contains both inputs with a corresponding output value, as well as inputs missing an output value. Since gathering complete data sets for supervised learning can be resource-intensive, this can be a great way to make the most out of the complete data set you can acquire while improving the accuracy with non-complete data. An instance where semi-supervised learning can be useful is in speech recognition and analysis.
Multi-instance learning
In some cases, such as when trying to detect cancerous cells in high-resolution X-ray images, each input value (the image) is simply too large to process individually. To solve this problem, the image can be split up into many smaller images while still associated with the same output value (whether cancerous cells were detected or not) as the original image. Each part of the image can then be fed to the machine learning model individually and used for training. The end result is a model that can process a complete image and give you a prediction based on the data set in the form of split images.
Bias in machine learning
Earlier, we mentioned one of the big advantages of machine learning being that they can offload human decision-making to free up time and resources. There’s, of course, risk involved with letting a computer make decisions for us. Data sets that contain information produced by humans might also contain their biased opinions. There might also be a risk that the data set does not provide a complete representation of reality.
One example of this is a model that was trained to pick the most likely candidates to get hired based on their resume. The model was fed resumes from an HR system as the input and whether they were hired or not as the output. Since the company where the data was gathered consisted of mostly white males, the algorithm favored white males in the selection of the resumes.
To avoid the risk of bias and inaccuracy, the first step is to make sure you have a reliable data set. In the example above, it might have been beneficial to redact some data to only have the model analyze the experience and skills that the applicant had listed in their resume. In other cases, it’s good to carefully consider the source of the data and any possibilities to widen the sources you gather it from. The next step is making sure to test your model and re-train it based on the outcomes of the tests.
Refining your data set and re-training your model is part of a continuous process when working with machine learning. To get reliable results, continuously feed the model with updated data and tweak it based on feedback.
Cross-validation in machine learning (rotation estimation)
One method to estimate the accuracy of your machine learning model is cross-validation. In this approach, a randomized subset of your dataset is selected as test data and excluded from your training data. When you have trained your model, this subset is used to test your model. To carry out the test, you simply give your model an input X and make sure that it corresponds to the output Y. The results are expressed as the mean score your model performed given the test data set.
Some reasons you would want to cross-validate include:
- Fine-tune parameters so you get the most accurate use of your data
- Check for any imbalances in your data points
- Test the effectiveness of your machine learning model
Regression in machine learning
Using regression, you can predict a value based on a machine learning calculated regression line. A typical example could be to calculate the price of a house in an area given its size. Then, a machine learning model can be fed the prices of houses in the area and their size, and the model will calculate an equation that represents the regression trend for the prices. Regression works very well for numerical data sets with a given input and output value.
Clustering in machine learning
A segment of unsupervised learning, clustering in machine learning helps to find meaningful structure or patterns in unlabeled data. As we mentioned in the marketing example earlier, clustering would be used to sort through all of the data points you have on your customers to help you identify patterns and trends, which can help make your marketing strategy much more effective.
Common code languages for machine learning
Once you start working with machine learning, you will need to do some coding to create your model. In this section, we go through some common languages for machine learning and how they are used to create a model.
- Python is one of the most common languages for machine learning with the library SciPy, which enables you to easily create your first model. Python has been the preferred language for data scientists for a long time and there is a lot of material on how to use it for machine learning on the web.
- R is a language specifically developed for statistical analysis. One of the central libraries for predictive modeling is caret, which can be used for both classification and regression.
- JavaScript is one of the most common languages for both front-end and back-end development, so why not use it for machine learning, as well? The Google-developed library TensorFlow provides you with the tools you need to easily build and deploy ML-powered applications.
- While C++ might be most widely known for game programming, the faster run time is well-suited for machine learning applications.
- Lisp is especially suited for symbolic artificial intelligence because of its performance and ability to manipulate complex information.
- Scala with the Spark OpenNLP library provides machine learning capabilities suited for the enterprise with its strongly typed and compiled language.
- Microsoft's open source .NET platform also provides great machine learning capabilities with the added bonus of ready-to-use services in the Azure cloud.
Common examples of machine learning
As initially stated, machine learning has applications in many different industries. In this section, we go over some common use cases in different industries.
Health care
The health care industry can use machine learning in many different ways. One example is the aforementioned detection of cancerous cells in an X-ray image. The same type of image recognition technology can be used to identify other types of diseases at an earlier stage than a human would. Another use case is to classify a patient's need for health care based on how they describe their symptoms. There are also discussions of using machine learning in health care in a predictive nature to help patients catch diseases before they develop based on their own medical history.
Note that the accuracy of machine learning models in health care is of utmost importance; they need to be tested thoroughly before they can be applied in real-world scenarios. They can, however, assist a medical professional in making decisions.
Financial
Machine learning models can help predict potential financial scenarios based on a number of factors. The numerical nature of the finance industry provides a lot of opportunities for using machine learning to answer financial questions and calculate risks. Some specific examples include:
- Financial apps: There are now many personal finance apps available to help you identify trends in your spending habits.
- Fraud detection: Machine learning can be used to help identify fraud by identifying anomalies in your spending patterns.
- Better trade decisions: Traders can now use previous data to help their clients make better-informed financial decisions.
E-commerce/retail
In the e-commerce sector, machine learning is already used today to provide product recommendations to users with the aim to increase sales. Machine learning algorithms might also be used to determine the best time to send you a marketing email or present you with a discount code, for instance. Machine learning is also used to create chatbots to help answer any questions you might have about a product. Cookies are also used to help sites show visitors specific items that they would be interested in buying.
Truths about machine learning
When it comes to machine learning, here are some strong truths:
- Machine learning is all about data. When we talk about AI, we might think of a technological being that learns purely from its surroundings. With machine learning, we need to provide those surroundings with data.
- Transforming data can be one of the most time-consuming tasks in machine learning.
- For data set optimization, you need to prioritize data of high quality and quantity.
- In some cases (e.g., self-driving cars crashing), we are eager to exaggerate the risks of machine learning when the risk of crashing might be statistically lower than with a human behind the wheel.
- Machine learning and AI use cases aren’t as limited as you may think, and you can often find solutions that use data in real-time.
- In some cases, linear regression analysis without the use of machine learning might be a simpler alternative with comparable results.
- Although it is a relatively new sector of computer science, it isn’t hard to find professionals who have built and deployed machine learning solutions.
- Machine learning and AI won't take over humanity. While creations using machine learning technology might sometimes look smart, we are far away from creating something that resembles or can relate to a human being.
Conclusion
Machine learning algorithms are all around us today and their applications will definitely keep growing during the coming years. In the future, machine learning models and other forms of data science might help us make very important decisions in our lives. This comes with both great opportunities and great risks. We need to make sure machine learning and big data is used responsibly and put processes in place to ensure the quality of their output.
If you want to know more about how machine learning works and the different machine learning methods, connect with a machine learning expert via Upwork today.