Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 6 Machine Learning

ECAP792 9 min read

Practice MCQs Subjective questions
Text size
100%

I. Orientation — Foundations of Machine Learning

Machine learning (ML) is a branch of artificial intelligence in which computational systems improve their performance on a task by learning patterns from data rather than relying only on explicitly programmed rules. Its modern foundations include statistical inference, optimization, computer science, and pattern recognition.

Defining properties:

  • Data-driven operation: An ML system estimates relationships from examples such as labelled emails, historical sales records, images, or sensor readings.
  • Generalization: The objective is not merely to memorize training data but to perform well on previously unseen examples drawn from a similar population.
  • Model: A model is a parameterized representation of a learned relationship; for example, linear regression uses parameters and in .
  • Training: Learning adjusts model parameters to reduce a measurable error or improve a reward.
  • Inference: After training, the model processes new input to produce a prediction , class, score, action, or structured output.
  • Evaluation: Performance is measured with criteria such as accuracy, mean squared error, precision, recall, or cumulative reward.
  • Assumption: Training and future data must have sufficiently similar statistical properties; major distribution changes can make learned patterns unreliable.

A. Introduction

Machine learning converts experience represented by data into a model that can make predictions, discover structure, or select actions.

  • Classical programming contrast:
    1. Rule-based programming: A programmer supplies data and explicit rules to produce answers.
    2. Machine learning: A learning algorithm receives data and desired answers, rewards, or structural criteria and produces a model containing learned rules.
  • Core mapping: Many learning tasks estimate a function connecting input features to an output.
Text
ŷ = f(x; θ)
  • : input or feature vector, such as a house’s area and age.
  • : parameters learned from data, such as regression coefficients.
  • : model or prediction function.
  • : predicted output, such as house price.
    • Typical workflow: Data collection is followed by cleaning, feature preparation, model training, validation, testing, deployment, and monitoring.
    • Generalization requirement: A model with 99% training accuracy but 70% test accuracy has probably learned training-specific noise rather than a dependable relationship.
    • Role in data science: ML turns analyzed data into operational outputs, including fraud alerts, demand forecasts, medical-image classifications, and product recommendations.

II. Types of Machine Learning Techniques — Sources of Learning Signals

Machine learning techniques are primarily distinguished by the information available during training: correct labels, no labels, a mixture of both, or feedback obtained through interaction.

A. Types of machine learning techniques

The principal learning types differ in their training signals, objectives, and suitable applications.

  1. Supervised learning: The algorithm learns from labelled pairs , where is the -th input and is its known target.
    • Classification: Predicts a discrete label; an email classifier may output “spam” or “not spam.” Common algorithms include logistic regression, decision trees, support-vector machines, and neural networks.
    • Regression: Predicts a continuous value; a model may estimate a temperature of or a price of ₹500,000.
    • Objective: Parameters commonly minimize average loss:
Text
θ* = arg minθ (1/n) Σᵢ L(yᵢ, f(xᵢ; θ))
  • : number of training examples.
  • : loss measuring prediction error.
  • : parameter values producing the smallest training objective.
  1. Unsupervised learning: The algorithm receives inputs without known targets and searches for useful structure.

    • Clustering: Groups similar observations; -means assigns customers to groups by minimizing distances from cluster centers.
    • Dimensionality reduction: Methods such as principal component analysis represent many correlated variables with fewer components.
    • Association discovery: Market-basket analysis can identify products frequently purchased together.
    • Limitation: Without labels, clusters are not automatically meaningful; a three-cluster solution requires interpretation using domain variables.
  2. Semi-supervised learning: A small labelled dataset is combined with a larger unlabelled dataset.

    • Concrete setting: A system may use 1,000 labelled images and 50,000 unlabelled images when expert annotation is expensive.
    • Mechanism: Techniques include pseudo-labelling, consistency regularization, and graph-based propagation.
    • Risk: Incorrect pseudo-labels can be reinforced, so confidence thresholds and validation data are important.
  3. Reinforcement learning: An agent learns actions through interaction with an environment and receives numerical rewards.

    • Elements: At time , the agent observes state , chooses action , receives reward , and reaches state .
    • Objective: The policy seeks to maximize expected cumulative discounted reward:
Text
Gₜ = rₜ₊₁ + γrₜ₊₂ + γ²rₜ₊₃ + ...
  • : return from time .
  • : discount factor between 0 and 1.
  • Applications: Robot control, game playing, resource allocation, and sequential recommendation.
  • Challenge: Exploration discovers new actions, whereas exploitation selects actions already believed to be effective.

III. Learning Problems and Systems — From Data to Generalization

A learning problem formally specifies what must be learned, while a learning system includes the data, representation, algorithm, computing process, and evaluation mechanism needed to learn it.

A. Learning problems and system

