Suppose you have a table of pets. Each row describes one pet, with columns such as size, type, and weight. Which column is the label? It depends on your question. To predict whether a pet is a cat or dog, type is the label. To predict its weight, weight is the label. The other columns used to make that prediction are features. section 2.1
A label is the value a model tries to predict from an example’s other features. The model’s guess is a prediction—not the label already recorded for that example. Labels can be types, such as spam or not spam, or numbers, such as a house price. Data with a target label is labeled data; data without one is unlabeled data. section 2.1 section 2.5
Figure 2.1 Labeled data is data that comes with a tag, or label. That label can be a type or a number. Unlabeled data is data that comes with no tag. The dataset on the left is labeled, and the label is the type of pet (dog/cat). The dataset in the middle is also labeled, and the label is the weight of the pet (in pounds). The dataset on the right is unlabeled.
Compare three pet datasets: one labels each pet by type, another by weight, and the third has no label. section 2.1
A missing house price
Imagine a table with each house’s number of rooms and price, except that the four-room house has no recorded price. Here, rooms are the feature and price is the label to predict. A model using Price = 100 + 50 × (number of rooms) predicts 300 for that house. The 300 is the model’s prediction for its missing label. section 3.2
Labels also help choose and check a model. In a decision tree, a leaf can predict its most common label; comparing label mixtures helps decide which split is better. For model evaluation, keep features and their corresponding labels together when dividing data into training, validation, and test sets. Then compare predictions with the labels held in the evaluation sets. section 9.2 section 13.4
features = data.drop(["Survived"], axis=1) labels = data["Survived"]
This code separates a survival table into the columns used for prediction and the Survived label. section 13.4
Try choosing a question for a table you know. Name the column you would predict, identify the columns you would use to predict it, and check which rows already have a recorded label. section 2.1



















