TGViewer
Artificial Intelligence & ChatGPT Prompts Artificial Intelligence & ChatGPT Prompts @curiousprogrammer ยท 42.2K subscribers
Post #2183 899
๐Ÿš€ AI Interview Questions with Answers โ€” Part 4

31. What is a classification problem in Machine Learning?

A classification problem is a type of supervised learning where the model predicts categories or labels instead of numerical values.

Examples:
- Spam or Not Spam
- Fraud or Not Fraud
- Disease Positive or Negative

Goal: Assign input data to the correct class.

Example: An email spam filter classifies emails into:
- Spam
- Not Spam

32. What is the difference between Logistic Regression and Linear Regression?

Linear Regression
- Predicts continuous values
- Used for regression tasks
- Output can be any number
- Straight-line relationship

Logistic Regression
- Predicts categories
- Used for classification tasks
- Output ranges between 0 and 1
- Uses sigmoid function

Linear Regression Example: Predicting house prices.

Logistic Regression Example: Predicting whether a customer will buy a product or not.

Sigmoid Function Used in Logistic Regression:
sigma(x) = 1 / (1 + e^(-x))
This converts output into probabilities.

33. How does a Decision Tree work?

A Decision Tree splits data into branches based on conditions.
It works like a flowchart:
- Root node โ†’ Starting point
- Decision nodes โ†’ Conditions
- Leaf nodes โ†’ Final prediction

How It Works:
1. Select best feature
2. Split the dataset
3. Repeat recursively

Advantages:
- Easy to understand
- Works for classification and regression
- Handles nonlinear data

Example: Loan approval system:
Income > โ‚น50,000?
Credit score good?
Approve or reject loan

34. What are the advantages of Random Forest?

Random Forest is an ensemble learning algorithm that combines multiple Decision Trees.

Advantages:
- Higher accuracy
- Reduces overfitting
- Handles large datasets
- Works with missing values
- Robust to noise

How It Works: Many trees vote for the final prediction.

Example: If 100 trees predict:
80 say โ€œSpamโ€
20 say โ€œNot Spamโ€
Final output = Spam

35. What is Support Vector Machine (SVM)?

Support Vector Machine (SVM) is a supervised learning algorithm mainly used for classification.
It finds the best boundary (hyperplane) that separates classes.

Goal: Maximize the distance between classes.

Advantages:
- Effective in high-dimensional data
- Works well with smaller datasets
- Powerful for complex classification tasks

Example: Separating:
Cats vs Dogs
Fraud vs Non-Fraud
using the best possible boundary.

36. Why is Naive Bayes called โ€œnaiveโ€?

Naive Bayes is called โ€œnaiveโ€ because it assumes all features are independent of each other.
In real life, this assumption is often unrealistic.

Example: While predicting spam emails:
Words may actually be related
But Naive Bayes assumes independence

Despite this โ€œnaiveโ€ assumption, the algorithm performs surprisingly well in:
- Text classification
- Spam detection
- Sentiment analysis

37. How does the KNN algorithm work?

K-Nearest Neighbors (KNN) classifies data based on the closest neighboring data points.

How It Works:
1. Choose value of K
2. Find nearest neighbors
3. Majority vote determines class

Example:
If K = 5
Among 5 nearest neighbors:
4 are โ€œRedโ€
1 is โ€œBlueโ€
Prediction = Red

Advantages:
- Simple and intuitive
- No training phase

Disadvantages:
- Slow for large datasets
- Sensitive to irrelevant features

38. What is a confusion matrix?

A confusion matrix is a table used to evaluate classification models.
It compares actual values and predicted values.

Main Components:
- Actual Positive, Predicted Positive โ†’ True Positive (TP)
- Actual Positive, Predicted Negative โ†’ False Negative (FN)
- Actual Negative, Predicted Positive โ†’ False Positive (FP)
- Actual Negative, Predicted Negative โ†’ True Negative (TN)

Why Itโ€™s Important:
It helps calculate accuracy, precision, recall, and F1-score.

39. What is the difference between precision and recall?
More from @curiousprogrammer
  1. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  2. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  3. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  4. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  5. Oct 4, 2026Frontend vs Backend Developer โœ…
  6. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’