Published in

Weave Lab

# Machine Learning for Software Engineers — Part 1: Terms

This is part one of a two-part comprehensive, high-level exploration of Machine Learning for software engineers.

Artificial Intelligence, Deep Learning, Machine Learning, and Neural Networks are all industry-defining 2019 buzzwords. From DeepFakes to self-driving cars, we are seeing the data-harnessing power of Machine Learning. As the industry explodes with potential, there is an ever-growing need for Software Engineers to understand how Machine Learning models work. For most people Machine Learning seems complex, academic, and even unreachable, but with some detailed explanation, it can become a valuable tool on the Software Engineer’s tool belt.

What is Machine Learning?

Have you ever found yourself wondering how Alexa knows what you are saying? How face recognition works? Why you don’t get as many phishing emails as you did 10 years ago? This is because of Machine Learning. So what is this mysterious power that is machine learning?

Let’s take a step back. Imagine you were given the task of writing an app that sorts between even and odd numbers. Easy:

`if x%2! = 0{  fmt.Println("x is odd")} else {  fmt.Println("x is even")}`

Now want to know even, odd, and multiple of 5

`if x%2 != 0{  if x%5 !=0{    fmt.Println("x is odd and not a multiple of 5")  } else {    fmt.Println("X is odd and is multiple of 5")  }} else {  if x%5 !=0{    fmt.Println("X is even and is not multiple off 5")  } else {  fmt.Println("X is even and is a multiple of 5")}`

Now what if you want to know if it is a prime number, or multiple of 100? These kinds of classification problems get out of hand really quickly when every single edge case has to be hand coded.

Just like an “if else” or a “switch” statement, Machine Learning is a tool that software engineers can employ when they are building out services. Instead of using a combination of trial, error, and prayers to hope that all edge cases are accounted for, Machine Learning uses data to determine a model that represents the behavior of the data. This model can then be used to inference new data points and predict new behaviors.

Machine Learning Terms

The AI community has developed a unique vocabulary over the past 50 years. For someone without a background in ML it can be daunting to try to understand these terms. Here are some terms that will appear in this article:

• Feature: An input variable used in making predictions.
• Label: The truth, or inference, that should be determined about data.
• Inference: In statistics, inference refers to the process of fitting the parameters of a distribution conditioned on some observed data.
• Confidence: It, loosely speaking, quantifies the level of confidence that the deterministic parameter is captured by the interval.
• Stochasticity: The quality of lacking any predictable order or plan. Randomness.
• Hyperparameters: The “knobs” that you tweak during successive runs of training a model. For example, learning rate is a hyperparameter.
• Bias: Stereotyping, prejudice, or favoritism towards some things, people, or groups over others.
• MSE: In statistics, the mean squared error (MSE) or mean squared deviation (MSD) of an estimator (of a procedure for estimating an unobserved quantity) measures the average of the squares of the errors — that is, the average squared difference between the estimated values and the actual value.For additional terms you can visit Google’s ML term glossary.

Types of Machine Learning

There are 3 basic types of Machine Learning:

• Supervised Learning
• Unsupervised Learning
• Reinforcement Learning

Supervised learning can represented by the typical American learning model. We go to school and listen to teachers who tell us what is right and what is wrong.

2+2=4

2+2 != 5

The sky is blue.

Roses are red.

Trees are not pink.

It is C-A-T not K-A-T.

In supervised learning we give a model labeled data. We tell the model what the data is and what the data is not. The model then figures out why the data is and is not.

Additionally, we may provide weight to certain parameters in supervised learning. These weight hyperparameters help the model know what data points important. In practice, adding weight may introduce bias and should be done only when working with industry experts (like a radiologist when working on medical image classification).

Unsupervised Learning is similar to learning that is done in a research lab by a scientist. While doing experiments and analyzing results they have the “Eureka!” moment.

In unsupervised learning, data is shoved into the model, but without any labels. The model then does different analysis to determine what the connections are in the data.

This method is much less popular than supervised learning in practice, because we cannot predict the outcomes or use cases as predictably.

Reinforcement learning is often compared to child developmental learning. The model is given a task and a set of actions that it can take to accomplish this task.

For example, say the task is to fit the round block in the bucket, the model can, and will, try to fit the block in the square and triangle hole possibly many times while the model is learning the important features to take into account. Once the model has an understanding of features, it will try to optimize the number of steps until the fewest number of steps is taken to accomplish the task. The model may also learn that taking off the lid is a cheat code for getting all shapes in the bucket.

Types of Machine Learning Problems

Although machine learning problems can be applied to many types of problems, there are three types of problems that have been very successful in the past ten years.

The first is classification. This can be anything from a binary classification to something more complex such as the 23andMe DNA test.

The classic example of a machine learning classifier is your email spam filter. many features are used in a spam filter to determine if an email is spam or not. These parameters can include subject, sender, keywords, content, frequency of receipt, etc. The emails classified as spam are sent to the spam filter. When you classify an email from your inbox as spam, the model is updated to account for the new labeled data you provided.

Next we will consider Machine Learning for pattern recognition. There are many use cases of pattern recognition from unsupervised classification to DeepFakes, but I am going to focus on one very common use case for generation.

GANs, Generated Adversarial Networks, are used for creating many things. In the use case of generating images of people, hundreds of thousands of images of people are fed into the GAN model. The model then detects patterns throughout those images. It uses those images to generate realistic images of humans. It does not photoshop images and they are not composite images of data it was fed, it generated completely original images of humans based on patterns recognized in the data.

Lastly, another major use case of Machine Learning is prediction. All major financial companies are using Machine Learning on time-series data to determine the next financial trend. This can be used for anything from day-trading to insurance rate calculation.

Prediction often uses label data to determine a trend. This trend will forecast what is going to happen next.

With time-series data, especially in the stock exchange, predictions are keeping the model relevant and updated. Online machine learning is often employed in this case.

Machine learning has many techniques, methods, terms, and applications. This part one has only glazed the surface of the artificial intelligence world. Please continue and read part two for examples of machine learning models in action.

--

--

--

## More from Weave Lab

Lessons learned from the Weave development lab

## Miriah Peterson

Data Engineer | ML hobbiest | Golang Evangelist | Presenter