Hello Everyone,
Welcome to the 28th edition of my newsletter ML & AI Cupcakes!
The agenda of today’s newsletter is to have a quick check of your understanding of Python for Machine Learning.
I have compiled a practice set which contains questions related to data preprocessing, model parameters, model training, evaluation metrics etc.
Before we start the quiz, just wanted to share something with you.
If you are a complete beginner in the field of machine learning and python, you can refer to the following cheat sheet to kick start your journey.
There is a lot more to learn, but this will help you to atleast start with your first machine learning project. These python commands are very basic and easy to understand.
Let me know if you want me to create more of such cheat sheets for you!
Multiple Choice Questions (MCQs)
If you don’t know any of the answers or want to understand a topic in more detail, I recommend you take help from scikit-learn documentation .
StandardScaler in scikit-learn is used for ____ .
Feature scaling
Feature selection
Imputing missing values
Removing duplicates
Which of the following is used to transform the data into a standard normal distribution?
StandardScaler()
MinMaxScaler()
SimpleImputer()
LabelEncoder()
Which of the following can be used to handle missing values?
StandardScaler()
MinMaxScaler()
SimpleImputer()
LabelEncoder()
What is the use of OneHotEncoder in scikit-learn?
Feature scaling
Feature selection
Feature encoding
Data normalization
The default range for MinMaxScaler in scikit-learn is _____ .
(0,1)
(-1,1)
(-1,0)
(0, infinity)
Which scikit-learn module is used to split the data into training and test sets?
datasets
preprocessing
model_selection
metrics
Which library is used for training machine learning models in Python?
numpy
pandas
sklearn
matplotlib
What is the correct syntax for creating a DataFrame in pandas.
pd.selectDataFrame(data, cols =[“A”, “B”])
pd.DataFrame(data, columns =[“A”, “B”])
pd.newDataFrame(data, columns =[“A”, “B”])
pd.createDataFrame(data, columns =[“A”, “B”])
What is the use of fit() method in scikit-learn?
Data visualization
Data preprocessing
Model training
Model evaluation
Which method is used to make model predictions in scikit-learn?
predictions()
predict()
fit()
transform()
What does cross_val_score function in scikit-learn return?
average of scores for all the folds
standard deviation of scores for all the folds
mode of scores for all the folds
a list of scores for each fold
What is the default node splitting criterion in DecisionTreeClassifier in scikit-learn?
gini index
entropy
log_loss
None of the above
What is the use of GridSearchCV in scikit-learn?
Data preprocessing
Model training
Hyperparameter tuning
Data Visualization
Which class in scikit-learn is used for K-Nearest Neighbor (KNN) algorithm?
KNN
KNeighborsClassifier
KNearestNeighbor
KNNClassifier
Which class in sklearn.linear_model module implements L1 regularization?
Lasso
Ridge
LinearRegression
ElasticNet
Which class in sklearn.linear_model module implements L2 regularization?
Lasso
Ridge
LinearRegression
ElasticNet
Is regularization applied by default for LogisticRegression in scikit-learn?
Yes
No
Which parameter is used by Logistic Regression in scikit-learn to define regularization type?
penalty
fit_intercept
solver
max_iter
Which of the following is not a parameter of Decision Tree Classifier in scikit-learn?
max_depth
criterion
penalty
min_samples_split
Which parameter is present in RandomForestClassifier in scikit-learn, but not in DecisionTreeClassifier?
criterion
max_depth
max_features
n_estimators
Which function is used to calculate accuracy scikit-learn?
metrics.accuracy
metrics.accuracy_score
metrics.calculate_accuracy
metrics.cross_val_score
There is no difference between fit() and fit_transform() methods in scikit_learn.
True
False
Answers
a 2. a 3. c 4. c 5. a 6. c 7. c 8. b 9. c 10. b 11. d 12. a 13. c 14. b 15. a 16.b 17. a 18. a 19. c 20. d 21. b 22. b
Writing each newsletter takes a lot of research, time and effort. Just want to make sure it reaches maximum people to help them grow in their AI/ML journey.
It would be great if you could share this newsletter with your network.
Also, please let me know your feedbacks and suggestions in the comments section. That will help me keep going. Even a “like” on my posts will tell me that my posts are helpful to you.
See you soon!
-Kavita
Very helpful. Thanks!
عبدالرحمن عبدالله ابراهيم