Concepts / Regression

Regression

Supervised learning connects inputs with known targets through a collection of examples.

  • Programming

Why Known Answers Matter

Suppose a learning system receives information about a house and must predict its price. The system needs examples that connect housing inputs with known house-price targets. This pairing is the foundation of supervised learning and is what makes the house-price task a regression example.

Supervised learning connects inputs with known targets through a collection of examples. The target is the answer the system is expected to learn; targets are also called annotations.

containscontainspaired withTraining examplesa collectionInputsinformation about anexampleKnown targetsexpected answers
What is contained in each supervised-learning example, and how are inputs connected to their known targets?

From Examples to a Prediction

Supervised learning can be understood as a change in the role of the data. At the beginning, the collection contains inputs together with their known targets. The learner uses those examples to discover a mapping from inputs to targets. After learning, the result is a model that represents this input-to-target relationship. When a new input is presented, the model uses that relationship to produce a prediction.

Tracing a House-Price Prediction

Show how a house-price example moves through the supervised-learning framework.

Collect examples: Begin with examples in which housing inputs are accompanied by known house-price targets.

Learn a mapping: Use the paired examples to discover a relationship between the housing inputs and the known targets.

Present a new input: Provide housing inputs for a new example whose target is not yet being supplied to the model.

Produce a prediction: Use the learned input-to-target relationship to predict the house price.

The task is supervised because the learning examples contain known targets, and it is regression because the stated goal is to predict house prices.

provided toproducesHousing inputsRegression modellearned input-to-targetmappingPredicted house price
How do housing features flow through a regression model to produce a predicted house price?

The essential supervised-learning relationship is not merely data going into a system. It is input data paired with the known target that the system is expected to learn.

House Prices as Regression

The Boston Housing Dataset supplies the data for the regression example. In this example, regression is the approach used to predict house prices. The dataset provides the exercise's data; regression describes the kind of prediction being made with that data.

Part of the exampleRole
Boston Housing DatasetProvides the data
RegressionProvides the approach for predicting house prices
House priceThe target being predicted

The dataset and the modeling task are related, but they are not the same thing.

Target Shapes Define Tasks

The structure of the target determines the supervised-learning task. A target may be a category, a house price, a complete sequence, a syntax tree, a set of bounding boxes, or a pixel-level mask. In every case, the framework remains the same: examples connect inputs with known targets, but the target's form changes what the model must predict.

target formtarget formtarget formtarget formtarget formtarget formClassificationcategoryRegressionhouse priceSequence generationordered outputSyntax-treepredictionnested structureObject detectionobjects and boxesImage segmentationpixel mask
How does the form of the target differ between regression, classification, sequence generation, syntax-tree prediction, object detection, and image segmentation?
  • Sequence generation predicts an ordered output such as a caption. It can be treated as repeated classification, with the system repeatedly choosing the next word or token.
  • Syntax-tree prediction uses a target that describes the nested structure of a sentence.
  • Object detection identifies objects with bounding boxes. It can involve classification of candidate boxes or a combination of classification and regression for predicting box coordinates.
  • Image segmentation identifies the pixels belonging to a specific object by producing a pixel-level mask.

Reading the Keras Import

python

Read the statement from left to right. It imports boston_housing from keras.datasets. After this statement, the boston_housing dataset is available under that name for the regression example.

PartMeaning
fromBegins an import from a specified location
keras.datasetsThe location from which the dataset is imported
importRequests the named item
boston_housingThe dataset name made available by the statement

The import statement selects the Boston Housing Dataset from keras.datasets.

This line makes the dataset available. It does not, by itself, perform regression or produce a house-price prediction.

Mistakes About the Example

  • Treating the dataset name as the name of the prediction method.

    The Boston Housing Dataset supplies the data, while regression is the approach used to predict house prices.

    Fix: Describe the example as regression applied to data supplied by the Boston Housing Dataset.

  • Assuming that importing the dataset completes the learning process.

    The source separates importing the dataset from performing regression with that dataset.

    Fix: Treat the import as the data-access step and regression as a separate part of the overall example.

  • Defining supervised learning only as category prediction.

    Supervised targets can also be house prices, sequences, syntax trees, bounding boxes, or pixel-level masks.

    Fix: Identify the task by examining the structure of its known target.

  • Confusing object detection with image segmentation.

    Object detection identifies objects with bounding boxes, whereas image segmentation marks the pixels belonging to an object.

    Fix: Use bounding boxes for the target description in detection and pixel-level masks for segmentation.

Check Your Understanding

MEDIUM

A learner writes the Keras import statement for the Boston Housing Dataset and then says, “The program has now performed regression.” Is that conclusion correct? Explain the separate roles of the import and the regression example. Then classify each target form: a house price, a caption, a sentence's nested structure, an object's bounding box, and an object's pixel mask.

Hints
  • Ask whether the statement makes data available or applies a learned input-to-target mapping.
  • Identify the target structure before naming the task.
  • A caption is an ordered output, while a pixel mask identifies pixels belonging to an object.

What do you think happens?

What does this statement accomplish by itself: from keras.datasets import boston_housing?

  • It makes the dataset available under the name boston_housing.
  • It performs regression and predicts a house price.
  • It creates a pixel-level image mask.
Reveal answer

Answer: It makes the dataset available under the name boston_housing.

The source distinguishes importing the dataset from performing regression with that dataset. The import is the data-selection step, not the complete prediction process.

Key Takeaways

  1. Supervised learning uses examples that pair inputs with known targets.
  2. The target's structure determines the task, including regression, classification, sequence generation, syntax-tree prediction, object detection, and image segmentation.
  3. The Boston Housing Dataset supplies data for the example, while regression is used to predict house prices.
  4. The statement from keras.datasets import boston_housing makes the dataset available under the name boston_housing.
  5. Importing a dataset and performing regression are separate parts of the overall example.

Key Takeaways

  • Supervised learning connects inputs with known targets through examples.
  • Regression is the approach used in this example to predict house prices.
  • The Boston Housing Dataset provides the data but does not itself perform regression.
  • The Keras import statement makes boston_housing available; it does not complete the modeling task.
  • Different target structures lead to different supervised-learning tasks.