0% found this document useful (0 votes)
13 views

Data Science Interview Questions

Interview qs

Uploaded by

ubergarima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Data Science Interview Questions

Interview qs

Uploaded by

ubergarima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

21.

What is ensemble
learning and how does it
improve model
performance?

Answer :
Ensemble Learning:
- Combines multiple
models (weak learners)
to create a stronger
model.
- Techniques:
- Bagging: Reduces
variance by averaging
predictions (e.g., Random
Forest).
- Boosting: Reduces
bias by sequentially
correcting errors (e.g.,
AdaBoost, Gradient
Boosting).
- Stacking: Combines
multiple models by
training a meta-model on
their predictions.

22. Explain the concept of


gradient descent.
Answer :
Gradient Descent:
- An optimization
algorithm used to
minimize the loss
function by iteratively
moving towards the
minimum value of the
function.
- Types:
- Batch Gradient
Descent: Uses the entire
dataset to compute the
gradient.
- Stochastic Gradient
Descent (SGD): Uses one
training example per
iteration.
- Mini-Batch Gradient
Descent: Uses a small
batch of training
examples per iteration.

23. What is the


importance of the
learning rate in gradient
descent?
Answer :
Learning Rate:
- A hyperparameter that
controls the step size
during gradient descent
updates.
- Importance:
- Too high: May cause
the algorithm to
overshoot the minimum.
- Too low: May result in
slow convergence or
getting stuck in local
minima.
- Choosing an appropriate
learning rate is crucial for
effective and efficient
training.

24. How do you handle


categorical data in
machine learning?

Answer :
Handling Categorical
Data:
- Label Encoding:
Converts categories to
numeric labels.
- One-Hot Encoding:
Converts categories to
binary vectors.
- Target Encoding:
Replaces categories with
the mean of the target
variable for each category.
- Frequency Encoding:
Replaces categories with
their frequency counts.

25. Explain the difference


between parametric and
non-parametric models.

Answer :
Parametric Models:
- Assumes a specific
form for the function that
models the data.
- Example: Linear
Regression.

Non-Parametric Models:
- Does not assume a
specific form and can
adapt to the data more
flexibly.
- Example: Decision Trees,
k-Nearest Neighbors
(k-NN).

26. What is the curse of


dimensionality and how
can it be addressed?

Answer :
Curse of Dimensionality:
- Refers to various
phenomena that arise
when analyzing and
organizing data in
high-dimensional spaces.
- Challenges: Increased
sparsity, overfitting,
increased computational
cost.

Addressing the Curse of


Dimensionality:
- Dimensionality
Reduction: Techniques
like PCA, t-SNE, LDA.
- Feature Selection:
Selecting the most
relevant features based
on importance scores.
- Regularization: Adding
penalties to model
complexity.
- Data Collection:
Gathering more data to
fill the high-dimensional
space.

27. Explain the concept of


a decision tree and its
components.
Answer :
Decision Tree:
- A tree-like model used
for classification and
regression tasks.
- Components:
- Root Node: The
topmost node
representing the entire
dataset.
- Internal Nodes: Nodes
that represent the
features used for splitting.
- Leaf Nodes: Terminal
nodes representing the
output or decision.
- Branches: Paths that
connect nodes and
represent decision rules.

28. What is ensemble


learning, and what are
some popular ensemble
techniques?

Answer :
Ensemble Learning:
- Combines multiple
models to create a more
robust and accurate
prediction.

Popular Ensemble
Techniques:
- Bagging (Bootstrap
Aggregating): Reduces
variance by training
multiple models on
different subsets of data
and averaging their
predictions (e.g., Random
Forest).
- Boosting: Reduces bias
by sequentially training
models, each correcting
the errors of its
predecessor (e.g.,
AdaBoost, Gradient
Boosting).
- Stacking: Combines
multiple models by
training a meta-model on
their predictions.

29. How does the


k-nearest neighbors
(k-NN) algorithm work?

Answer :
k-Nearest Neighbors
(k-NN) Algorithm:
- A simple,
non-parametric
classification and
regression algorithm.
- Steps:
- Choose the number of
neighbors (k).
- Calculate the distance
between the query point
and all training points.
- Select the k nearest
neighbors based on the
smallest distances.
- For classification,
assign the most frequent
class among the
neighbors.
- For regression,
average the values of the
neighbors.

30. What is the purpose


of the ROC curve and
AUC in evaluating models?

Answer :
ROC Curve (Receiver
Operating Characteristic):
- Plots the true positive
rate (TPR) against the
false positive rate (FPR)
at various threshold
settings.
- Shows the trade-off
between sensitivity (recall)
and specificity.
AUC (Area Under the
Curve):
- Measures the area
under the ROC curve.
- A higher AUC indicates a
better model
performance, with 1 being
a perfect model and 0.5
representing a random
model.
Follow for more
informative content:

You might also like