A well-defined learning problem connects a task, a source of experience, and an explicit performance criterion.

  • Three-part formulation: A program learns from experience with respect to task and performance measure if its measured performance at improves with .
    • Task : Classify incoming messages as spam or legitimate.
    • Experience : A dataset of previously classified messages.
    • Performance : Accuracy, precision, recall, or another metric on unseen messages.
  • Common learning problems:
    • Classification: Map to one of classes, such as digits 0–9.
    • Regression: Estimate a numerical target, such as tomorrow’s electricity demand in megawatts.
    • Ranking: Order documents according to relevance to a search query.
    • Clustering: Partition unlabelled observations according to similarity.
    • Anomaly detection: Identify unusual cases, such as a transaction far from normal account behavior.
  • System components:
    • Data pipeline: Collects, validates, transforms, and divides data.
    • Feature representation: Converts raw objects into usable variables; a document may become a vector of word frequencies.
    • Learning algorithm: Searches a hypothesis space for suitable parameters.
    • Model repository: Stores trained parameters, versions, and metadata.
    • Serving layer: Exposes predictions through a batch process or application programming interface.
    • Monitoring layer: Tracks latency, errors, input drift, and post-deployment performance.
  • Generalization error: The expected loss on unseen population data is more important than training loss, but it must be estimated with held-out data.
  • Data partitioning: A typical split might allocate 70% for training, 15% for validation, and 15% for final testing; the test set remains untouched until model selection is complete.
  • Central failure modes:
    1. Underfitting: The model is too simple and performs poorly on both training and test data.
    2. Overfitting: The model performs well on training data but poorly on new data because it captures noise.
  • Data leakage: Using future or test information during training creates misleading results; including a “payment recovered” field in a default-risk model would reveal an outcome unavailable at prediction time.

IV. Designing a Learning System — An End-to-End Engineering Process

Designing a learning system requires aligning the model with the real decision, available data, operating constraints, and consequences of errors.

A. Designing a learning system

Effective design proceeds from problem definition to deployment and continuous monitoring rather than beginning with algorithm selection.

  • Define the objective: State the input, output, prediction horizon, users, and decision. “Predict whether an invoice will be unpaid 30 days after its due date” is more precise than “predict bad customers.”
  • Choose a performance measure: Accuracy may be unsuitable for rare events; if only 1% of transactions are fraudulent, predicting “not fraud” always gives 99% accuracy but detects no fraud.
  • Collect representative data: Sampling should cover relevant users, seasons, devices, and operating conditions; missing an entire region can create systematic deployment errors.
  • Prepare data: Handle duplicates, missing values, inconsistent units, categorical variables, and extreme values using transformations learned from training data only.
  • Select features and representation: Domain variables may be combined with learned representations; transaction amount, hour, location distance, and device history can support fraud detection.
  • Choose a model family: Consider predictive quality, interpretability, training cost, inference speed, memory, and maintainability. A small decision tree may be preferred when decisions require clear explanations.
  • Train and tune: Fit parameters on training data and choose hyperparameters—such as tree depth or regularization strength—using validation data or cross-validation.
  • Evaluate realistically: Use a time-based split for forecasting and grouped splits when records from one person must not appear in both training and test sets.
  • Deploy safely: Package preprocessing and the model together, version them, log predictions, and provide fallback behavior for missing or malformed inputs.
  • Monitor and retrain: Compare current feature distributions with training distributions and measure delayed outcomes. A changing relationship between inputs and targets indicates concept drift.
  • Account for responsible use: Examine subgroup error rates, privacy, security, explainability, and human oversight; aggregate accuracy can conceal high false-negative rates for a smaller group.

V. Concept of Learning Task — Defining What Improvement Means

A learning task is a precise computational objective in which experience is used to improve measurable performance under stated conditions.

A. Concept of learning task

The concept of a learning task separates the desired capability from the algorithm chosen to implement it.

  • Task specification: Define the input space , output space , target relationship, and loss function. For binary classification, .
  • Example representation: In credit-risk prediction, may contain income, debt ratio, and repayment history, while denotes default.
  • Hypothesis space: The learner searches a set of possible functions ; restricting controls what patterns can be represented.
  • Loss and risk: For binary classification, zero-one loss records whether a prediction is wrong:
Text
L(y, ŷ) = 0 if y = ŷ; otherwise 1
  • : actual class.
  • : predicted class.
  • : error assigned to one prediction.
    • Inductive learning: The system infers a general rule from finite examples; this requires an inductive bias such as preference for simpler functions or nearby cases.
    • Performance distinction: Training performance measures fit to observed examples, whereas test performance estimates success on unseen examples.
    • Success condition: Learning has occurred only when additional experience improves the chosen performance measure on the specified task, not merely when a complex model has been fitted.

Test yourself on unit 6

60 MCQs on what you just read, each marked as you answer with an explanation.