MachineLearning
MachineLearning
1.1 Concepts of Data Science, AI, Machine Learning, and Deep Learning
Data Science: The process of extracting knowledge and insights from structured or
unstructured data using various techniques, including statistics, machine learning, and
data mining.
Artificial Intelligence (AI): A broad field of study focused on creating intelligent
machines capable of performing tasks that typically require human intelligence (e.g.,
problem-solving, learning, speech recognition).
Machine Learning (ML): A subset of AI that enables machines to learn from data
without explicit programming by discovering patterns and making decisions.
Deep Learning (DL): A subfield of ML that uses neural networks with many layers
(deep neural networks) to analyze data with complex structures, such as images and
speech.
ML is a branch of AI that focuses on building algorithms that can learn from and
make predictions or decisions based on data.
Types of ML: Supervised, Unsupervised, and Semi-Supervised learning.
Traditional Programming: The programmer explicitly codes the instructions for the
machine.
Machine Learning: The machine learns patterns from data, and the program evolves
as it processes more data.
1.5 Machine Learning Process, Types of Data, Key Elements of Machine Learning
Creating and Importing Dataset: Collecting data from various sources (e.g., CSV,
databases).
Handling Missing Data: Techniques like imputation (filling missing values) or
removal.
Cross-validation: A method to assess model performance using multiple training and
test splits.
Feature Scaling: Adjusting the scale of features to improve model performance
(Normalization: Scaling to a range, Standardization: Adjusting to zero mean and unit
variance).
Supervised learning involves learning from a labeled dataset to make predictions (e.g.,
classification, regression).
2.3 Classification in ML
Classification Algorithms:
o Logistic Regression: Used for binary classification.
o Decision Tree: Splits data based on feature values to classify.
o k-Nearest Neighbors (KNN): Classifies based on the majority class of
neighbors.
o Naive Bayes: Uses probability theory for classification.
o Support Vector Machines (SVM): Finds the hyperplane that best separates
classes.
Evaluation methods:
o Confusion Matrix: Shows true positives, false positives, true negatives, and
false negatives.
o Precision, Recall, F1-Score: Performance metrics for classification tasks.
o Accuracy: Percentage of correct predictions.
o ROC-AUC Curve: Evaluates classification performance at various
thresholds.
Methods like Decision Trees, SVM, and KNN can be used for regression when the
relationship between features is non-linear.
Identifying rare items or observations that significantly differ from the majority of
data.
4. Ensemble Learning
4.4 Voting
4.5 Stacking
Combining predictions from multiple models by using another model to predict the
final output.
A probabilistic model that assumes all data points are generated from a mixture of
several Gaussian distributions.
5. Reinforcement Learning
5.1 Upper Confidence Bound
5.3 Q-Learning
Deep learning models use neural networks with multiple layers to model complex
data representations.
Specialized networks for handling grid-like data (images), using convolution and
pooling layers.
Answer:
Machine Learning (ML) is a branch of AI where machines learn from data and improve over
time without explicit programming.
Answer:
Q3. What is overfitting and underfitting in Machine Learning? How can they be
reduced?
Answer:
Overfitting: The model performs well on training data but poorly on unseen data.
o Solution: Use regularization, cross-validation, and more training data.
Underfitting: The model is too simple to capture the underlying patterns.
o Solution: Increase model complexity, use better features.
Q4. Write the formula for Linear Regression and explain its components.
Answer:
Formula: y=β0+β1x+ϵy = \beta_0 + \beta_1x + \epsilony=β0+β1x+ϵ
yyy: Predicted value
β0\beta_0β0: Intercept
β1\beta_1β1: Slope of the line (coefficient)
xxx: Feature/input variable
ϵ\epsilonϵ: Error term
Q5. What is Logistic Regression? How does it differ from Linear Regression?
Answer:
Answer:
A confusion matrix is used to evaluate classification models:
Answer:
K-Means is a partitioning-based clustering algorithm.
Steps:
Answer:
PCA (Principal Component Analysis) is a dimensionality reduction technique that converts
correlated features into uncorrelated components while preserving maximum variance.
Use: Reduces computational cost, avoids multicollinearity, and improves model efficiency.
Answer:
Apriori Algorithm is used to find frequent itemsets and generate association rules.
Steps:
4. Ensemble Learning
Q10. What is Random Forest? How does it differ from Decision Tree?
Answer:
Random Forest: An ensemble method that uses multiple decision trees, each trained
on a random subset of data and features, and aggregates their outputs.
Difference: Random Forest reduces overfitting by averaging multiple trees, while a
single Decision Tree is prone to overfitting.
Answer:
Boosting combines weak learners sequentially to form a strong learner. Each model corrects
the errors of the previous one.
Example: Adaboost focuses on misclassified instances by assigning them higher weights in
the next iteration.
5. Reinforcement Learning
Answer:
Q-Learning is a model-free reinforcement learning algorithm that learns the optimal action-
value function Q(s,a)Q(s, a)Q(s,a).
Update Rule:
Q(s,a)←Q(s,a)+α[r+γmaxaQ(s′,a′)−Q(s,a)]Q(s, a) \leftarrow Q(s, a) + \alpha \big[r +
\gamma \max_a Q(s', a') - Q(s, a)\big]Q(s,a)←Q(s,a)+α[r+γmaxaQ(s′,a′)−Q(s,a)]
Where:
Q13. What is the role of activation functions in neural networks? Name a few common
ones.
Answer:
Activation functions introduce non-linearity into the network, allowing it to learn complex
patterns.
Common Activation Functions:
Answer:
Backpropagation is an algorithm used to train neural networks by calculating the gradient of
the loss function with respect to weights using the chain rule and updating weights to
minimize loss.
Answer:
CNN RNN
CNN RNN
Used for spatial data (e.g., images). Used for sequential data (e.g., text, time series).
Uses convolutional and pooling layers. Uses feedback loops to retain information.
This question paper covers all the units and gives a balanced distribution of theory and
practical application. To prepare for this type of exam:
4o
You said:
answer all the Qustions
ChatGPT said:
ChatGPT
Here are the detailed answers for all the questions from the 70 Marks Exam:
Machine Learning is a branch of artificial intelligence that enables systems to learn and
improve from data without being explicitly programmed.
Deep Learning is a subset of machine learning that uses neural networks with multiple layers
(deep neural networks) to model complex patterns.
Difference: Machine Learning focuses on structured data, while Deep Learning can handle
unstructured data like images and text using advanced neural network architectures.
Supervised Learning: Uses labeled data for training (e.g., classification, regression).
Unsupervised Learning: Uses unlabeled data to find hidden patterns (e.g., clustering,
association).
Overfitting: Model learns noise and details in training data, performing poorly on test data.
o Example: A polynomial regression curve that passes through all training points but
fails for new data.
Underfitting: Model fails to learn patterns in data, performing poorly on both training and
test data.
o Example: A linear regression model for non-linear data.
Feature Scaling ensures features have the same scale, improving the performance of
algorithms like gradient descent or distance-based methods. Techniques include
normalization and standardization.
The Apriori Algorithm identifies frequent itemsets in transactional datasets and generates
association rules. It uses support and confidence measures to find patterns.
Linear Regression models the relationship between dependent (Y) and independent (X)
variables:
Y=mX+cY = mX + cY=mX+c
Example: Predicting house prices based on size.
Steps:
Decision Trees are flowchart-like structures used for classification or regression. They split
data based on feature conditions.
Advantages: Easy to interpret.
Disadvantages: Prone to overfitting.
Random Forest builds multiple decision trees on subsets of data and averages their outputs.
Advantages:
Reduces overfitting.
Handles large datasets.
Works well with categorical and continuous features.
3. Deep Learning
4. Reinforcement Learning
Bagging: Combines models by training on different data samples (e.g., Random Forest).
Boosting: Focuses on misclassified points (e.g., AdaBoost, Gradient Boost).
Gradient Boosting: Builds trees sequentially, reducing error.