Skip to content

Instantly share code, notes, and snippets.

@mGalarnyk
Created August 13, 2017 03:43
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mGalarnyk/8b5661eb143ac8edeea702da06dd3277 to your computer and use it in GitHub Desktop.
Save mGalarnyk/8b5661eb143ac8edeea702da06dd3277 to your computer and use it in GitHub Desktop.
Machine Learning (Stanford) Coursera Advice for Machine Learning System Design Quiz (Week 6, Quiz 2) for the github repo: https://github.com/mGalarnyk/datasciencecoursera/tree/master/Stanford_Machine_Learning

Machine Learning Week 6 Quiz 2 (Machine Learning System Design) Stanford Coursera

Github repo for the Course: Stanford Machine Learning (Coursera)
Quiz Needs to be viewed here at the repo (because the questions and some image solutions cant be viewed as part of a gist)

Question 1

Statistic Solution
Accuracy (85 + 10) / (1000) = .095
Precision (85) / (85 + 890) = 0.087
Recall There are 85 true positives and 15 false negatives, so recall is 85 / (85 + 15) = 0.85.
F1 Score (2 * (0.087 * 0.85)) / (0.087 + 0.85) = 0.16

Question 2

True/False Answer Explanation
False We train a learning algorithm with a small number of parameters (that is thus unlikely to overfit).
True We train a learning algorithm with a large number of parameters (that is able tolearn/represent fairly complex functions). You should use a "low bias" algorithm with many parameters, as it will be able to make use of the large dataset provided. If the model has too few parameters, it will underfit the large training set.
True The features x contain sufficient information to predict y accurately. (For example, one way to verify this is if a human expert on the domain can confidently predict y when given only x). It is important that the features contain sufficient information, as otherwise no amount of data can solve a learning problem in which the features do not contain enough information to make an accurate prediction.
False We train a model that does not use regularization. Even with a very large dataset, some regularization is still likely to help the algorithm's performance, so you should use cross-validation to select the appropriate regularization parameter.
False The classes are not too skewed. The problem of skewed classes is unrelated to training with large datasets.
True Our learning algorithm is able to represent fairly complex functions (for example, if we train a neural network or other model with a large number of parameters). You should use a complex, "low bias" algorithm, as it will be able to make use of the large dataset provided. If the model is too simple, it will underfit the large training set.
False When we are willing to include high order polynomial features of x As we saw with neural networks, polynomial features can still be insufficient to capture the complexity of the data, especially if the features are very high-dimensional. Instead, you should use a complex model with many parameters to fit to the large training set.

Question 3

True/False Answer Explanation
True The classifier is likely to now have lower recall. Increasing the threshold means more y = 0 predictions. This will increase the decrease of true positives and increase the number of false negatives, so recall will decrease.
False The classifier is likely to have unchanged precision and recall, but lower accuracy. By making more y = 0 predictions, we decrease true and false positives and increase true and false negatives. Thus, precision and recall will certainly change. We cannot say whether accuracy will increase or decrease.
False The classifier is likely to have unchanged precision and recall, but thus the same F1 score. By making more y = 0 predictions, we decrease true and false positives and increase true and false negatives. Thus, precision and recall will certainly change. We cannot say whether the F1 score will increase or decrease.
False The classifier is likely to now have lower precision. Increasing the threshold means more y = 0 predictions. This will decrease both true and false positives, so precision will increase, not decrease.

Question 4

True/False Answer Explanation
True If you always predict non-spam (output y = 0 ), your classifier will have a recall of 0%. Since every prediction is y = 0, there will be no true positives, so recall is 0%.
False If you always predict spam (output y = 1), your classifier will have a recall of 0% and precision of 99%. Every prediction is y = 1, so recall is 100% and precision is only 1%.
True If you always predict non-spam (output y = 0), your classifier will have 99% accuracy on the training set, and it will likely perform similarly on the cross validation set. The classifier achieves 99% accuracy on the training set because of how skewed the classes are. We can expect that the cross-validation set will be skewed in the same fashion, so the classifier will have approximately the same accuracy.
True If you always predict spam (output y = 1), your classifier will have a recall of 100% and precision of 1%. Since every prediction is y = 1, there are no false negatives, so recall is 100%. Furthermore, the precision will be the fraction of examples with are positive, which is 1%.
False A good classifier should have both a high precision and high recall on the cross validation set. Different classifiers are made for different reasons with different goals.
True If you always predict non-spam (output y=0), your classifier will have an accuracy of 99%. none needed.

