Applied Machine Learning

Machine Learning Fundamentals · Beginner

What Is Machine Learning? A Beginner's Guide

Learn what machine learning is, how it works, its main learning approaches, evaluation metrics, and real-world applications. No programming experience required.

Applied Machine Learning ·

What is machine learning?

Machine learning (ML) is a branch of artificial intelligence that enables computers to learn patterns from data and use those patterns to make predictions, identify relationships, or support decisions without explicitly programming every rule.

Traditional programs follow instructions written by a programmer. A machine learning system instead learns relationships from examples. Consider spam detection: rather than manually listing every suspicious word, a model can learn from examples of spam and legitimate emails and estimate whether a new message is spam.

The objective is not simply to memorize examples, but to learn relationships that generalize to new data.

Artificial intelligence, machine learning, and deep learning

Concept Description
Artificial intelligence (AI) The broad field of developing systems capable of tasks associated with human intelligence.
Machine learning (ML) A subset of AI focused on learning patterns from data.
Deep learning (DL) A subset of ML based on neural networks with multiple computational layers.
Nested circles showing deep learning inside machine learning inside artificial intelligence
Figure 1. Deep learning is a subset of machine learning, which is itself a subset of AI.

Not all AI uses machine learning, and not all ML uses deep learning. Traditional algorithms remain useful, particularly for structured datasets and problems with limited computational resources.

How does machine learning work?

Six stages from collecting data to making predictions
Figure 2. A typical ML workflow. In practice, evaluation often leads back to earlier stages.

1. Collecting data

Data may include numerical measurements, images, text, audio, financial transactions, or scientific observations. Its quality, quantity, and relevance strongly influence model performance.

2. Preparing data

Preparation may involve correcting errors, handling missing values, removing duplicates, and transforming variables. Any transformations learned from data should be fitted on training data to avoid leaking information from the test set.

3. Selecting a model

A model is a mathematical representation of relationships in data. Some models learn simple linear relationships, while others represent complex nonlinear patterns. Selection depends on the task, data, resources, and interpretability requirements.

4. Training the model

A learning algorithm determines the model’s internal parameters or structure. In supervised learning, training often involves minimizing differences between predictions and known outcomes.

5. Evaluating the model

Evaluation on data not used for training helps establish whether the model generalizes. Appropriate metrics depend on the task.

6. Making predictions

Using a trained model on new inputs is called inference. For example, a trained house-price model can estimate the price of a previously unseen property.

Important machine learning terminology

Term Definition
Dataset A collection of observations.
Sample An individual observation.
Feature An input variable or representation.
Target The outcome a supervised model attempts to predict.
Algorithm A procedure used to learn from data.
Model The learned representation used to make predictions or identify patterns.
Training The process of learning from data.
Inference Applying a trained model to new inputs.
Parameters Internal model values determined during training.
Hyperparameters Settings controlling the model or learning process.
Generalization Performance on previously unseen data.

The main types of machine learning

Supervised learning

Supervised learning uses examples with known targets to learn relationships between inputs and outcomes. Its two common tasks are regression and classification.

Regression

Regression predicts numerical quantities, such as house prices, material properties, product demand, fuel consumption, or molecular solubility.

Ames house living area versus sale price with fitted regression line
Figure 3. Linear regression using above-ground living area to predict sale price in the Ames Housing dataset. Metrics are calculated on held-out homes; the shaded region is a classical 95% confidence interval for the mean relationship, not individual predictions.

Each point represents an observation. The line estimates the target from the input feature. Real housing models generally require additional variables, such as location and property size.

Classification

Classification predicts a category, such as spam versus legitimate email, fraudulent versus legitimate transactions, or the digit shown in an image.

Ten genuine 28 by 28 MNIST digit images with actual and predicted labels
Figure 4. Actual nearest-neighbor predictions on held-out 28 × 28 images from MNIST, one example per digit class.

The model receives pixel intensities as inputs and predicts a digit from zero through nine. The true label provides a way to check the prediction.

Unsupervised learning

Unsupervised learning discovers patterns without predefined target labels. Clustering groups similar observations, while dimensionality reduction represents complex data using fewer variables. Applications include customer segmentation, anomaly detection, and discovering groups of similar molecules.

Three visually separated groups of synthetic points plotted by two features
Figure 5. Synthetic data illustrating groups that a clustering algorithm might discover. Colors indicate the illustrative groups, not measured model predictions.

Semi-supervised learning

Semi-supervised learning combines labeled and unlabeled data. For example, researchers may have thousands of microscopy images but only a small number of manually annotated examples.

Self-supervised learning

Self-supervised learning derives training targets from the data itself. A language model may predict the next token in text, while an image model may reconstruct missing image regions.

Reinforcement learning

An agent learns through interactions with an environment, receiving rewards based on its actions. Its objective is to maximize cumulative reward. Applications include robotics, games, and industrial process control.

Learning approach Information used Objective
Supervised Labeled examples Predict outcomes
Unsupervised Unlabeled data Discover structure
Semi-supervised Labeled and unlabeled data Learn with limited labels
Self-supervised Targets derived from data Learn useful representations
Reinforcement Rewards from interactions Learn decision strategies

These approaches can be combined in a single system.

Common machine learning algorithms

Algorithm Common applications
Linear regression Numerical prediction
Logistic regression Classification
Decision trees Regression and classification
Random forests Regression and classification
Gradient boosting Structured data prediction
Support vector machines Classification and regression
K-nearest neighbors Classification and regression
K-means Clustering
Principal component analysis Dimensionality reduction
Neural networks Complex pattern recognition and prediction

