Docsity

Machine Learning 2026, Quizzes of Machine Learning

Toggle sidebar
bg1
Machine Learning 2026
What is the definition of learning from experience for a computer program?
A computer program is said to learn from experience E with respect to some class of tasks T
and performance measure P, if its performance at tasks in T, as measured by P, improves
with experience E.
Which problems can be solved with unsupervised learning? #2
• approach problems with little or no idea what our results should look like.
• derive structure from data where we don't necessarily know the effect of the variables.
What is the definition of a supervised learning problem?
Given a training set, learn a function h such that h of an input variable x is a "good" predictor
for the corresponding output variable y.
What is the definition of a hypothesis?
The predicting function h.
Give the pictorial process for a supervised learning problem.
Supervised Learning Problem.
What do we call a learning problem, if the target variable is continuous?
When the target variable that we're trying to predict is continuous, the learning problem is
also called a regression problem.
What do we call a learning problem, if the target variable can take on only a small number
of values?
When y can take on only a small number of discrete values, the learning problem is also
called a classification problem.
How do we measure the accuracy of a hypothesis function?
By using a cost function, usually denoted by J.
What is the definition of a cost function of a supervised learning problem?
Takes an average difference of all the results of the hypothesis with inputs from x's and the
actual output y's.
Give a pictorial representation of what the cost function of a supervised learning problem
does.
Cost function of a supervised learning problem.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Machine Learning 2026 and more Quizzes Machine Learning in PDF only on Docsity!

Machine Learning 2026

What is the definition of learning from experience for a computer program? A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E. Which problems can be solved with unsupervised learning? #

  • approach problems with little or no idea what our results should look like.
  • derive structure from data where we don't necessarily know the effect of the variables. What is the definition of a supervised learning problem? Given a training set, learn a function h such that h of an input variable x is a "good" predictor for the corresponding output variable y. What is the definition of a hypothesis? The predicting function h. Give the pictorial process for a supervised learning problem. Supervised Learning Problem. What do we call a learning problem, if the target variable is continuous? When the target variable that we're trying to predict is continuous, the learning problem is also called a regression problem. What do we call a learning problem, if the target variable can take on only a small number of values? When y can take on only a small number of discrete values, the learning problem is also called a classification problem. How do we measure the accuracy of a hypothesis function? By using a cost function , usually denoted by J. What is the definition of a cost function of a supervised learning problem? Takes an average difference of all the results of the hypothesis with inputs from x's and the actual output y's. Give a pictorial representation of what the cost function of a supervised learning problem does. Cost function of a supervised learning problem.

What are alternative terms of a Cost Function? #

  • Squared error function.
  • Mean squared error. What is a visual interpretation of the cost function? #
  • The training data set is scattered on the X-Y plane.
  • We are trying to make a straight line (defined by hθ(x)) which passes through these scattered data points. What is the contour line of a two variable function? A contour line of a two variable function has a constant value at all points of the same line. How do we implement an iteration step when calculating Gradient Descent in code? #
  • At each iteration j, one should simultaneously update the parameters.
  • Updating a specific parameter prior to calculating another one on the j iteration would yield to a wrong implementation. State the algorithm for gradient descent. Repeat until convergence, where j=0,1 represents the feature index number. Depict the graphical implementation of minimizing the cost function using gradient descent. #
  • We put theta 0 on the x axis and theta 1 on the y axis, with the cost function on the vertical z axis.
  • The points on our graph will be the result of the cost function using our hypothesis with those specific theta parameters. Why does gradient descent, regardless of the slope's sign, eventually converge to its minimum value? # The following graph shows that:
  • when the slope is negative, the value of theta 1 increases.
  • when the slope is positive, the value of theta 1 decreases. Why should we adjust the parameter alpha when using gradient descent? #
  • To ensure that the gradient descent algorithm converges in a reasonable time.

Multivariate form of the hypothesis function. What is the intuition of the multivariable form of a hypothesis function in the example of estimating housing prices? #

  • We can think about theta 0 as the basic price of a house, theta 1 as the price per square meter, theta 2 as the price per floor, etc.
  • x1 will be the number of square meters in the house, x2 the number of floors, etc. Give the vectorization of the multivariable form of a hypothesis function. Using the definition of matrix multiplication, our multivariable hypothesis function can be concisely represented as: Why do we assume that x0=1 in multivariate linear regression? Convention. What is the Gradient Descent for Multiple Variables? #
  • The gradient descent equation itself is generally the same form.
  • we just have to repeat it for our 'n' features. How can we speed up gradient descent? We can speed up gradient descent by having each of our input values in roughly the same range. Why does feature scaling speed up gradient descent? #
  • This is because theta will descend quickly on small ranges and slowly on large ranges.
  • Thus it will oscillate inefficiently down to the optimum when the variables are very uneven. What are the ideal ranges of our input variables in gradient descent? #
  • For example a range between minus 1 and 1.
  • These aren't exact requirements; we are only trying to speed things up. What is feature scaling? #
  • Involves dividing the input values by the range (i.e. the maximum value minus the minimum value) of the input variable.
  • Results in a new range of just 1.