Question 5

True/False Answer Explanation
True Using a very large training set makes it unlikely for model to overfit the training data A sufficiently large training set will not be overfit, as the model cannot overfit some of the examples without doing poorly on the others.
False It is a good idea to spend a lot of time collecting a large amount of data before building your first version of a learning algorithm. You cannot know whether a huge dataset will be important until you have built a first version and find that the algorithm has high variance.
False After training a logistic regression classifier, you must use 0.5 as your threshold for predicting whether an example is positive or negative. You can and should adjust the threshold in logistic regression using cross validation data.
False If your model is underfitting the training set, then obtaining more data is likely to help. If the model is underfitting the training data, it has not captured the information in the examples you already have. Adding further examples will not help any more.
True The "error analysis" process of manually examining the examples which your algorithm got wrong can help suggest what are good steps to take (e.g., developing new features) to improve your algorithm's performance. This process of error analysis is crucial in developing high performance learning systems, as the space of possible improvements to your system is very large, and it gives you direction about what to work on next.
True On skewed datasets (e.g., when there are more positive examples than negative examples), accuracy is not a good measure of performance and you should instead use F1 score based on the precision and recall. This is a wonderful interview question.
@shimanto-rehman
Copy link

In answer to the question no 4, the option "A good classifier should have both high precision and high recall on the cross-validation set" is not false. That should be true. And the answer sheet needs to corrected.

@misterdarkness
Copy link

misterdarkness commented Sep 22, 2020

Machine learning is very cool, I like it, but first of all you need to develop yourself, as for me. When I couldn't keep up with the lessons, I always turned to the site https://samplius.com/free-essay-examples/social-issues/, which has long been the best knowledge library for students. With this site, I received excellent marks and knowledge, I advise everyone who is looking for development.

@beanter8
Copy link

It's the first time everything, so I'm clumsy and excited
The memories of those days still look like dreams. Where are you going now? skribbl io tetris

@PeterNa13475807
Copy link

Thank you! Very useful. 🏴󠁧󠁢󠁥󠁮󠁧󠁿

@Jifar71
Copy link

Jifar71 commented Jan 23, 2022

thank you so much......

@quanghieucorp
Copy link

Useful and good information for the reader. Thank you very much. wordle game

@hduckyman
Copy link

As far as I see with the question (A good classifier must have both high accuracy and high recall on the cross-validator) is correct, not wrong like your answer. Please review that answer, thank you very much.
P/S: fnaf world

@satyamparashar
Copy link

Q1-0.16 is a wrong answer

@jamesmouli
Copy link

There are two main types of errors present in any machine learning model. They are Reducible Errors and Irreducible Errors. Irreducible errors are errors which will always be present in a machine learning model, because of unknown variables, and whose values cannot be reduced.
krnl roblox executor
hydrogen exploit
fluxus exploit

@jumany298
Copy link

jumany298 commented Sep 30, 2023

Try out New Fluxus executor for roblox. Download it for free

https://www.softlay.com/downloads/fluxus

@daviddaren023
Copy link

daviddaren023 commented Oct 9, 2023

The Hydrogen Executor App, developed by leading experts in the field of clean energy, is a user-friendly, versatile tool designed to optimize the utilization of hydrogen as a clean energy source.
https://hydrogenexecutor.online/
Hydrogen Executor
HYDROGEN EXECUTOR KEY
BLOX FRUITS SCRIPT
Roblox Mobile Executor

@libbyapp
Copy link

LIBBY APP FOR KINDLE is a remarkable tool that brings the library to your fingertips, offering an extensive catalog of eBooks and audiobooks for all ages and tastes.

@rajeshshymala2020
Copy link

Hydrogen Executor is a number one roblox exploit for android devices. It is first launched for mobile devices but the developers are working round the clock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment