What is machine learning? Machine learning is a branch of computing in which a system uses data to identify patterns and improve its performance on a task, rather than relying only on every rule being written explicitly by a programmer. A machine-learning model is trained using examples or feedback, then used to make predictions, classify information, generate outputs or support decisions.
Machine learning is part of the wider field of artificial intelligence (AI), but the terms are not interchangeable. AI is the broader goal of creating systems that perform tasks associated with capabilities such as perception, reasoning, language or decision support. Machine learning is one set of methods used to build such systems. Some AI systems use fixed rules and do not learn from data; many modern AI applications rely heavily on machine learning.
Quick notes: Training is the process of adjusting a model using data. Inference is using the trained model to produce an output for new input. Supervised learning uses labelled examples; unsupervised learning looks for structure in data without target labels; reinforcement learning learns through actions and feedback. Good machine learning requires suitable data, testing on data not used for training, monitoring and human oversight where decisions affect people.
How machine learning works
A conventional program follows rules written by developers. A machine-learning system is given data and a learning method that adjusts model parameters so its outputs better match a training objective. After training, the model can apply patterns it has learned to new information.
- Define the task: decide what the system should predict, classify, rank, detect or generate.
- Collect data: obtain examples that reflect the task and the population or environment where the model will be used.
- Prepare the data: clean errors, handle missing values, select useful features and protect personal information.
- Train the model: use a learning algorithm to adjust the model so that it performs better against the training objective.
- Evaluate it: test performance on data that was not used to fit the model and examine errors across relevant groups and conditions.
- Deploy and monitor: use the model in an application, watch how it performs as real-world data changes and update it responsibly when necessary.
The model does not automatically learn the right lesson just because it sees a large dataset. The examples may be incomplete, biased, outdated or incorrectly labelled. The objective may reward the wrong behaviour. Evaluation must therefore test whether the model is useful for the real task, not just whether it performs well on its training data.
What is a machine-learning model?
A model is the mathematical or computational structure that represents patterns learned from data. It may contain parameters such as weights, thresholds, coefficients or tree decisions. During training, a learning procedure adjusts these parameters to reduce a defined error or improve a performance measure.
A model is not the same as the dataset, algorithm or application. The dataset provides examples; the learning algorithm specifies how parameters are adjusted; the trained model stores the learned pattern; and the application decides how to use the model’s output.
The three common types of machine learning
1. Supervised learning
Supervised learning uses examples that include both inputs and target answers, often called labels. The model learns a relationship between the inputs and the target. It can then predict a target for new inputs.
For example, a model might be trained on past house-sale information where each example includes property features and the final sale price. The trained model can estimate a price for a new property with similar types of information. The estimate is not a guarantee; it depends on the data, model, market conditions and how closely the new case resembles the training examples.
Supervised learning is commonly used for classification and regression. Classification predicts a category, such as whether an email is likely to be spam. Regression estimates a numerical value, such as delivery time or energy demand.
2. Unsupervised learning
Unsupervised learning uses data without supplied target labels. The system looks for structure, groupings or patterns. Clustering is a common example: a model groups records that appear similar under selected measurements.
A retailer might use clustering to explore groups of customers with similar purchasing patterns. The groups are not automatically meaningful customer types. A human analyst must examine whether the patterns are stable, useful and appropriate before using them to guide decisions.
3. Reinforcement learning
Reinforcement learning trains an agent to choose actions in an environment. The agent receives observations, takes actions and gets feedback in the form of rewards or penalties. Over repeated interactions, it learns a policy intended to improve long-term reward.
This approach is used in research on robotics, game-playing and control systems. It can be difficult to apply safely when real-world actions have costs or risks. A simulated environment may not fully represent the real world, and a poorly designed reward can encourage unintended behaviour.
What about generative AI?
Generative AI is a class of systems that produce new content, such as text, images, audio, video or code. Many generative systems use machine-learning models trained on large datasets. A language model, for example, learns statistical patterns in sequences of text and uses them to generate a continuation based on a prompt and its context.
Generated output can be fluent and still be wrong. A model may make unsupported claims, omit important context, reproduce bias or invent details. Users should verify factual statements, especially when the output will affect money, health, legal duties, safety or an important decision.
What are features, labels and predictions?
- Feature: an input variable used by a model, such as date, temperature, product category or a measured characteristic.
- Label: the target answer attached to a training example in supervised learning, such as ‘spam’ or ‘not spam’.
- Training: adjusting the model using a training dataset and learning procedure.
- Prediction: the model’s output for an input, such as a category, score or estimated value.
- Inference: running a trained model to produce an output in a real application.
An example makes the terms clearer. To predict whether a delivery may be late, features might include distance, weather, time of day and traffic conditions. Past delivery records with actual arrival times can provide labels or targets. The trained model may estimate delay risk for a new delivery. If the historical data systematically missed certain neighbourhoods or unusual weather, the prediction can be unreliable in those cases.
How do we know whether a model is good?
A model should be evaluated on data that it did not use during training. This helps measure whether it can generalise to new examples rather than merely memorise the training set. Depending on the task, evaluation may use accuracy, precision, recall, error measures, calibration or other metrics.
No single metric is right for every problem. In spam detection, false positives may hide important messages. In a safety alert, missing a dangerous event may be more serious than investigating an extra alert. Model evaluation should reflect the real consequences of different errors.
Overfitting and underfitting
Overfitting
Overfitting happens when a model learns details or noise specific to its training data and performs poorly on new data. It may appear highly accurate during training but fail when conditions change or unfamiliar examples arrive.
Underfitting
Underfitting happens when a model is too simple, poorly trained or lacks useful information to capture the relationships in the data. It performs poorly even on the training examples.
The aim is not to make the model as complicated as possible. A good model balances performance, reliability, interpretability, cost and the consequences of error. Simpler systems may be preferable when they are sufficiently accurate and easier to test or explain.
Why data quality matters
Machine learning reflects the data and design choices behind it. Incorrect measurements, missing groups, inconsistent labels, old examples or duplicated records can mislead the training process. A dataset may also contain historical unfairness. A model trained to imitate past decisions can reproduce the same unfair patterns even if the code contains no explicit instruction to discriminate.
- Representativeness: does the data reflect the people, places and conditions where the model will be used?
- Accuracy: are the values and labels correct enough for the task?
- Coverage: are important cases missing, under-recorded or measured differently?
- Privacy: is personal or sensitive data collected and used lawfully and appropriately?
- Security: can the training data or model be tampered with or exposed?
- Change over time: will behaviour, users or conditions change so that the original data becomes less relevant?
Machine learning versus traditional programming
Traditional programming generally encodes rules directly: given an input, the software follows instructions written by developers. Machine learning uses examples to learn patterns that may be too complex or numerous to specify manually. The two approaches often work together. A software product may use ordinary code for permissions, calculations and safety checks while using a trained model for image recognition or prediction.
Machine learning is not always the best choice. If a task has clear rules and exact answers, a conventional program may be easier to audit, faster and more reliable. ML is especially useful when patterns are difficult to describe explicitly but enough suitable data exists to learn from.
Where machine learning is used
- Search and recommendations: ranking likely relevant results or suggesting content and products.
- Fraud and security: identifying unusual transaction or network patterns for further review.
- Speech and language: transcription, translation, text classification and language generation.
- Science and engineering: analysing images, measurements, materials and complex simulations.
- Transport and logistics: estimating demand, detecting objects and optimising some routes or schedules.
- Healthcare support: assisting trained professionals with selected image or data-analysis tasks, subject to validation, privacy and clinical oversight.
In every area, a model should be judged by the task it actually performs and the evidence that it works in the intended setting. A demonstration is not the same as a validated system.
Common machine-learning misconceptions
- ‘Machine learning understands every pattern it finds.’ It learns statistical relationships; those relationships may be spurious or misleading.
- ‘More data always produces a better model.’ Poor-quality or unrepresentative data can make a model worse.
- ‘High training accuracy proves success.’ Test performance on unseen data and examine real-world errors.
- ‘AI and machine learning are the same thing.’ AI is broader; ML is one approach within it.
- ‘A model makes decisions objectively.’ Data, objectives, thresholds and deployment choices are human-designed and can carry bias.
Frequently asked questions about machine learning
What is machine learning in simple words?
It is a way to build computer systems that learn patterns from data and use those patterns to make predictions or produce outputs.
What is the difference between AI and machine learning?
AI is the broader field of systems that perform tasks associated with intelligence. Machine learning is one family of methods used to build AI systems.
Does machine learning need data?
Most machine-learning methods learn from data or feedback. The type and quality of data depend on the learning approach and task.
What is supervised learning?
It is training with examples that include target answers or labels, so the model learns to predict those targets for new inputs.
Can machine learning make mistakes?
Yes. Models can fail because of poor data, unfamiliar conditions, bias, software errors or a mismatch between the training objective and the real task.
Is ChatGPT machine learning?
Yes. Systems such as ChatGPT use machine-learning models, including large language models, to generate responses from patterns learned during training and information provided in the conversation.
Continue learning at eduKateSG
For the step-by-step logic behind computer instructions, read What Is an Algorithm?. For practical programming, continue with What Is Python?. For Singapore school computing, see AI and Machine Learning vs Traditional Programming.
Sources and further reading
The NIST Computer Security Resource Center glossary defines machine learning as the development and use of computer systems that adapt and learn from data with the goal of improving accuracy. For wider AI terminology and risk considerations, see NIST’s Artificial Intelligence programme. This article is an introductory explanation; model performance must be tested for the specific task and setting.
