A Closer Look at Machine Learning

Joshjnunez
6 min readAug 29, 2020

--

If you are at all interested in the ever-evolving world of technology, chances are you have heard the term ‘machine learning’. Nowadays, this concept seems to be all the rage — and for good reason. Though it is more popular today than it has ever been, the concept of machine learning has actually been around for quite some time. Today, I would like to take a closer look at machine learning in order to better understand the fundamentals that make up this seemingly impressive concept.

“The study that gives computers the ability to learn without being explicitly programmed.”

The early days of machine learning can be traced to the 1950s, and the term itself is said to have been popularized by American computer scientist, Arthur Samuel. Samuel described machine learning as “the study that gives computers the ability to learn without being explicitly programmed”. It focuses more on developing programs that teach computers to change when exposed to new data. Its goal is to understand and follow the methods by using algorithms to do that task automatically without any human assistance.

Types of Machine Learning

Machine learning is generally classified into three separate categories: Supervised Learning, Unsupervised Learning, and Reinforcement Learning.

Supervised Learning

This type of machine learning is the most basic, but can be very effective if used correctly. With supervised learning, the algorithm should utilize data that has been labeled in advance. This is usually a smaller data set that may be representative of much larger data. The smaller dataset is what’s called a “training dataset” and serves as a reference for the algorithm to understand the problem.

While using the training dataset, the algorithm can make connections between the data and establish relationships based off the input and output of the dataset. Once the training has been accomplish, the solution can be deployed with the final, much bigger, dataset. The algorithm can then take what it has learned from the training and apply to the new data.

Two of the most common supervised machine learning tasks are classification and regression. Computer programmer, Javaid Nabi, describes the task as follows:

In classification problems the machine must learn to predict discrete values. That is, the machine must predict the most probable category, class, or label for new examples. Applications of classification include predicting whether a stock's price will rise or fall, or deciding if a news article belongs to the politics or leisure section. In regression problems the machine must predict the value of a continuous response variable. Examples of regression problems include predicting the sales for a new product, or the salary for a job based on its description.

Unsupervised Learning

The main difference between supervised and unsupervised learning is that the algorithm doe not need to have labeled data. In unsupervised learning, human labor is not required to make the dataset machine-readable. This allows much larger datasets to be worked on.

Because the algorithm does not have labels to work off of, it instead creates ‘hidden structures’ by interpreting the data in an abstract manner. For this reason, unsupervised learning is far more versatile than its counterpart. The hidden structures can be reinterpreted whenever it comes across new data.

Reinforcement Learning

The third category in machine learning is called reinforcement learning. It’s much different from the previous two in that it learns from the consequences of its actions, rather than from being explicitly taught and it selects its actions on basis of its past experiences.

Reinforcement learning features an algorithm that improves upon itself and learns from new situations using a trial-and-error method. If the result is unfavorable, the algorithm should attempt to find a better solution. This is done effectively with a reward system.

Putting Machine Learning Into Practice

To get an even closer look at machine learning, I feel it is worth reviewing a popular algorithm that is attributed to supervised learning with regressive tasks.

The algorithm known as Decision Tree, uses the supervised learning approach to predict the personality type of a user.

With each click of a button, the personality tree grows until it fills your complete personality type:

ENTP Personality

Below is the node data for each personality type. You can see how with each iteration, the personality adds an additional attribute. For mine, I started with ‘E’ and ended with ‘ENTP’ to get my final result.

var nodeDataArray = [  
{ key: "Start" }, // the root node
// intermediate nodes: decisions on personality characteristics { key: "I" },
{ key: "E" },

{ key: "IN" },
{ key: "IS" },
{ key: "EN" },
{ key: "ES" },
{ key: "INT" },
{ key: "INF" },
{ key: "IST" },
{ key: "ISF" },
{ key: "ENT" },
{ key: "ENF" },
{ key: "EST" },
{ key: "ESF" },
// terminal nodes: the personality descriptions
{ key: "ENTP",
text: "ENTP: Inventor\nExercise their ingenuity by dealing
with social, physical, and mechanical
relationships. They are always sensitive to
future possibilities. 5% of the population."
}

Lastly, you can see how the algorithm takes an iterative approach to assemble the personality type using a for loop and a switch statement.

for (var i = 0; i < nodeDataArray.length; i++) { 
var d = nodeDataArray[i];
if (d.key === "Start") {
d.category = "decision";
d.a = "I";
d.aText = "Introversion";
d.aToolTip = "The Introvert is “territorial” and desires space and solitude to recover energy. Introverts enjoy solitary activities such as reading and meditating. 25% of the population.";
d.b = "E";
d.bText = "Extraversion";
d.bToolTip = "The Extravert is “sociable” and is energized by the presence of other people. Extraverts experience loneliness when not in contact with others. 75% of the population.";
} else {
switch (d.key.length) {

case 1:
d.category = "decision";
d.a = "N";
d.aText = "Intuition";
d.aToolTip = "The “intuitive” person bases their lives on predictions and ingenuity. They consider the future and enjoy planning ahead. 25% of the population.";
d.b = "S";
d.bText = "Sensing";
d.bToolTip = "The “sensing” person bases their life on facts, thinking primarily of their present situation. They are realistic and practical. 75% of the population.";
break;

case 2:
d.category = "decision";
d.a = "T";
d.aText = "Thinking";
d.aToolTip = "The “thinking” person bases their decisions on facts and without personal bias. They are more comfortable with making impersonal judgments. 50% of the population.";
d.b = "F";
d.bText = "Feeling";
d.bToolTip = "The “feeling” person bases their decisions on personal experience and emotion. They make their emotions very visible. 50% of the population.";
break;
case 3:
d.category = "decision";
d.a = "J";
d.aText = "Judgment";
d.aToolTip = "The “judging” person enjoys closure. They establish deadlines and take them seriously. They despise being late. 50% of the population.";
d.b = "P";
d.bText = "Perception";
d.bToolTip = "The “perceiving” person likes to keep options open and fluid. They have little regard for deadlines. Dislikes making decisions unless they are completely sure they are right. 50% of the population.";
break;
default:
d.category = "personality";
break;
}
}

Conclusion

Machine learning is an interesting topic that requires far more of an explanation that what was given today. I hope by reading this you have become inspired to learn more about the concept and develop a deeper understanding.

Check out https://gojs.net/latest/samples/decisionTree.html to try your hand at the decision tree and look at some more of the source code that makes this algorithm so intriguing!

--

--