Supervised and unsupervised learning: understanding the target
The difference between supervised and unsupervised learning lies in what guides the learning process. In supervised learning, each training example comes with a known answer: the target, the value you want to predict. In unsupervised learning, no target is supplied to guide that analysis; the method looks for structure in the data. A table containing an exam score column does not, by itself, determine the type of learning.
Using the same student information, you might try to estimate a final exam score or group observations that resemble one another. These questions give the data different roles. By the end of this lesson, you will be able to identify a target, distinguish it from the input features and explain what changes when learning proceeds without a target. This distinction follows the learning approaches introduced by Google.
Contents
Reading a table: inputs and target
An observation is one example described by the data: here, a row about a student. A variable is a characteristic recorded in a column, such as weekly study hours or the final exam score. Input features, often denoted by X, are the information you give the model. The target is usually denoted by y. These conventions are also used in the scikit-learn glossary.
Take the first observation in the “Données” worksheet. Suppose our question is: “Can we estimate the final exam score from study hours, attendance and previous scores?” The columns then have the following roles:
| Variable and role | Observed value |
|---|---|
Hours_StudiedInput: study hours. | 23 hours per week |
AttendanceInput: percentage of classes attended. | 84% |
Previous_ScoresInput: previous exam scores. | 73 points |
Exam_ScoreTarget: final exam score. | 67 points |
The three inputs describe this observation; 67 is its recorded answer, not an estimate produced by a model. During training, each row of X must remain paired with its own value of y. Pairing one student’s inputs with another student’s score would give the model incorrectly assigned answers.
“Input” describes a role, not a cause. Using study hours as an input does not show that changing those hours would cause a particular change in the score. This example poses a prediction question; establishing a causal relationship requires a separate investigation.
Supervised learning: learning from known answers
In supervised learning, the model learns from examples with known inputs and answers. Training is this learning stage: the values of y provide a reference for fitting the relationship between inputs and output. In our example, the model receives several observations with study hours, attendance, previous scores and the final exam score. It learns a relationship for estimating the final score from the inputs.
“Supervised” does not mean that someone manually corrects every prediction during training. The supervision comes from the answers associated with the examples. They may already be in the file, as Exam_Score is here. The scikit-learn documentation on supervised learning presents methods that use this approach.
A target can be a quantity or a category
If you want to estimate the final score in points, the target is a numerical quantity: the task is regression. If you want to predict a predefined category, the task is classification. Both are supervised learning tasks because the training examples come with known answers. A classification answer is often called a label: it identifies the category assigned to an observation.
Now consider a separate classification dataset. Its target is Result, already filled with Success or Fail. Study hours, attendance and previous scores can serve as inputs. The model learns to predict the supplied category; it does not create the labels. In this dataset, Result is the only target and Exam_Score is excluded.

The choice between a quantity and a category depends on the answer the project needs. Merely finding numbers in the data is not enough: a category can be encoded as a number, while an integer exam score can be a regression target.
The target is unknown when you make a prediction
Prediction means applying the trained model to new inputs. To estimate a score before an exam, you supply information available at that time, without the final score you are trying to obtain. The model returns an estimate whose accuracy still needs to be evaluated.

An application form could therefore ask for study hours, attendance and previous scores, then display an estimated final score. It would not ask the user for that final score: that is the answer being sought.
The absence of y for this new student does not turn the model into an unsupervised method. It was trained with known answers. To measure its predictive ability, we also set aside observations whose targets are known but which the model did not use for training. Their targets are then used to compare estimates with recorded values.
Data used to choose a model or tune its settings must be distinguished from the final test data. The final test estimates performance after those modelling choices. Repeatedly consulting it to improve the model would undermine its role as an independent check.
Unsupervised learning: finding structure without a target
In unsupervised learning, no target answer is supplied to guide learning for that analysis. The method examines the inputs for structure, such as similar observations or a more compact representation. The scikit-learn documentation covers several such tasks, including clustering and dimensionality reduction.
Return to the inputs with a different question: “Which observations resemble one another in their study hours and attendance?” For this analysis, X contains Hours_Studied and Attendance. No target column is supplied to guide how the groups are formed.
Clustering groups observations according to a similarity criterion. The method produces the groups; their names and interpretation are not given as answers beforehand. Calling a group “good students” on the basis of study hours and attendance alone would add a judgement that the analysis does not establish.
Dimensionality reduction seeks to represent data with fewer variables while retaining as much useful information as possible. Some methods construct new variables from the original ones. This can support exploration or visualisation without necessarily producing groups. Unsupervised learning therefore extends beyond clustering.
Comparing supervised and unsupervised learning

