Every machine-learning project starts with a question.
Can we estimate what a house will sell for? Can we tell whether a customer is likely to cancel a subscription? Can we identify a defective product before it leaves the factory?
These questions sound very different, but they all have the same basic structure. A model receives information, studies it, and produces an answer.
That structure is built from four important ideas:
- Inputs are the information given to the model.
- Features are the individual pieces of information inside those inputs.
- Labels are the correct answers used during training.
- Outputs are the predictions produced by the model.
Understanding these ideas is one of the first steps in turning a real-world problem into a machine-learning dataset.
Turning a Question Into a Prediction Task
Consider a simple question:
How much will this house sell for?
A property expert might look at the house’s size, location, condition, age, and number of bedrooms. A machine-learning model needs similar information, but it must be presented in a consistent form.
The model might receive:
- Floor area
- Number of bedrooms
- Neighborhood
- Property age
- Distance from the city center
Using this information, it produces an estimated sale price.
The house details are the input. The estimated price is the output.
Once we clearly define what information goes into the model and what answer should come out, we have created a prediction task.
A good prediction task should answer three questions:
- What does one example represent?
- What information is available for that example?
- What should the model predict?
For house-price prediction, one example is one house. The available information includes the property’s characteristics. The model’s task is to predict the sale price.
Inputs and Features
An input is the information a model receives before making a prediction.
An input may contain one value, but it usually contains several. Each individual piece of information is called a feature.
Imagine a company wants to predict whether a customer will cancel a subscription. The input for one customer might include:
- Length of membership
- Monthly payment
- Contract type
- Number of support requests
- Recent account activity
Each item is a feature. Together, the features make up the model’s input for that customer.
Features should be connected to the problem being solved. The number of complaints a customer has made might help predict cancellation. The customer’s favorite color probably would not.
This does not mean that every useful feature has an obvious effect. Machine-learning models can sometimes find relationships that people may not notice immediately. However, the information still needs to be relevant, reliable, and available when the prediction is made.
Labels and Target Variables
During training, a model needs examples with known outcomes.
Those known outcomes are called labels or target variables.
Suppose a company has records from previous customers. Each record contains information about the customer, along with whether that person eventually canceled the service.
A small dataset might look like this:
| Customer | Months as Customer | Monthly Bill | Support Requests | Contract Type | Churned |
|---|---|---|---|---|---|
| A | 4 | $85 | 5 | Monthly | Yes |
| B | 28 | $60 | 1 | Annual | No |
| C | 10 | $95 | 4 | Monthly | Yes |
| D | 42 | $55 | 0 | Annual | No |
The first four information columns are features. The final column, Churned, is the label.
The model studies how the features relate to the known outcomes. Later, when it receives information about a new customer, it can predict whether that customer is likely to leave.
The term label is especially common when the answer is a category, such as:
- Spam or not spam
- Defective or not defective
- Pass or fail
- Churned or did not churn
The term target variable is often used when the answer is numerical, such as:
- House price
- Delivery time
- Monthly sales
- Energy use
In practice, the two terms are often used interchangeably.
Outputs and Predictions
An output is the answer produced by the model.
For a house-price model, the output could be:
Estimated sale price: $285,000
For a disease-classification model, it might be:
Predicted class: Condition B
For a churn model, it could be:
72% probability that the customer will cancel within 90 days
The output is not the same as the label.
A label is the real outcome recorded in the training data. An output is the model’s prediction. During evaluation, the prediction is compared with the real label to see how well the model performed.
For example:
- Real label: Customer churned
- Model output: Customer will not churn
In this case, the prediction was incorrect.
That distinction matters because machine-learning models do not produce guaranteed answers. They produce estimates based on patterns in past data.
Training Data and New Data
During training, the model receives both the features and the correct target.
For example:
| Floor Area | Bedrooms | Property Age | Sale Price |
|---|---|---|---|
| 110 m² | 3 | 8 years | $275,000 |
The first three values are features. The sale price is the target.
The model makes a prediction, compares it with the real price, and adjusts its internal calculations. This process is repeated across many examples.
When the trained model is later used on a new house, the actual sale price is not yet known.
It receives only the input:
| Floor Area | Bedrooms | Property Age |
|---|---|---|
| 125 m² | 3 | 6 years |
The model then produces a predicted price.
This is the practical purpose of training: to learn from examples where the answer is known so that useful predictions can be made when the answer is unknown.
Structured Data
Many machine-learning datasets are organized as tables. This is known as structured data.
Structured data follows a consistent format. Each row usually represents one example, while each column represents a feature or target.
Examples include:
- Customer records
- Property listings
- Sensor measurements
- Sales transactions
- Student results
- Banking activity
Consider this simple student dataset:
| Student | Study Hours | Attendance | Previous Grade | Final Result |
|---|---|---|---|---|
| A | 2 | 58% | 49 | Fail |
| B | 5 | 82% | 68 | Pass |
| C | 7 | 93% | 79 | Pass |
| D | 3 | 64% | 55 | Fail |
Each row represents one student.
The features are:
- Study hours
- Attendance
- Previous grade
The label is:
- Final result
Because every row follows the same format, it is easy to compare examples and prepare the information for training.
Unstructured Data
Not all data fits neatly into rows and columns.
Unstructured data includes information such as:
- Images
- Videos
- Audio recordings
- Emails
- Documents
- Medical scans
- Social media posts
A photograph does not begin as a set of clearly named features such as “edge count” or “shape type.” A paragraph does not begin as a simple list of numerical values.
Modern machine-learning systems can learn useful representations directly from this kind of data.
For example:
- An image model may receive a photograph and predict whether a product is defective.
- A language model may receive a customer review and predict whether its sentiment is positive or negative.
- A speech-recognition system may receive audio and produce a written transcript.
The data format may be more complex, but the basic structure remains the same. The model receives an input and produces an output.
Real-World Example: House Price Prediction
A house-price model estimates the value of a property.
One example represents one house.
Possible features include:
- Floor area
- Number of bedrooms
- Number of bathrooms
- Neighborhood
- Property age
- Lot size
- Recent renovations
- Distance from schools or public transport
The target variable is the actual sale price.
After training on previous property sales, the model can estimate the price of a new house.
This is a numerical prediction problem because the output is a number rather than a category.
A small dataset could look like this:
| House | Floor Area | Bedrooms | Age | Distance to Center | Sale Price |
|---|---|---|---|---|---|
| A | 80 m² | 2 | 15 years | 4 km | $195,000 |
| B | 135 m² | 4 | 6 years | 8 km | $325,000 |
| C | 105 m² | 3 | 10 years | 5 km | $255,000 |
The property information forms the input. The sale price is the target.
Real-World Example: Disease Classification
A disease-classification model attempts to identify a medical condition from patient information.
One example may represent one patient, one appointment, or one medical scan.
Possible features include:
- Age
- Symptoms
- Blood pressure
- Temperature
- Test results
- Medical history
- Scan images
The label is the confirmed diagnosis.
Possible labels might be:
- No condition detected
- Condition A
- Condition B
- Condition C
The model’s output may be a predicted category or a probability for each category.
For example:
Condition A: 10% Condition B: 75% No condition detected: 15%
Medical models require careful testing, strong privacy protections, representative data, and professional oversight. Their predictions should support qualified medical staff rather than replace clinical judgment.
Real-World Example: Product Recommendation
A recommendation system tries to predict which products a customer is likely to find useful or interesting.
One example might represent a customer viewing a particular product.
Possible features include:
- Previous purchases
- Products recently viewed
- Search history
- Product category
- Product price
- Customer ratings
- Time spent on similar product pages
The target depends on what the system is designed to predict.
It could be:
- Whether the customer clicked the product
- Whether the customer added it to a basket
- Whether the customer purchased it
- The rating the customer gave it
A recommendation model may then produce a score for each product and rank the products from most to least relevant.
In this type of system, choosing the right target is especially important. Predicting clicks is not the same as predicting purchases, and predicting purchases is not always the same as predicting customer satisfaction.
Real-World Example: Customer Churn Prediction
Customer churn means that a customer stops using a service.
A churn model attempts to identify customers who may leave within a defined period, such as the next 30 or 90 days.
One example represents one customer.
Possible features include:
- Length of membership
- Monthly payment
- Contract type
- Recent service usage
- Number of complaints
- Late payments
- Support requests
- Satisfaction score
The label might be:
- Churned within 90 days
- Did not churn within 90 days
The output could be a simple category, but a probability is often more useful.
For example:
Predicted churn risk: 81%
The company might use this information to contact the customer, solve a service problem, or offer a more suitable plan.
How to Turn a Problem Into a Dataset
A machine-learning project should not begin with the question, “Which algorithm should we use?”
It should begin with a clear definition of the problem.
1. Define the prediction
State exactly what the model should predict.
A vague goal might be:
Use AI to improve customer retention.
A clearer prediction task would be:
Predict whether a customer will cancel their subscription within the next 90 days.
The second version gives the project a measurable outcome.
2. Decide what one example represents
Each row or example needs a clear meaning.
One example might represent:
- One customer
- One property
- One patient
- One transaction
- One product
- One machine
- One email
If this is not clearly defined, the dataset can quickly become inconsistent.
3. Choose the target
The target should match the real goal.
A retailer trying to increase sales may be tempted to use advertisement clicks as the label. However, clicking an advertisement does not necessarily lead to a purchase.
The target could instead be:
- Product purchased within seven days
- Subscription canceled within 90 days
- Machine failed within 24 hours
- Package arrived after the promised date
A precise target produces a clearer and more useful prediction task.
4. Identify the available features
List the information that will be available when the prediction is made.
Timing is crucial.
Suppose a model is intended to predict customer churn. A feature such as “account closure date” would make no sense because that information is only known after the customer has already left.
Including information from the future can make a model appear highly accurate during testing while making it useless in real life. This is known as data leakage.
5. Check the quality of the data
Before training begins, the dataset should be checked for problems such as:
- Missing values
- Incorrect measurements
- Duplicate records
- Inconsistent categories
- Unclear labels
- Unrepresentative examples
- Features that will not be available during real use
The quality of the model depends heavily on the quality of the data.
Practical Activity: Identify Features and Labels
Below are three real-world problems. For each one, identify the example, features, label, and expected output.
Problem 1: Predicting Late Deliveries
A delivery company wants to predict whether a package will arrive late.
One example represents one package delivery.
Possible features include:
- Delivery distance
- Package weight
- Shipping method
- Dispatch time
- Day of the week
- Traffic conditions
- Weather conditions
- Distribution center
The label is whether the delivery arrived late.
Possible labels are:
- Late
- On time
The model may output one of these categories or a probability of delay.
Problem 2: Predicting Exam Scores
A school wants to estimate a student’s final exam score.
One example represents one student taking one course.
Possible features include:
- Attendance
- Homework average
- Previous test results
- Study hours
- Class participation
- Number of missed assignments
The target variable is the student’s actual exam score.
The model’s output is a predicted numerical score.
Problem 3: Classifying Product Reviews
An online retailer wants to classify reviews as positive or negative.
One example represents one customer review.
Possible inputs include:
- Review text
- Star rating
- Review length
- Product category
- Words and phrases used
The label is the known sentiment of the review.
Possible labels are:
- Positive
- Negative
A more detailed system might also include a neutral category.
The model receives a new review and predicts its sentiment.
Choosing Features Carefully
More features do not automatically produce a better model.
Useful features should be:
- Relevant to the problem
- Available at prediction time
- Recorded consistently
- Accurate enough to trust
- Appropriate to use
Some information may be available but still unsuitable because of privacy, fairness, ethical, or legal concerns.
For example, a company may hold detailed personal information about its customers. That does not mean every piece of information should be used in a model.
Feature selection should be guided by both usefulness and responsibility.
Common Types of Features
Features can appear in several forms.
Numerical features
These represent quantities or measurements.
Examples include:
- Age
- Price
- Distance
- Temperature
- Number of purchases
- Account balance
Categorical features
These represent groups or types.
Examples include:
- Contract type
- Product category
- Payment method
- City
- Machine model
Binary features
These contain two possible values.
Examples include:
- Yes or no
- Active or inactive
- Paid or unpaid
- Warranty or no warranty
Unstructured inputs
Some models work directly with:
- Text
- Images
- Audio
- Video
In these cases, the model may learn useful patterns without every feature being manually defined.
A Simple Planning Checklist
Before building a dataset, try completing these statements:
One example represents __________.
The model receives __________ as input.
The main features are __________.
The model should predict __________.
The target variable is __________.
The prediction will be made when __________.
At that moment, the available information will be __________.
If these statements are difficult to complete, the problem probably needs to be defined more clearly.
Mini Challenge: Predicting Machine Failure
Imagine that a factory wants to predict whether a machine will fail within the next 24 hours.
One example could represent one machine at a particular point in time.
The label might be:
- Failed within 24 hours
- Did not fail within 24 hours
Now choose at least five useful input features.
Possible features include:
- Operating temperature
- Vibration level
- Oil pressure
- Motor speed
- Electrical current use
- Hours since the last maintenance check
- Number of recent error codes
- Average production load
- Machine age
- Time since the last component replacement
A simple dataset might look like this:
| Machine | Temperature | Vibration | Oil Pressure | Hours Since Maintenance | Error Count | Failure Within 24 Hours |
|---|---|---|---|---|---|---|
| A | 68°C | 2.1 mm/s | 42 psi | 120 | 0 | No |
| B | 91°C | 6.8 mm/s | 27 psi | 510 | 7 | Yes |
| C | 74°C | 3.0 mm/s | 39 psi | 210 | 1 | No |
| D | 88°C | 5.9 mm/s | 30 psi | 460 | 5 | Yes |
The sensor readings and maintenance information are the features. The final column is the label.
When designing your own version, think about the following:
- Which measurements may change shortly before a failure?
- How often should the sensor data be collected?
- Would every feature be available before the machine breaks?
- How would the factory confirm that a failure occurred?
- Would different types of machines require different features?
Final Thoughts
A machine-learning model cannot work directly with a broad goal such as “improve the business” or “make the factory safer.”
The goal must first be turned into a specific prediction task.
That means defining:
- What one example represents
- What information the model will receive
- Which features describe each example
- What outcome the model should predict
- How the correct target will be measured
Inputs describe the situation. Features make those inputs usable. Labels provide the correct answers during training. Outputs are the predictions the model produces.
Once these parts are clearly defined, a real-world problem can begin to take the shape of a dataset—and eventually, a working machine-learning system.