Machine Learning (ML) is a branch of Artificial Intelligence (AI) that enables computers to
learn from data and experience without being explicitly programmed.
Machine Learning is used to:
Automate decision-making based on patterns in data.
Predict outcomes from large datasets.
Extract insights and relationships from complex data.
Steps of Machine Learning
1. Problem Definition: Clearly define the objective of the ML project.
2. Data Collection: Gather the necessary data from relevant sources
3. Data Preprocessing: Clean and prepare data for modeling
4. Exploratory Data Analysis (EDA): Identify relationships, trends etc.
5. Model Selection: Choose an appropriate algorithm based on problem type
6. Model Training: Train the chosen algorithm using the training data.
7. Model Evaluation: Evaluate model performance using appropriate metrics
8. Model Optimization
9. Model Deployment
10. Monitoring & Maintenance
Applications:
Agriculture – crop prediction, pest detection.
Healthcare – disease diagnosis.
Finance – credit scoring, stock prediction.
Marketing – customer segmentation.
Types of Machine Learning
(a) Supervised Learning: The model learns from labeled data (input-output pairs). The goal is
to map inputs (X) to known outputs (Y). The algorithm learns by minimizing the error between
predicted and actual output.
Examples:
Predicting house prices (Regression)
Email spam detection (Classification)
Common Algorithms:
Linear Regression, Logistic Regression, Decision Trees, SVM, k-NN.
(b) Unsupervised Learning: The model learns from unlabeled data (no predefined output).
The goal is to find patterns, structure, or groupings in the data.
Examples:
Customer segmentation (Clustering)
Dimensionality reduction (PCA)
Common Algorithms:
K-Means, Hierarchical Clustering, Apriori Algorithm, PCA.
(c) Semi-supervised Learning: Uses a small amount of labeled data and a large amount of
unlabeled data. Useful when labeling data is costly or time-consuming. Combines advantages of
supervised and unsupervised learning.
Examples:
Web content classification
Medical image analysis
(d) Reinforcement Learning: The model (called an agent) learns by interacting with an
environment. It receives rewards or penalties for actions and aims to maximize total reward.
Based on trial and error.
Examples:
Game playing (Chess, Go)
Robotics (navigation and control)
Elements: Agent - Environment - Reward - Policy
Model: A model in Machine Learning is a mathematical representation of a real-world
process, built to make predictions or decisions based on data.
Example:
Linear Regression model: Y =a+bX
where a and b are parameters learned during training.
Training: Training is the process of teaching the model using a dataset so it can learn the
relationship between input and output.
Example:
Training a model to predict prices using past data.
Testing: Testing evaluates how well a trained model performs on unseen data (test dataset). It
checks generalization ability — how accurately the model predicts new outcomes.
Example:
After training on 80% data, test on remaining 20%.
Metric examples: Accuracy, Precision, Recall, RMSE, etc.
Validation: Validation is the process of fine-tuning model parameters and preventing
overfitting. Validation set helps in selecting the best model.
Common method:
K-Fold Cross Validation – divides data into k parts and tests each once.
Overfitting: When a model learns the training data too well, including its noise and random
fluctuations, and performs poorly on new data.
Causes:
Model too complex
Insufficient or noisy data
Underfitting: When a model is too simple to capture the underlying data pattern. It
performs poorly on both training and testing data.
Causes:
Too few features
Model too simple
Machine Learning Applications in Economics and Data Science
Machine Learning helps economists in analyzing large, complex, and dynamic data to make
predictions and decisions.
Applications:
Economic forecasting: GDP growth, inflation, unemployment rates
Policy evaluation: Impact assessment using predictive models
Market analysis: Price elasticity estimation, demand forecasting
Machine Learning is a core part of Data Science, providing tools for prediction, automation,
and insight generation.
Applications:
Predictive analytics: Forecasting trends from datasets
Recommendation systems: Amazon, Netflix, Spotify
Natural Language Processing (NLP): Text mining, sentiment analysis
LINEAR REGRESSION
Linear Regression is a statistical method used to model the relationship between a dependent
variable (Y) and one or more independent variables (X) using a straight line.
Equation: Y = β0 + β 1 X +ε
where:
Y : Dependent variable
X : Independent variable
β 0: Intercept
β 1: Slope (coefficient)
ε : Error term
Assumptions of linear regression
1. Linearity: The relationship between the independent variable(s) (X) and the dependent
variable (Y) is linear.
2. Homoscedasticity: The variance of errors (residuals) is constant across all levels of X.
3. No Multicollinearity (for multiple regression)
4. No Autocorrelation (mainly for time series data)
Objective:
Minimize the sum of squared errors (SSE): SSE=∑ ¿
Types:
Simple Linear Regression: One independent variable.
Multiple Linear Regression: More than one independent variable.
Applications:
Predicting crop yield, price estimation, demand forecasting.
LOGISTIC REGRESSION
Logistic Regression is used for classification problems, where the output variable
is categorical (e.g., 0/1, Yes/No).
Equation:
1
P(Y =1∣ X )= −(β 0+ β1 X )
1+ e
The output is a probability between 0 and 1, converted into class labels using a threshold
(usually 0.5). Uses Sigmoid (logistic) function. Suitable for binary classification tasks.
Assumptions of Logistic Regression
1. Binary or categorical outcome
2. Independent observations
3. Little or no multicollinearity
4. Linearity of logit
Types of Logistic Regression
1. Binary Logistic Regression
2. Multinomial Logistic Regression
3. Ordinal Logistic Regression
Applications:
Credit risk prediction, disease detection, spam filtering.
RANDOM FORESTS
Random Forest is an ensemble method that combines multiple decision trees to improve
accuracy and reduce overfitting.
Working:
1. Creates multiple trees using random subsets of data and features.
2. Each tree gives a prediction.
3. Final output is decided by:
o Majority voting (for classification)
o Averaging (for regression)
Applications:
Loan approval, medical diagnosis, feature selection.
EVALUATION METRICS
Regularization: Technique to prevent overfitting. Adds a penalty for complexity to the model.
Helps the model generalize better on new data
Why Evaluation Metrics?
To Measure Model Performance
To Compare Different Models
To Detect Overfitting or Underfitting
Mean Squared Error (MSE): MSE measures the average of the squared differences between
the actual and predicted values.
n
1
MSE= ∑ ❑¿Mean Absolute Error (MAE): MAE measures the average of the absolute
n i=1
differences between actual and predicted values.
n
1
MAE= ∑ ❑∣Y i−Y^ i ∣R-Squared (R²) Coefficient of Determination: R-Squared (R²) is
n i=1
a statistical measure that represents the proportion of the variance in the dependent variable (Y)
that is explained by the independent variable(s) (X) in a regression model. It indicates how well
the model fits the data.
2 S Sres
R =1− Accuracy: Measures overall correctness of model predictions. Good for balanced
S S tot
datasets
TP+TN
Accuracy= Precision: Measures how many predicted positives are correct.
TP+TN + FP+ FN
High precision → few false positives.
TP
Precision= Recall (Sensitivity): Measures how many actual positives are correctly
TP+ FP
predicted. High recall → few missed positives.
TP
Recall= F1 Score: Harmonic mean of Precision and Recall. Good for imbalanced
TP+ FN
datasets.
Precision × Recall
F 1=2×
Precision+ Recall
ROC Curve (Receiver Operating Characteristic): Plots True Positive Rate (TPR) vs False
Positive Rate (FPR).
AUC (Area Under Curve) measures performance:
o AUC = 1 → Perfect model
o AUC = 0.5 → Random model
Use: Visualize the trade-off between sensitivity and specificity.