Document (AI&ML)
Document (AI&ML)
**
1. **Linear Model:**
\[
\]
Where:
2. **Sigmoid Function:**
The linear result \(z\) is passed through the sigmoid function to squash the
output into a probability range between 0 and 1:
\[
\]
3. **Classification:**
- **Input Features:**
- Sender reputation.
- Email length.
- **Output:**
Logistic regression predicts the probability of an email being spam. If \(P >
0.5\), classify as spam.
- **Input Features:**
- **Output:**
Logistic regression outputs the probability of having the disease. For
example, \(P(disease = 1) = 0.8\) indicates an 80% chance.
- **Input Features:**
- **Output:**
- **Input Features:**
- **Output:**
**1. What is Machine Learning, and how does it work? Provide an example.**
*Answer:*
*Example:* Predicting house prices based on features like size, location, and
number of rooms by training a regression model on historical data.
**2. What are the different types of Machine Learning? Provide examples.**
*Answer:*
*Answer:*
Overfitting occurs when a model performs well on training data but poorly on
unseen data because it learns noise instead of general patterns.
*Prevention techniques:*
- Perform cross-validation.
*Answer:*
*Answer:*
*Answer:*
*Answer:*
- **Bias:** Error from incorrect assumptions in the model (underfitting).
*Answer:*
**4. What is gradient descent, and how does it work? Provide an example.**
*Answer:*
*Answer:*
*Answer:*
*Example:*
|--------------|--------------------|--------------------|
*Answer:*
*Answer:*
*Answer:*
*Answer:*
**1. Describe a challenging ML project you worked on. How did you approach
it?**
*Example:*
*Example:*
*Answer:*
- For smaller datasets with fewer features, linear regression or decision trees
work well.
*Example:* For predicting loan defaults with structured data, I started with
logistic regression and later tried XGBoost for better performance.
Would you like to dive deeper into any of these topics or need specific
domain-related ML examples?
*Answer:*
**2. What are the different types of AI? Give an example of each.**
*Answer:*
- **General AI (Strong AI):** Can perform any intellectual task like a human.
*Example:* Currently hypothetical, but a system that can think and reason
like a person could fit here.
*Answer:*
Machine Learning is a subset of AI that allows systems to learn from data and
improve over time without explicit programming.
*Answer:*
Overfitting occurs when a model performs well on training data but poorly on
unseen data because it has memorized specific patterns rather than
generalizing.
*Answer:*
*Answer:*
*Answer:*
*Example:* Predicting house prices based on labeled data with features like
size, location, and price.
*Answer:*
*Answer:*
**5. What are GANs, and where are they used? Provide an example.**
*Answer:*
*Answer:*
*Answer:*
Backpropagation adjusts the weights of a neural network by minimizing the
error using gradients.
*Answer:*
*Answer:*
*Answer:*
*Answer:*
*Answer:*
*Example:*
“AI is like teaching a machine to recognize patterns and make decisions. For
example, AI in email applications learns to identify spam by analyzing
common words and behaviors of spam emails.”
*Answer:*
*Answer:*
*Answer:*
*Answer:*
*Answer:*
- Autonomous vehicles.
*Answer:*
- **Supervised Learning:** Models learn using labeled data (e.g., email spam
detection).
- **Unsupervised Learning:** Models identify patterns in unlabeled data (e.g.,
customer segmentation).
*Answer:*
**2. Explain the difference between AI, ML, and Deep Learning (DL).**
*Answer:*
- **DL:** Subset of ML using neural networks with many layers for feature
extraction and decision-making.
*Answer:*
Overfitting occurs when a model performs well on training data but poorly on
unseen data.
*Prevention techniques include:*
- Cross-validation.
*Answer:*
*Answer:*
*Answer:*
*Answer:*
*Answer:*
- Bias in AI models.
*Answer:*
*Answer:*
*Answer:*
*Answer:*
*Answer:*
AI is like teaching computers to mimic how humans think and solve problems
—whether it’s recognizing images, understanding language, or making
recommendations based on your preferences.
Linear regression fits a straight line (\(y = mx + c\)) to predict values based
on the relationship between the input features and the target.
The algorithm splits the data into branches based on feature conditions (e.g.,
“If age > 25 and income > $50k, then Buy”).
Random forest uses multiple decision trees and combines their results to
improve accuracy and avoid overfitting.
SVM finds the best boundary (hyperplane) that separates classes while
maximizing the margin between them.
PCA identifies key patterns and reduces the dataset’s size while retaining its
essence.
The agent (robot) learns the best actions to maximize its cumulative rewards
over time.
1. **Hyperplane**:
In SVM, a hyperplane is a line (in 2D) or a plane (in higher dimensions) that
separates data into different classes.
2. **Support Vectors**:
These are the data points closest to the hyperplane. They influence the
position and orientation of the hyperplane.
3. **Margin**:
The margin is the distance between the hyperplane and the closest support
vectors from each class. SVM tries to maximize this margin for better
generalization.
Imagine you are a teacher sorting students into two groups based on their
test scores:
You plot their math and science scores on a graph. An SVM will try to draw
the best straight line (hyperplane) that separates these two groups, ensuring
the maximum margin from the closest students in each group.
1. Identify the boundary (line or curve) that separates circles from squares.
2. Ensure the boundary is as far away as possible from the nearest circle and
square.
If the data isn’t linearly separable, SVM can use a **kernel trick** to map the
data into a higher dimension, making it separable.
### **Applications**