| Supervised | Unsupervised |
|---|---|
| Question. What answer should be predicted from the inputs? | Question. What structure should be explored in the inputs? |
| Target. A known answer paired with each training example. | Target. No target supplied to guide this analysis. |
| Example. Estimate a final score using information available before the exam. | Example. Group observations by study hours and attendance. |
| Check. Compare predictions with targets for observations not used for training. | Check. Examine the coherence, separation and stability of the resulting structures, as appropriate for the task. |
Clustering can be evaluated even without reference categories. You can examine how close observations are within a group, how separated the groups are or how stable they remain when data and settings vary. Known categories can also be used for comparison after clustering without having guided its construction. The documentation on clustering evaluation distinguishes these situations. A favourable indicator does not prove that the groups represent useful educational categories.
Choose the approach from your question
Describe the expected output before choosing an algorithm. Google’s guidance on framing an ML problem emphasises the target and the information available at prediction time.
- Define the required result. Do you want an estimated score, a predefined category or an organisation of the observations?
- Check which answers are available. Learning to predict final scores requires examples accompanied by those scores. A prediction objective without usable answers does not automatically become a clustering project.
- Select usable inputs. For prediction before an exam, use information actually available before that exam.
- Plan the evaluation. Decide how you will examine prediction errors or the usefulness of the structures found. Judge the method against the question it is meant to answer.
Other approaches exist when only some observations have a target, such as semi-supervised learning, which uses examples with and without known answers.
Exercise: identify the target’s role
For each situation, identify the learning approach, the inputs and the role of Exam_Score. Explain your answer in one sentence.
- You use study hours, attendance and previous scores to learn to estimate a final score that is known in the training examples.
- You group observations by study hours and attendance without supplying their final scores to the clustering method.
- A model trained with final scores receives the inputs for a new observation whose final score is not yet known.
- After forming the groups in the second situation, you consult final scores to describe each group more fully.
Show the explained answers
- Supervised learning. X contains study hours, attendance and previous scores; y is Exam_Score. The known answer guides training. The numerical target makes this a regression task.
- Unsupervised learning. X contains study hours and attendance. Exam_Score does not guide group formation, and no expected categories are supplied.
- Prediction by a supervised model. The inputs have the same meaning as during training, and the final score is the value to estimate. Its absence for this new observation does not change how the model was trained.
- Description after unsupervised clustering. Final scores provide additional information for interpreting groups already formed. If you then use those scores to select or alter the clustering, they begin to guide your choices; that changed procedure must be made explicit.
Common mistakes involving the target
Including the target, or information revealing it, in the inputs
In the regression dataset, supplying Exam_Score as an input to predict that same score already gives the answer to the model. In the classification dataset, the same problem occurs if Result is supplied to predict Result. Each task’s target must stay outside X: it will be unknown at the intended prediction time. This is data leakage; see the scikit-learn explanation of data leakage.
The check also covers variables derived from the target and information collected after the exam. Separating X and y therefore requires understanding the fields, rather than merely removing one particular column name.
Inferring the learning approach from the file’s contents
A table containing exam scores can support unsupervised analysis if those scores do not guide the analysis. Conversely, known categories need not be inputs: they can be the target of a classification task. A column’s role follows from the question and how it is used.
Confusing discovered clusters with predefined classes
In the classification dataset, Success and Fail are categories already supplied in Result. Groups formed from study hours and attendance are instead produced by a clustering method. Naming them afterwards does not retrospectively turn them into answers supplied during training.
Key points and the next step
Supervised learning uses known answers to learn to predict a target. Unsupervised learning looks for structure without a supplied target guiding that analysis. The same source data can support both approaches; the question and the role of each column distinguish them.
Sources and further reading
- Aurélien Géron, Hands-On Machine Learning with Scikit-Learn and PyTorch, O’Reilly, first edition, first release 22 October 2025. Chapter 1, “Training Supervision”, pp. 10–16, and “Testing and Validating”, pp. 35–37; chapter 2, input and target notation, pp. 45–46, and scaling, pp. 77–78; chapter 8, clustering evaluation and limitations, pp. 256–259. The author’s official resources.
- Google — What is machine learning?: learning approaches, regression and classification.
- scikit-learn — the target, supervised learning and unsupervised learning: terminology and an overview of methods.
- Google — Framing an ML problem: defining the output and usable inputs.
- scikit-learn — evaluating clustering and avoiding data leakage: technical reading after this lesson’s foundations.
- Student Performance Factors — Lai Ng., Kaggle: the data source. Field names, units and example values were checked against the “Données” and “Description des champs” worksheets of StudentPerformanceFactors.xlsx.