Applied Machine Learning in Python Coursera Assignment Answers

Get the Applied Machine Learning in Python Coursera course assignment answers for free. University of Michigan providing the course on Coursera. Applied Machine Learning in Python by University of Michigan is a four week assignment based course upon completing the course you will get a valuable certificate which will enhance your job profile.

Applied Machine Learning in Python Coursera Assignment Answers
Applied Machine Learning in Python Coursera Assignment Answers

About Applied Machine Learning In Python Course

TittleDetails
Course NameApplied Machine Learning in Python
Instructor NameKevyn Collins-Thompson
InstituteUniversity of Michigan
Available onCoursera
LinkClick Here
Financial AidYes, Financial Aid Available
Course Duration4 Weeks
Certificate AvailableYes, after the assignment complete you will get the certificate

Week 1: Assignment Answers of Applied Machine Learning in Python

There are two types of Assignment available in Week 1. One is Quiz based and another is programming assignment. We have shared answers of both assignment. Use these answers and you will score more than 80% score which is required in order to pass the assignment.

Week 1 Quiz Answers

Question 1: Select the option that correctly completes the sentence: Training a model using labeled data and using this model to predict the labels for new data is known as ____________.

Answer: Supervised Learning

Question 2: Select the option that correctly completes the sentence: Modeling the features of an unlabeled dataset to find hidden structure is known as ____________.

Answer: Unsupervised Learning

Question 3: Select the option that correctly completes the sentence: Training a model using categorically labelled data to predict labels for new data is known as __________.

Answer: Classification

Question 4: Select the option that correctly completes the sentence: Training a model using labelled data where the labels are continuous quantities to predict labels for new data is known as __________.

Answer: Regression

Question 5: Using the data for classes 0, 1, and 2 plotted below, what class would a K Neighbors Classifier classify the new point as for k = 1 and k = 3?

Answer:

  • k=1: Class 1
  • k=3: Class 2

Question 6: Which of the following is true for the nearest neighbor classifier (Select all that apply):

Answer:

  • A higher value of k leads to a more complex decision boundary
  • Given a data instance to classify, computes the probability of each possible class using a statistical model of the input features

Question 7: Why is it important to examine your dataset as a first step in applying machine learning? (Select all that apply):

Answer:

  • See what type of cleaning or preprocessing still needs to be done
  • You might notice missing data
  • Gain insight on what machine learning model might be appropriate, if any
  • Get a sense for how difficult the problem might be

Question 8: The key purpose of splitting the dataset into training and test sets is:

Answer: To estimate how well the learned model will generalize to new data

Question 9: The purpose of setting the random_state parameter in train_test_split is: (Select all that apply)

Answer: To make ………………………………………..

Question 10: Given a dataset with 10,000 observations and 50 features plus one label, what would be the dimensions of X_train, y_train, X_test, and y_test? Assume a train/test split of 75%/25%.

Answer:

  • X_train: (7500, 50)
  • y_train: (7500, )
  • X_test: (2500, 50)
  • y_test: (2500, )

Week 1 Programming Assignment Answers

A github file has been attached below the file has all the answers for the programming assignment. Just copy and paste the codes and then submit.

Click here to visit the github file.

Week 2: Assignment Answers of Applied Machine Learning in Python

Week 2 also have 2 assignments one is Quiz based and another one is programming based all the answers has been shared below.

Week 2 Quiz Assignment Answers

Question 1: After training a ridge regression model, you find that the training and test set accuracies are 0.98 and 0.54 respectively. Which of the following would be the best choice for the next ridge regression model you train?

Answer: You are overfitting, the next model trained should have a higher value for alpha

Question 2: After training a Radial Basis Function (RBF) kernel SVM, you decide to increase the influence of each training point and to simplify the decision surface. Which of the following would be the best choice for the next RBF SVM you train?

Answer: Decrease C and gamma

Question 3: Which of the following is an example of multiclass classification? (Select all that apply)

Answer: Classify a set of fruits as apples, oranges, bananas, or lemons

Question 4: Looking at the plot below which shows accuracy scores for different values of a regularization parameter lambda, what value of lambda is the best choice for generalization?

Answer: 10

Question 5: Suppose you are interested in finding a parsimonious model (the model that accomplishes the desired level of prediction with as few predictor variables as possible) to predict housing prices. Which of the following would be the best choice?

Answer: Lasso Regression

Question 6: Match the plots of SVM margins below to the values of the C parameter that correspond to them.

