Docsity

Machine Learning — Complete Syllabus Quick Revision Notes, Study notes of Introduction to Machine Learning

Toggle sidebar
bg1
UNIT - 1
Machine Learning
Introduction
Machine learning is branch of AI that focuses on developing models and algorithms
that let computers learn from data without being explicitly programmed for evry task.
ML teaches system to think and understand like humans by learning from data.
EXAMPLE- A child learns to recognize fruits after seeing many examples .
Similarly Computer sees many images- Learn patterns- predicts correctly for new
images
USES
Self- driving cars
Financial and fraud detection
Medical diagnosis
Face recognition
Chatbots
Robots
General Applications and Issues in
Machine Learning
# APPLICATIONS
Field
Applications
Healthcare
Disease diagnosis, medical imaging
Banking
Fraud detection, loan approval, credit scoring
Education
Student performance prediction, personalized learning
Agriculture
Crop prediction, disease detection, smart irrigation
E-commerce
Product recommendation, price prediction
Transportation
Self-driving cars, traffic prediction
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Machine Learning — Complete Syllabus Quick Revision Notes and more Study notes Introduction to Machine Learning in PDF only on Docsity!

UNIT - 1

Machine Learning

Introduction

Machine learning is branch of AI that focuses on developing models and algorithms that let computers learn from data without being explicitly programmed for evry task. ML teaches system to think and understand like humans by learning from data. EXAMPLE- A child learns to recognize fruits after seeing many examples. Similarly Computer sees many images- Learn patterns- predicts correctly for new images USES Self- driving cars Financial and fraud detection Medical diagnosis Face recognition Chatbots Robots

General Applications and Issues in

Machine Learning

# APPLICATIONS

Field Applications Healthcare Disease diagnosis, medical imaging Banking Fraud detection, loan approval, credit scoring Education Student performance prediction, personalized learning Agriculture Crop prediction, disease detection, smart irrigation E-commerce Product recommendation, price prediction Transportation Self-driving cars, traffic prediction

Social media Friend suggestions, content recommendations Cybersecurity Spam filtering, malware detection #ISSUES Poor data quality Missing values Underfitting Feature selection problems Noisy data Overfitting High computational cost Data privacy concerns

##History of Machine Learning

Year Scientist/Organization Development 1943 McCulloch and Pitts Proposed the first artificial neuron model 1950 Alan Turing Introduced the Turing Test for machine intelligence 1952 Arthur Samuel Developed a machine learning checkers program 1957 Frank Rosenblatt Invented the perceptron for neural networks 1967 Cover and Hart Introduced the K-Nearest Neighbors algorithm 1986 Hinton and Williams Popularized backpropagation algorithm 1997 IBM Deep Blue defeated the world chess champion 2006 Hinton’s team Developed modern deep learning techniques 2012 Geoffrey Hinton Achieved major success in image recognition 2022 OpenAI Rise of generative AI and large language models Present Modern AI systems Rapid growth in AI and machine learning applications

Unsupervised Learning

#ALGORITHMS

K-Means Clustering Hierarchical Clustering DBSCAN Principal Component Analysis #ADVANTAGES Does not need labeled data Works with large datasets Helps find hidden data patterns Useful for discovering new groups or relationships #DISADVANTAGES Less accuracy Results may need manual checking Difficult to evaluate performance Privacy concerns may occur with sensitive data #APPLICATIONS Customer segmentation Market basket analysis Image segmentation Social network analysis

Training Data vs Test Data

Training Data Test Data Used to train the model Used to evaluate the model Model learns from this data Model accuracy is checked using this data Usually about 70% of the dataset Usually about 30% of the dataset Helps build the model Helps measure model performance Used to adjust model parameters Used for collecting results and checking generalization #Important Points

Some data is used for training and some data is used for testing. Data splitting ensures that the model is trained on one part of the dataset and tested on another part. This process checks whether the model can generalize to new examples.

Designing a Learning System

#PROCESS FLOW

Problem Statement → Data Collection → Data Cleaning → Feature Engineering ↓ Model Selection → Data Modeling → Exploratory Data Analysis ↓ AI Design → Optimization → Deployment #STEPS

  1. Identify the objective and decide the expected output.
  2. Collect relevant data from different sources.
  3. Apply data cleaning and preprocessing to improve quality.
  4. Select important features that affect prediction.
  5. Select an algorithm if supervised; otherwise select a suitable unsupervised method.
  6. Train the model using selected data.
  7. Improve the model by hyperparameter selection.
  8. After performance is satisfactory, deploy the model for real-world use.

Reinforcement Learning

  1. The agent observes the current state of the environment.
  2. The agent chooses an action.
  3. The environment changes according to the action.
  4. The agent receives a reward or penalty.
  5. Based on this feedback, the agent updates its learning strategy.
  6. This process repeats until the agent learns the best sequence of actions. #SIMPLE FLOW Agent → Action → Environment ↑ ↓

Age Salary Remark 25 30000 Original record 27 40000 Original record 25 30000 Duplicate record #Action Remove duplicate rows. #HANDLING OUTLIERS ###Example [ 20,22,21,24,22, ] Here, 200 is an outlier.

Data Normalization

It is a data transformation technique that changes numerical values to a common range, usually o to 1. #FORMULA [ x'=\frac{x-x_{min}}{x_{max}-x_{min}} ] ###Example Given: [ x=30,\quad x_{min}=10,\quad x_{max}= ] [ x'=\frac{30-10}{50-10} ] [ x'=\frac{20}{40}=0. ]

#ADVANTAGES

Brings values to a common range. Prevents larger values from dominating smaller values. Improves convergence in optimization-based algorithms. Useful for distance-based algorithms. #DISADVANTAGES Sensitive to outliers. If a new minimum or maximum value appears, normalized values may change.

Feature Scaling

It transforms numerical featu so that their values have a comparable scale. Important for distance and gradient based algorithms. #TYPES Method Formula Use Min-Max Scaling (x'=\frac{x-x_{min}}{x_{max}-x_{min}}) Transforms values into a fixed range Standardization/Z-score (z=\frac{x-\mu}{\sigma}) Transforms data so mean = 0 and standard deviation = 1 Robust Scaling (x'=\frac{x-\text{Median}}{IQR}) More resistant to outliers

Feature Selection Techniques

1. FILTER METHOD

Select feature using statistical properties of data without training model. #Examples Correlation Chi-square test Information gain #Correlation Formula [

Regularization #Regularization Formula [ L=\text{Loss}+\lambda \sum |w| ] ####L2 Regularization [ L=\text{Loss}+\lambda \sum w^ ]

Data Reduction

Data reduction is process of reducing volumes , dimensionality or complexity of data while preserving important data. #METHODS Feature selection Feature extraction Dimensionality reduction Sampling Aggregation

Principal Component Analysis

It is a dimensionality reduction technique that transforms set of possibly correlated variables into a smaller set of new variables called principle components,while retaining as much variance or information. Term Meaning Variance Measures how much data varies Covariance Shows how variables change together Eigenvector Direction in transformed space Eigenvalue Amount of variance along that direction Principal Component New axis created from original features that captures maximum variance #STEPS IN PCA

  1. Collect dataset and form a data matrix.
  2. Standardize the data: [ z=\frac{x-\mu}{\sigma} ]
  3. Calculate covariance matrix: [ C=\frac{X^TX}{n-1} ]
  4. Calculate eigenvalues and eigenvectors.
  5. Arrange eigenvalues in descending order: [ PC1,PC2,PC3,\dots ]
  6. Select required principal components to preserve maximum variance.
  7. Transform data into lower-dimensional form. #Explained Variance Ratio Tells percentage of total variance captured by each principle components. Comulative EVR helps decide how many components to retain. #Example Component Explained Variance EVR Cumulative EVR PC1 3.6 60% 60% PC2 1.5 25% 85% PC3 0.4 8% 93% PC4 0.2 4% 97% PC5 0.15 3% 100% #INTERPRETATION First two components may be retained if 85% variance is sufficient. Dimensionality reduces from 5 dimensions to 2 dimensions. #ADVANTAGES Reduces number of dimensions. Reduces computational complexity. Removes redundancy. Helps visualize high-dimensional data. May help reduce overfitting.

Classification

Predict categories. Determine class of new data points. Use labeled data to train classification models. #TYPES OF CLASSIFICATION Type Meaning Example Binary Classification Data is divided into two possible categories Email: spam or not spam Multiclass Classification Data is divided into more than two categories Handwritten digit recognition Multi-label Classification One data item can belong to multiple categories at the same time Assigning multiple labels to one image

Decision Tree

It is used for both classification and regression tasks. It has a hierarchial tree structure which consists of a root node, branches, internal nodes and leaf nodes. It works like a flow chart that helps in making step by step decisions. #STRUCTURE Root node: First and most important decision. Decision node: Intermediate point where a condition is checked. Leaf node: Final outcome or prediction. #EXAMPLE Attendance ≥ 75%? / Yes No / Study hours > 3? Fail / Yes No Pass Fail