What is mean normalization? #

  • Involves subtracting the average value for an input variable from the values for that input variable.
  • Results in a new average value for the input variable of just zero. How do you implement both feature scaling and mean normalization? # Feature Scaling and Mean Normalization. How can you debug gradient descent? #
  • Make a plot with number of iterations on the x-axis.
  • Now plot the cost function J of theta over the number of iterations of gradient descent.
  • If J of theta ever increases, then you probably need to decrease alpha. How can the step parameter alpha in gradient descent cause bugs? #
  • If alpha is too small: slow convergence.
  • If alpha is too large: may not decrease on every iteration and thus may not converge. What is the Automatic convergence test in gradient descent? #
  • Declare convergence if J of theta decreases by less than E in one iteration, where E is some small value such as 0.001.
  • However in practice it's difficult to choose this threshold value. How can we improve our features? (Multivariate Linear Regression) #
  • We can combine multiple features into one.
  • For example, we can combine x1 and x2 into a new feature x3 by taking x1 times x2. How can we improve the form of our hypothesis function? (Multivariate Linear Regression) By making it a quadratic , cubic or square root function (or any other form). What important thing should one keep in mind if one changes the form of a hypothesis function? (Multivariate Linear Regression) #
  • If you create new features when doing polynomial regression then feature scaling becomes very important.
  • The decision boundary is the line that separates the area where y = 0 and where y = 1.
  • It is created by our hypothesis function. How does the cost function for a logistic regression look like? #
  • We cannot use the same cost function that we use for linear regression because the Logistic Function will cause the output to be wavy, causing many local optima.
  • In other words, it will not be a convex function. Plot the cost function J, if the correct answer for y is 1.
  • If our correct answer 'y' is 1, then the cost function will be 0 if our hypothesis function outputs 1.
  • If our hypothesis approaches 0, then the cost function will approach infinity. Plot the cost function, if the correct answer for y is 0. #
  • If our correct answer 'y' is 0, then the cost function will be 0 if our hypothesis function also outputs 0.
  • If our hypothesis approaches 1, then the cost function will approach infinity. How can we simplify our cost function? (Logistic Regression Model) We can compress our cost function's two conditional cases into one case. Give the vectorized implementation of our simplified cost function! (Logistic Regression Model) A vectorized implementation is: Give the vectorized implementation for Gradient Descent! (Logistic Regression Model) A vectorized implementation is: What is gradient descent for our simplified cost function? (Logistic Regression Model) #
  • Notice that this algorithm is identical to the one we used in linear regression.
  • We still have to simultaneously update all values in theta. Depict an example of One-versus-all to classify 3 classes! (Multiclass Classification) The following image shows how one could classify 3 classes: What is the implementation of One-versus-all in Multiclass Classification? #
  • Train a logistic regression classifier h of theta for each class to predict the probability that y = i.
  • To make a prediction on a new x, pick the class that maximizes h of theta. What is underfitting? Underfitting, or high bias, is when the form of our hypothesis function h maps poorly to the trend of the data. What usually causes underfitting? It is usually caused by a function that is too simple or uses too few features. What is overfitting? Overfitting, or high variance , is caused by a hypothesis function that fits the available data but does not generalize well to predict new data. What usually causes overfitting? It is usually caused by a complicated function that creates a lot of unnecessary curves and angles unrelated to the data. What are the two main options to address the issue of overfitting? # Reduce the number of features :
  • Manually select which features to keep.
  • Use a model selection algorithm. Regularization :
  • Keep all the features, but reduce the magnitude of parameters theta j.
  • Regularization works well when we have a lot of slightly useful features. In a basic sense, what are neurons? Neurons are basically computational units that take inputs, called dendrites , as electrical inputs, called "spikes", that are channeled to outputs , called axons. What are the dendrites in the model of neural networks? In our model, our dendrites are like the input features. What are the axons in the model of neural networks? In our model, the axons are the results of our hypothesis function. What is the bias unit of a neural network? #