Answer: 0.1, 1, 10

Question 7: Use Figures A and B below to answer questions 7, 8, 9, and 10.

Answer: Figure A: Ridge Regression, Figure B: Lasso Regression

Question 8: Looking at Figure A and B, what is a value of alpha that optimizes the R2 score for the Ridge Model?

Answer: 3

Question 9: Looking at Figure A and B, what is a value of alpha that optimizes the R2 score for the Lasso Model?

Answer: 10

Question 10: When running a LinearRegression() model with default parameters on the same data that generated Figures A and B the output coefficients are:

Answer: 48.8

Question 11: Which of the following is true of cross-validation? (Select all that apply)

Answer:

  • Fits multiple models on different splits of the data
  • Helps prevent knowledge about the test set from leaking into the model
  • Increases generalization ability and computational complexity

Week 2 Programming Assignment

In Week 2 Programming Assignment we have to upload a python file. You have given you the file below just download the python file and upload in the My Submission. And then click on create submission and then upload the python file. Once successfully uploaded click submit. Coursera will take around 1-2minutes to check the file and then give you 100% score.

Week 3: Assignment Answers of Applied Machine Learning in Python

Just like Week 1 and Week 2 Week 3 has also two different types of Assignment one is Quiz based and another is Programming Assignment. All the Answers and Python file has been shared below.

Week 3 Quiz Answers

Question 1: A supervised learning model has been built to predict whether someone is infected with a new strain of a virus. The probability of any one person having the virus is 1%. Using accuracy as a metric, what would be a good choice for a baseline accuracy score that the new model would want to outperform?

Answer: 0.99

Question 2: Given the following confusion matrix:

Predicted PositivePredicted Negative
Condition Positive964
Condition Negative819

Compute the accuracy to three decimal places.

Answer: 0.906

Question 3: Given the following confusion matrix:

Predicted PositivePredicted Negative
Condition Positive964
Condition Negative819

Compute the precision to three decimal places.

Answer: 0.923

Question 4: Given the following confusion matrix:

Predicted PositivePredicted Negative
Condition Positive964
Condition Negative819

Compute the recall to three decimal places.

Answer: 0.960

Question 5:Using the fitted model `m` create a precision-recall curve to answer the following question: For the fitted model `m`, approximately what precision can we expect for a recall of 0.8? (Use y_test and X_test to compute the precision-recall curve. If you wish to view a plot, you can use `plt.show()` )

Answer: 0.6

Question 6: Given the following models and AUC scores, match each model to its corresponding ROC curve.

  • Model 1 test set AUC score: 0.91
  • Model 2 test set AUC score: 0.50
  • Model 3 test set AUC score: 0.56

Answer:

  • Model 1: Roc 1
  • Model 2: Roc 3
  • Model 3: Roc 2

Question 7: Given the following models and accuracy scores, match each model to its corresponding ROC curve.

  • Model 1 test set accuracy: 0.91
  • Model 2 test set accuracy: 0.79
  • Model 3 test set accuracy: 0.72

Answer:

  • Model 1: Roc 1
  • Model 2: Roc 2
  • Model 3: Roc 3

Question 8: Using the fitted model `m` what is the macro precision score? (Use y_test and X_test to compute the precision score.)

Answer: 0.744

Question 9: Which of the following is true of the R-Squared metric? (Select all that apply)

Answer:

  • The worst possible score is 0.0
  • The best possible score is 1.0

Question 10: In a future society, a machine is used to predict a crime before it occurs. If you were responsible for tuning this machine, what evaluation metric would you want to maximize to ensure no innocent people (people not about to commit a crime) are imprisoned (where crime is the positive label)?

Answer: Precision

Question 11: Consider the machine from the previous question. If you were responsible for tuning this machine, what evaluation metric would you want to maximize to ensure all criminals (people about to commit a crime) are imprisoned (where crime is the positive label)?

Answer: Recall

Question 12: A classifier is trained on an imbalanced multiclass dataset. After looking at the model’s precision scores, you find that the micro averaging is much smaller than the macro averaging score. Which of the following is most likely happening?

Answer: The model is probably misclassifying the infrequent labels more than the frequent labels.

Question 13: Using the already defined RBF SVC model `m`, run a grid search on the parameters C and gamma, for values [0.01, 0.1, 1, 10]. The grid search should find the model that best optimizes for recall. How much better is the recall of this model than the precision? (Compute recall – precision to 3 decimal places) (Use y_test and X_test to compute precision and recall.)

