1 Introduction to Machine Learning and Datasets

Learn how machine learning uses examples to build models, how common task types differ, and how to structure and evaluate datasets.

How machine learning works

builds computer programs that learn patterns from examples and use those patterns to predict outcomes or organize new data. Rather than specifying every rule by hand, a developer provides data and chooses a learning method. The resulting captures patterns that can be applied to new examples, and its usefulness depends in part on whether its data represents the problem it will face.

For example, instead of writing rules for every kind of spam email, examples of emails and their known categories can be provided. A can learn associations between email characteristics and categories, then predict a category for a new email.

Common machine learning tasks

The kind of output a should produce helps determine the machine learning problem type. predicts a numerical quantity, such as a home’s sale price or tomorrow’s temperature. predicts a category, such as whether an email is spam or not spam; categories can be binary or have several possible classes.

groups examples by similarity when groups or labels are not provided in advance. For instance, a store might group customers with similar purchasing patterns.

and typically use labeled examples, making them tasks. is a common : it looks for structure in data without labels.

structure and quality

A is a collection of examples. In a common tabular format, each row represents one example and each column records a property of that example. Columns used as inputs are called ; in , the value to be predicted is the or .

In a home , each row might describe one home. Size, bedrooms, and neighborhood are , while sale price is the for a task. If the task instead predicts whether a home sold above $350,000, the is a category and the task is .

can be numerical, such as size, or categorical, such as neighborhood. Datasets can also contain text, images, audio, and other forms of data. Missing values, duplicate examples, incorrect entries, or wrong labels can reduce data quality, so datasets should be checked before use.

Training and testing data

For , a contains examples with and known targets that the uses to learn patterns. A separate is held back to assess how well the trained predicts on examples it did not train on.

For the assessment to be meaningful, test examples should represent the intended use and should not duplicate training examples. Keeping training and test data separate helps assess performance on unseen examples.