We can implement the 'XNOR' operator by using two hidden layers. Give an example of a neural network which classifies data into one of four categories! The inner layers, each provide us with some new information which leads to our final hypothesis function. State the cost function for neural networks. #

  • the double sum simply adds up the logistic regression costs calculated for each cell in the output layer.
  • the triple sum simply adds up the squares of all the individual theta s in the entire network.
  • the i in the triple sum does not refer to training example i. How are the variables L, s of l and K in the cost function of a neural network defined? #
  • L = total number of layers in the network.
  • s of l = number of units (not counting bias unit) in layer l.
  • K = number of output units. Define Backpropagation for neural networks. Backpropagation is neural-network terminology for minimizing our cost function. What does the matrix Delta in the Back propagation algorithm do? The capital-delta matrix D is used as an "accumulator" to add up our values as we go along and eventually compute our partial derivative. State the Backpropagation algorithm. Backpropagation algorithm. Which method randomly initializes our weights for our Theta matrices of a neural network? We initialize each Theta l,i,j to a random value between minus epsilon and epsilon. Give the setup of using a neural network. #
  • Pick a network architecture.
  • choose the layout of your neural network.
  • Number of input units; dimension of features x i.
  • Number of output units; number of classes.
  • Number of hidden units per layer; usually more the better. How does one train a neural network? #
  1. Randomly initialize the weights.
  2. Implement forward propagation.
  3. Implement the cost function.
  4. Implement backpropagation.
  5. Use gradient checking to confirm that your backpropagation works.
  6. Use gradient descent to minimize the cost function with the weights in theta. What code is implemented if we perform forward and back propagation? When we perform forward and back propagation, we loop on every training example. How can we break down our decision process deciding what to do next? #
  • Getting more training examples : Fixes high variance.
  • Trying smaller sets of features : Fixes high variance.
  • Adding features : Fixes high bias.
  • Adding polynomial features : Fixes high bias.
  • Decreasing lambda : Fixes high bias.
  • Increasing lambda : Fixes high variance. What issue poses a neural network with fewer parameters? A neural network with fewer parameters is prone to underfitting. What issue poses a neural network with more parameters? A large neural network with more parameters is prone to overfitting. How can you address the overfitting of a large neural network?

What is the relationship between the degree of the polynomial d and the underfitting or overfitting of our hypothesis? #

  • High bias (underfitting) : both J train(Θ) and J CV(Θ) will be high. Also, J CV(Θ) is approximately equal to J train(Θ).
  • High variance (overfitting) : J train(Θ) will be low and J CV(Θ) will be much greater than J train(Θ). **Which 3 separate error values can we calculate, if we break down our dataset as such:
  • Training set: 60%.
  • Cross validation set: 20%.
  • Test set: 20%.**
  1. Optimize the parameters in Theta (Θ) using the training set for each polynomial degree.
  2. Find the polynomial degree d with the least error using the cross validation set.
  3. Estimate the generalization error using the test set with J test, using d = theta from polynomial with lower error. Which function returns the values for jVal and gradient in a single turn? function [jVal, gradient] = costFunction(theta) jVal = [...code to compute J(theta)...]; gradient = [...code to compute derivative of J(theta)...]; end Given costFunction(), what do we have to do to implement fminunc()? we can use octave's "fminunc()" optimization algorithm along with the "optimset()" function that creates an object containing the options we want to send to "fminunc()" How can we approach regularization using the alternate method of the non-iterative normal equation? To add in regularization, the equation is the same as our original, except that we add another term inside the parentheses: Given a training set and a test set, what is the new procedure for evaluating a hypothesis? The new procedure using these two sets is then:
  4. Learn Θ and minimize Jtrain(Θ) using the training set
  5. Compute the test set error Jtest(Θ) What is the test set error for linear regression?