Answer: 0.52

Question 14: Using the already defined RBF SVC model `m`, run a grid search on the parameters C and gamma, for values [0.01, 0.1, 1, 10]. The grid search should find the model that best optimizes for precision. How much better is the precision of this model than the recall? (Compute precision – recall to 3 decimal places) (Use y_test and X_test to compute precision and recall.)

Answer: 0.15

Week 3 Programming Assignment

In Week 3 Programming Assignment we have to upload a python file. You have given you the file below just download the python file and upload in the My Submission. And then click on create submission and then upload the python file. Once successfully uploaded click submit. Coursera will take around 1-2minutes to check the file and then give you 100% score.

Week 4: Assignment Answers of Applied Machine Learning in Python

Like other week assignments Week 4 assignment also has a week and a programming assignment. All the answers and uploading files are given below.

Week 4 Quiz Answers

Question 1: Which of the following is an example of clustering?

Answer: Separate

Question 2: Which of the following are advantages to using decision trees over other models? (Select all that apply)

Answer: Trees are easy to interpret and visualize

Question3: What is the main reason that each tree of a random forest only looks at a random subset of the features when building each node?

Answer: To improve generalization by reducing correlation among the trees and making the model more robust to bias.

Question 4: Which of the following supervised machine learning methods are greatly affected by feature scaling? (Select all that apply)

Answer:

  • Support Vector Machines
  • Neural Networks
  • KNN

Question 5: Select which of the following statements are true.

Answer:

  • For a model that won’t overfit a training set, Naive Bayes would be a better choice than a decision tree.
  • For predicting future sales of a clothing line, Linear regression would be a better choice than a decision tree regressor.

Question 6: Match each of the prediction probabilities decision boundaries visualized below with the model that created them.

Answer:

  1. Neural Network
  2. KNN (k=1)
  3. Decision Tree

Question 7: A decision tree of depth 2 is visualized below. Using the `value` attribute of each leaf, find the accuracy score for the tree of depth 2 and the accuracy score for a tree of depth 1. What is the improvement in accuracy between the model of depth 1 and the model of depth 2? (i.e. accuracy2 – accuracy1)

Answer: 0.06745

Question 8: For the autograded assignment in this module, you will create a classifier to predict whether a given blight ticket will be paid on time (See the module 4 assignment notebook for a more detailed description). Which of the following features should be removed from the training of the model to prevent data leakage? (Select all that apply)

Answer:

  • collection_status – Flag for payments in collections
  • compliance_detail – More information on why each ticket was marked compliant or non-compliant

Question 9: Which of the following might be good ways to help prevent a data leakage situation? Given the neural network below, find the correct outputs for the given values of x1 and x2.

Answer:

  • If time is a factor, remove any data related to the event of interest that doesn’t take place prior to the event.
  • Remove variables that a model in production wouldn’t have access to
  • Sanity check the model with an unseen validation set.

Question 10: The neurons that are shaded have an activation threshold, e.g. the neuron with >1? will be activated and output 1 if the input is greater than 1 and will output 0 otherwise.

Answer:

x1x2output
000
011
101
110

Week 4 Programming Assignment

In Week 4 Programming Assignment we have to upload a python file. You have given you the file below just download the python file and upload in the My Submission. And then click on create submission and then upload the python file. Once successfully uploaded click submit. Coursera will take around 1-2minutes to check the file and then give you 100% score.

In Week 4 Programming Assignment we have to upload a python file. You have given you the file below just download the python file and upload in the My Submission. And then click on create submission and then upload the python file. Once successfully uploaded click submit. Coursera will take around 1-2minutes to check the file and then give you 100% score.

Disclaimer

The content of mypharmaguide.com is provided for information and educational purposes only. We are not owner of the any PDF Material/Books/Notes/Articles published in this website. No claim is made as to the accuracy or authenticity of the PDF Material/Books/Notes/Articles of the website. In no event will this site or owner be liable for the accuracy of the information contained on this website or its use. mypharmaguide.com provides freely available PDF Material/Books/Notes/Articles on the Internet or other resources like Links etc. This site does not take any responsibility and legal obligations due to illegal use and abuse of any service arises due to articles and information published on the website. No responsibility is taken for any information that may appear on any linked websites.

Conclusion

7 Comments

  1. i am very thankfull to you i was very stressed for assignment no2. i haved tried more than 10 time but did not work. thanks to you now i can sleep without any stress. thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.