#MEASURES

Gini impurity- commonly used for classification Entropy - Measures how much uncertainty is reduced Mean squared error - commonly used for regression

K-Nearest Neighbors

It works by indentifying the k closet data points to a given input and making predictions based on the majority class or average values of those neighbours. It is also called as a lazy learner algorithm because it does not learn from training set immediately instead it store entire data set and performs computations only at time of classification. #STEPS

  1. Choose the value of (K), the number of neighbors to consider.
  2. Calculate the distance between the new data point and all training data points.
  3. Select the (K) closest points.
  4. For classification, choose the majority class among the neighbors.
  5. For regression, usually take the average of neighbor values. #EUCLIDEAN DISTANCE [ d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} ] #EXAMPLES Image classification Recommendation systems Pattern recognition Customer classification #ADVANTAGES AND DISADVANTAGE Advantages Disadvantages Simple and easy to understand Can be slow with large datasets No complicated training process Sensitive to choice of (K) Works well for small datasets Can be affected by irrelevant features Useful for classification problems Sensitive to noise

Support Vector Machine

It tries to find the best boundary known as hyperlane that separates different classes in the data. It defines the class boundaries. The goal of SVM is to maximize the margin between two classes. This helps the model perform better on new and unseen data. Hyperplane: Decision boundary separating classes. Margin: Distance between hyperplane and support vectors. Support vectors: Data points closest to the hyperplane. #DIAGRAM Class A: ○ ○ ○ ○ ------------------------ Hyperplane × × Class B: × × Nearest points to the hyperplane = Support vectors #APPLICATIONS Image classification Face detection Text classification Handwriting recognition #TYPES OF SVM 1 LINEAR SVM Uses a linear boundary to separate data points of different classes. Assumes data is linearly separable. Hyperplane is a straight line in 2D. 2 NIN LINEAR SVM Used when data cannot be separated by a straight line. Uses kernel functions to transform data into higher-dimensional space. Handles non-linearly separable data. #ADVANTAGES AND DISADVANTAGES

Advantages Disadvantages Effective in high-dimensional datasets Can be computationally expensive for large datasets Works well when there is clear separation between classes Choosing the appropriate kernel can be difficult Useful for classification using kernels Sensitive to feature scaling

Neural Networks

These are machine learning models that mimic complex functions of human brain. It learns patterns from data and uses those patterns to make predictions or decisions. #INPUT LAYER Receives input data. Each neuron in this layer corresponds to a feature in the input data. #HIDDEN LAYER Process input using mathematical operations. A network can have one or more hidden layers. Layers are connected using weights. #OUTPUT LAYER Produces the final output of the model. Output depends on the task, such as classification or regression. #WORKING Each connection has a weight. A neuron calculates the weighted sum of inputs and usually applies an activation function. [ z=w_1x_1+w_2x_2+\dots+w_nx_n+b ] [ output=f(z) ] Where: (x): input

###Confusion Matrix Terms Actual / Predicted Positive Negative Positive TP FN Negative FP TN Where: TP: True Positive TN: True Negative FP: False Positive FN: False Negative [ #Accuracy=\frac{TP+TN}{TP+TN+FP+FN} ] Proportion of all predictions that are correct. #Precision [ Precision=\frac{TP}{TP+FP} ] Measures how many predicted positives are actually positive. #Recall/Sensitivity [ Recall=\frac{TP}{TP+FN} ] Measures how many actual positive cases are correctly identified. #F1-Score [ F1=2\times\frac{Precision\times Recall}{Precision+Recall} ] Harmonic mean of precision and recall. #Specificity [ Specificity=\frac{TN}{TN+FP} ] Measures how well negative cases are identified. #ROC-AUC

ROC curve plots true positive rate against false positive rate. AUC summarizes the curve into a single value.

Unit 4

Unsupervised Learning and

Deep Learning

K-Means Clustering

The dataset is divided into (K) clusters. Each cluster has a center called a centroid. Each data point belongs to the nearest centroid. K-Means repeats the process until stable clusters are formed. #Important Terms Term Meaning Centroid Center point of a cluster, usually calculated as the mean of points Cluster Group of data points that are similar to each other Distance Similarity measure, usually Euclidean distance #STEPS

  1. Choose (K), the number of clusters.
  2. Randomly select initial centroids.
  3. Assign each data point to the nearest centroid.
  4. Recalculate centroids by calculating the mean of points in each cluster.
  5. Repeat assignment and centroid update steps until centroids stop changing. #DIAGRAM Initial data points: ○ ○ ○ ○ □ □