No algorithm is best for every problem. Gradient boosting often performs well on structured data, while deep neural networks are particularly useful for images, audio, and text.

Training, validation, and testing data

Dataset Purpose Example proportion
Training Learn model parameters 70%
Validation Compare models and tune hyperparameters 15%
Test Evaluate final performance 15%
Dataset divided into 70 percent training, 15 percent validation and 15 percent test data
Figure 6. An illustrative dataset split. The proportions are not universal requirements.

The test set should remain independent of model development. Time-series data and related observations may require specialized splitting strategies rather than random splits.

Overfitting and underfitting

Underfitting occurs when a model cannot capture important relationships and performs poorly even on training data. Overfitting occurs when a model learns training-specific patterns or noise that do not generalize. A suitable model balances these risks.

Three fitted curves on the same synthetic data showing underfitting, suitable fitting and overfitting
Figure 7. Synthetic examples of a model that is too simple, one that captures the underlying trend, and one that follows training noise. The dashed line shows the known underlying relationship. Training and independent test RMSE illustrate why a perfect training fit can generalize poorly. The vertical axis is limited for readability; extreme predictions may extend beyond it.

How is machine learning performance measured?

Regression metrics

Metric Meaning Ideal
Mean absolute error (MAE) Average absolute prediction error, in the target’s original units. 0
Mean squared error (MSE) Average squared error; larger errors receive more weight. Units are squared. 0
Root mean squared error (RMSE) Square root of MSE, returning the error to the target’s original units. 0
Coefficient of determination (R²) Compares squared prediction error with predicting the mean of the evaluated targets. Zero matches that baseline; negative values are worse. 1

For example, a house-price MAE of $10,000 means predictions differ from actual prices by $10,000 on average in absolute terms.

Classification metrics

Metric Meaning Ideal
Accuracy Fraction of all predictions that are correct. 1
Precision Fraction of predicted positives that are actually positive. 1
Recall Fraction of actual positives correctly detected. 1
F1-score Harmonic mean of precision and recall, rewarding balance between them. 1
ROC-AUC Measures how well prediction scores distinguish positive from negative cases across thresholds. A value of 0.5 indicates chance-level ranking. 1

Precision, recall, and F1 are described here for binary classification; multiclass problems require per-class or averaged metrics.

Confusion matrix with 85 true negatives, 10 false positives, 5 false negatives and 20 true positives
Figure 8. Illustrative confusion matrix: accuracy is 87.5%, precision is 66.7%, recall is 80%, and F1 is 72.7%. ROC-AUC requires prediction scores rather than this single threshold alone.

Accuracy alone can be misleading. If only 10 of 1,000 transactions are fraudulent, predicting every transaction as legitimate gives 99% accuracy but zero recall for fraud.

Real-world applications

Field Applications
Finance Fraud detection and risk assessment
Manufacturing Defect detection and predictive maintenance
Healthcare Medical image analysis and decision support
Automotive Driver assistance and diagnostics
Chemistry Molecular property prediction and compound discovery
Materials science Characterization and property prediction
Computer vision Classification, detection, and segmentation
Natural language processing Translation and language generation
Retail Recommendations and demand forecasting
Engineering Process optimization and predictive modeling

Advantages and limitations

Machine learning can identify complex relationships, automate repetitive predictions, support scientific discovery, and provide fast alternatives to some expensive simulations. However, it depends on representative data, careful validation, appropriate metrics, and suitable algorithms. Models can learn misleading correlations, struggle outside their training distribution, and be difficult to interpret. A statistical relationship does not necessarily establish a causal mechanism.

Tool Primary purpose
NumPy Numerical computing and multidimensional arrays
Pandas Data manipulation and analysis
Polars High-performance DataFrame operations, lazy execution, parallel processing, and optional NVIDIA GPU acceleration for supported operations
SciPy Scientific computing, optimization, statistics, interpolation, and numerical methods
Matplotlib Data visualization
Scikit-learn Traditional machine learning
XGBoost Gradient boosting
LightGBM Efficient gradient boosting
PyTorch Deep learning and tensor computation
TensorFlow Deep learning
Google Colab Browser-based Python development
Jupyter Interactive computational notebooks

Polars GPU execution requires a compatible NVIDIA GPU and additional dependencies; not every operation supports GPU execution. You do not need to learn all these tools at once.

How to start learning machine learning

  1. Learn basic Python programming.
  2. Become familiar with computational notebooks.
  3. Learn numerical computing and data manipulation.
  4. Study basic statistics and mathematical concepts.
  5. Explore regression and classification.
  6. Learn model evaluation and optimization.
  7. Progress to neural networks and deep learning.

Frequently asked questions

Is machine learning the same as AI or deep learning?

No. ML is a subset of AI, and deep learning is a subset of ML.

Does machine learning require programming?

Understanding the concepts does not require programming, although developing models typically involves programming or specialized software.

Do I need a powerful computer?

No. Many traditional models run on ordinary computers. Google Colab also provides remote computing resources.

Does machine learning require large datasets?

Not always. Data requirements depend on problem complexity, model choice, data quality, and desired accuracy.

Can machine learning predict anything?

No. Reliable predictions require relevant information and learnable relationships.

Summary

Machine learning combines mathematics, statistics, computer science, and domain knowledge to learn relationships from data. Successful models generalize to new observations and are evaluated using metrics appropriate to their tasks.

Next steps

Explore all Machine Learning Fundamentals tutorials →