Intermediate Flashcards
(38 cards)
What is a good use case for implementing neural networks for supervised learning?
Neural networks are ideal for scenarios where traditional ML algorithms fail, especially with unstructured data like images, text, or audio. They are also preferred when the dataset size is large, allowing for improved pattern detection.
Should neural networks be applied in healthcare for predicting diagnosis and medication?
No, neural networks are not suitable where interpretability is crucial, such as in healthcare. Decision trees or random forests are preferred for their transparency.
Why do we mostly use the ReLU activation function in CNNs?
ReLU is simple to compute and avoids the vanishing gradient problem, making it effective for deep networks in CNNs.
What is the role of fully connected layers in a CNN?
Fully connected layers learn non-linear combinations of high-level features extracted by convolutional layers, providing a meaningful feature space.
What are some drawbacks of using CNNs on image datasets?
CNNs require a lot of labeled data and can be susceptible to spurious patterns. Transfer learning and data augmentation can address these issues.
What text pre-processing steps are required for sentiment analysis of Twitter posts?
1) Lowercasing 2) Stemming 3) Lemmatization 4) Stop words removal 5) Noise removal 6) Remove emoticons.
Which evaluation metric is suitable for sentiment analysis?
Precision, Recall, F-score, and Accuracy are suitable metrics. F1 scores are often used due to class imbalance in sentiment analysis.
Which neural network configuration is likely to perform better on complex tasks?
The network with four hidden layers of four nodes each is likely to perform better due to its hierarchical learning capability.
What are the pros and cons of Batch Gradient Descent vs Stochastic Gradient Descent?
Batch Gradient Descent has better convergence but is computationally expensive for large datasets. Stochastic Gradient Descent is faster but can be noisy and less stable.
How is AUC different from ROC?
ROC is a curve showing a model’s performance at different thresholds, while AUC measures the area under the ROC curve.
How do k-means and hierarchical clustering differ?
K-Means is centroid-based and requires a predefined number of clusters, while hierarchical clustering is connectivity-based and does not require this.
Why are decision trees prone to overfitting?
Decision trees aim for homogeneity in leaf nodes, leading to capturing noise and complex patterns in training data, which results in overfitting.
How does multicollinearity affect linear regression models?
Multicollinearity affects the interpretation of the model, making it difficult to distinguish the individual effects of correlated independent variables.
Which evaluation metric should be used for linear regression with outliers?
MAE is preferred as it is robust to outliers, unlike MSE or RMSE which are sensitive to them.
What is the difference between r-squared and adjusted r-squared?
R-squared measures the variance explained by independent variables, while adjusted r-squared accounts for the number of variables and penalizes unnecessary ones.
How do we measure performance of a supervised learning model?
Performance metrics include R2, Adj. R2, RMSE, MAE for regression, and Accuracy, Precision, Recall, F1-Score for classification.
How do we measure performance of an unsupervised learning model?
Performance metrics include silhouette score and cophenetic correlation.
Can you plot 3D plots using matplotlib?
Yes, using the function: import numpy as np; import matplotlib.pyplot as plt; fig = plt.figure(); ax = plt.axes(projection =’3d’).
How is get_dummies() different from one hot encoder?
OneHotEncoder cannot process strings directly and requires mapping to integers, while pandas.get_dummies converts string columns into one-hot representation by default.
Name a tool to convert categorical columns into numeric columns.
LabelEncoder and OneHotEncoder from sklearn are popular tools for this purpose.
How will you remove duplicate data from a dataframe?
Use the ‘drop_duplicates()’ function to eliminate redundant rows from the DataFrame.
How do you select a sample from a dataframe?
Use df.sample() for random selection, df.sample(n=3) for n rows, df.sample(n=3, replace=True) for allowing duplicates, or df.sample(frac=0.50) for a fraction.
How does the groupby function work in Python?
The groupby() function splits data into groups based on criteria, allowing for aggregation and analysis of grouped data.
What are the parameters for the groupby function in Python?
Parameters include: by, axis, level, as_index, sort, group_keys, squeeze, and **kwargs.