For linear regression What is the test set error for linear classification? For classification ~ Misclassification error (aka 0/1 misclassification error): What is the average test error for the test set? The average test error for the test set is. This gives us the proportion of the test data that was misclassified. Just because a learning algorithm fits a training set well, that does not mean [...] Just because a learning algorithm fits a training set well, that does not mean it is a good hypothesis. The error of your hypothesis as measured on the data set with which you trained the parameters will be [...] The error of your hypothesis as measured on the data set with which you trained the parameters will be lower than any other data set. Model Selection without the validation set?

  1. Optimize the parameters in Θ using the training set for each polynomial degree.
  2. Find the polynomial degree d with the least error using the test set.
  3. Estimate the generalization error also using the test set with Jtest(Θ(d)), (d = theta from polynomial with lower error); What is the consequence of selecting a model without the validation set? In this case, we have trained one variable, d, or the degree of the polynomial, using the test set. This will cause our error value to be greater for any other set of data. How can we solve the problem of selecting a model with only the training set? To solve this, we can introduce a third set, the Cross Validation Set, to serve as an intermediate set that we can train d with. Then our test set will give us an accurate, non-optimistic error. Model Selection with the validation set?
  4. Optimize the parameters in Θ using the training set for each polynomial degree.
  5. Find the polynomial degree d with the least error using the cross validation set.
  1. Compute the cross validation error using the learned Θ (computed with λ) on the JCV(Θ) without regularization or λ = 0.
  2. Select the best combo that produces the lowest error on the cross validation set.
  3. Using the best combo Θ and λ, apply it on Jtest(Θ) to see if it has a good generalization of the problem. As the training set gets larger, the error [...] increases. As the training set gets larger, the error for a quadratic function increases. The error value will [...] after a certain m, or training set size. The error value will plateau out after a certain m, or training set size. With high bias Low training set size: [...] Low training set size: causes Jtrain(Θ) to be low and JCV(Θ) to be high. With high bias Large training set size: [...] Large training set size: causes both Jtrain(Θ) and JCV(Θ) to be high with Jtrain(Θ)≈JCV(Θ). With high variance Low training set size: [...] Low training set size: Jtrain(Θ) will be low and JCV(Θ) will be high. With high variance Large training set size: Large training set size: Jtrain(Θ) increases with training set size and JCV(Θ) continues to decrease without leveling off. lso, Jtrain(Θ)
  • Choose the model which best fits the data without overfitting (very difficult).
  • Reduce the opportunity for overfitting through regularization. Bias: approximation error (Difference between expected value and optimal value)
  • High Bias = UnderFitting (BU)
  • Jtrain(Θ) and JCV(Θ) both will be high and Jtrain(Θ) ≈ JCV(Θ) Variance: estimation error due to finite data
  • High Variance = OverFitting (VO)
  • Jtrain(Θ) is low and JCV(Θ) ≫Jtrain(Θ) Intuition for the bias-variance trade-off: Complex model => [...] Complex model => sensitive to data => much affected by changes in X => high variance, low bias. Intuition for the bias-variance trade-off: Simple model => [...] Simple model => more rigid => does not change as much with changes in X => low variance, high bias. Regularization Effects?
  • Small values of λ allow model to become finely tuned to noise leading to large variance => overfitting.
  • Large values of λ pull weight parameters to zero leading to large bias => underfitting Model Complexity Effects? Lower-order polynomials (low model complexity) have high bias and low variance. In this case, the model fits poorly consistently. Higher-order polynomials (high model complexity) fit the training data extremely well and the test data extremely poorly. These have low bias on the training data, but very high variance. In reality, we would want to choose a model somewhere in between, that can generalize well but also fits the data reasonably well. A typical rule of thumb when running diagnostics is?

Or to say it another way, when we have lot more examples from one class than from the other clas Predicted: 1, Actual: 1 Predicted: 1, Actual: 1 --- True positive Predicted: 0, Actual: 0 Predicted: 0, Actual: 0 --- True negative Predicted: 0, Actual, 1 Predicted: 0, Actual, 1 --- False negative Predicted: 1, Actual: 0 Predicted: 1, Actual: 0 --- False positive Precision: of all patients we predicted where y=1, [...] Precision: of all patients we predicted where y=1, what fraction actually has cancer? Recall: Of all the patients that actually have cancer, what [...] Recall: Of all the patients that actually have cancer, what fraction did we correctly detect as having cancer? When is the F1 score not defined? if an algorithm predicts only negatives like it does in one of exercises, the precision is not defined, it is impossible to divide by 0. We might want a confident prediction of two classes using logistic regression. One way is to [...] We might want a confident prediction of two classes using logistic regression. One way is to increase our threshold. This way, we only predict cancer if the patient has a 70% chance. What tradeoff will we have if we want a more confident prediction of two classes using logistic regression? Doing this, we will have higher precision but lower recall (refer to the definitions in the previous section). What is the result if we want to get a very safe prediction? This will cause higher recall but lower precision.

Trading Off Precision and Recal The greater the threshold, the [...] The greater the threshold, the greater the precision and the lower the recall. Trading Off Precision and Recal The lower the threshold, the [...] The lower the threshold, the greater the recall and the lower the precisio Trading Off Precision and Recal In order to turn these two metrics into one single number, we can [...] In order to turn these two metrics into one single number, we can take the F value. In order for the F Score to be large, [...] In order for the F Score to be large, both precision and recall must be large. We want to train precision and recall on the [...] We want to train precision and recall on the cross validation set so as not to bias our test set In certain cases, an "inferior algorithm," if given [...], can [...] In certain cases, an "inferior algorithm," if given enough data, can outperform a superior algorithm with less data. We must choose our features to have [...]. A useful test is: [...] We must choose our features to have enough information. A useful test is: Given input x, would a human expert be able to confidently predict y? What is the "Rationale for large data"? Rationale for large data: if we have a low bias algorithm (many features or hidden units making a very complex function), then the larger the training set we use, the less we will have overfitting (and the more accurate the algorithm will be on the test set). The Support Vector Machine (SVM) is yet another type of supervised machine learning algorithm. It is sometimes [...] The Support Vector Machine (SVM) is yet another type of supervised machine learning algorithm. It is sometimes cleaner and more powerful.