An Introduction to Machine Learning with R

Jules and Vincent introduce machine learning as algorithms that improve with more data. They walk through a supervised classification example: predicting square colors from size and edge type. The video covers organizing data in R with data frames and formalizing the problem as estimating a function that maps input features to output labels.
Chapters
Hello and welcome to the first video of the Introduction to Machine Learning course. My name is Jules. I'm a content creator at datacamp and in this course, me and my colleague Vincent will explain some general concepts about machine learning. After this course, you'll be able to tell what machine learning is and what it isn't. You'll be able to solve some basic machine learning problems and be able to think critically about your data and your results. But first things first. What on earth is machine learning? At a very basic level, machine learning explores the construction and usage of algorithms that can learn from data. But when does a machine actually learn? We can say that the machine has the ability to learn if it is able to improve its performance when it receives more information. This experience typically comes in the form of observations on how particular instances of a problem were solved before. Maybe an example will clarify a possible task for a computer. Gravity Label squares with a color based on the square's size and the square's edge. Initially, the computer has no idea how to do this. However, suppose that the number of squares were labeled earlier by humans. For example, a small dotted square was labelled green. A big striped square was said to be yellow. A medium sized square with a normal edge was labelled green as well. And lastly, a small striped one was labeled yellow. A machine learning algorithm can use these observations or instances to do an informed guess about how to label an unseen square. An example could be a medium striped square. The computer can be right or wrong in doing so. This specific example was a classification problem. There are many types of machine learning problems. Some are related and others are pretty exotic. A concept that keeps popping up is the presence of input knowledge or simply data. In our example it was a set of human labeled squares. In other examples it can be something totally different. Typically, this data is a data set containing a number of observations that each have a well defined number of variables, often called features. Each square and its corresponding color is an observation. The features in this case are the size and the edge. The color is the label of the square. As you are well aware in R, a data set is typically represented by a data frame. Have a look at this code that builds the square data frame for our example. In a data frame, the observations correspond to the rows and the columns correspond to the variables. To find out the dimensions of your dataset, you can use the dim function. The structure function, on the other hand, gives a more structured overview of our data, also showing how many observations and variables the dataset comprises. Another function you can use to observe your data is the Summary function. This function will also give you information on on the distribution of each feature. Ok, let's dig into a more theoretical formulation of our example. The problem here is labelling a square. This is actually applying some function on the inputs to generate an output. The size and edge variables of the square go in and the label variable color comes out. A machine learning algorithm tries to find a way of labeling the square. So we're actually trying to estimate the function here. This function could be estimated based on the previous observations of how the problem was solved. Ideally, the function you're building is generally applicable and can handle all kinds of reasonable inputs. If we put in the unseen example, the medium striped square with an unknown label, the function will guess a color for us. It's very important to see when you're actually dealing with the machine learning problem. When you're simply calculating, for example, the most occurring color of squares in your data set, or calculating the average size of your squares, you're not doing machine learning. The entire point about machine learning is trying to build a model that can help make predictions about your data or future instances of similar problems. Don't let these general formulations of machine learning confuse you. Some very common problems can actually be thought of as machine learning. Do you know about linear regression? You can use it to make predictions on your data. Suppose you've got some data about a group of people, their height and their weight. You can use regression to make a function which which can predict the height of a new person given their weight. You do this by using the given data about the known height and weight of the first group of people. There are so many other examples to machine learning, such as shopping basket analysis, movie recommendation systems, decision making for self driving cars and what not. But let's take this step by step. In the upcoming exercises, you'll consolidate the main ideas about machine learning and take your first gentle steps in this exciting field.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







