Docsity

Risposte esame - Machine Learning, Prove d'esame di Machine learning

Toggle sidebar
bg1
3 FEBBRAIO 2016
1. The accuracy of Yˆ as a prediction for Y depends on two quantities, which we will call the
reducible error and the irreducible error. In general, fˆ will not be a perfect estimate for f, and
this inaccuracy will introduce some error. This error is reducible because we can potentially
improve the accuracy of fˆ by using the most appropriate statistical learning technique to
estimate f. However, even if it were possible to form a perfect estimate for f, so that our
estimated response took the form Yˆ = f(X), our prediction would still have some error in it!
This is because Y is also a function of ε, which, by definition, cannot be predicted using X.
Therefore, variability associated with ε also affects the accuracy of our predictions. This is
known as the irreducible error, because no matter how well we estimate f, we cannot reduce
the error introduced by ε.
2.
Variance refers to the amount by which fˆ would change if we estimated it using a different
training data set. Bias refers to the error that is introduced by approximating a real-life
problem, which may be extremely complicated, by a much simpler model.
The test MSE refers to the average test MSE that we would obtain if we repeatedly estimated f
using a large number of training sets tested each at x0. The overall expected test MSE can be
computed by averaging E(y0 − f(x0))^2 over all possible values of x0 in the test set.
The equation tells us that in order to minimize the expected test error, we need to select a
statistical learning method that simultaneously achieves low variance and low bias. Note that
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Anteprima parziale del testo

Scarica Risposte esame - Machine Learning e più Prove d'esame in PDF di Machine learning solo su Docsity!

3 FEBBRAIO 2016

  1. The accuracy of Yˆ as a prediction for Y depends on two quantities, which we will call the reducible error and the irreducible error. In general, fˆ will not be a perfect estimate for f, and this inaccuracy will introduce some error. This error is reducible because we can potentially improve the accuracy of fˆ by using the most appropriate statistical learning technique to estimate f. However, even if it were possible to form a perfect estimate for f, so that our estimated response took the form Yˆ = f(X), our prediction would still have some error in it! This is because Y is also a function of ε, which, by definition, cannot be predicted using X. Therefore, variability associated with ε also affects the accuracy of our predictions. This is known as the irreducible error, because no matter how well we estimate f, we cannot reduce the error introduced by ε.
  2. Variance refers to the amount by which fˆ would change if we estimated it using a different training data set. Bias refers to the error that is introduced by approximating a real-life problem, which may be extremely complicated, by a much simpler model. The test MSE refers to the average test MSE that we would obtain if we repeatedly estimated f using a large number of training sets tested each at x0. The overall expected test MSE can be computed by averaging E(y0 − f(x0))^2 over all possible values of x0 in the test set. The equation tells us that in order to minimize the expected test error, we need to select a statistical learning method that simultaneously achieves low variance and low bias. Note that

variance is inherently a nonnegative quantity, and squared bias is also nonnegative. Hence, we see that the expected test MSE can never lie below Var(ε), the irreducible error.

The test error rate associated with a set of test observations of the form (x0, y0) is given by this formula where yˆ0 is the predicted class label that results from applying the classifier to the test observation with predictor x0. A good classifier is one for which the test error is smallest. It is possible to show that the test error rate is minimized, on average, by a very simple classifier that assigns each observation to the most likely class, given its predictor values. In other words, we should simply assign a test observation with predictor vector x0 to the class j for which is largest. Note that this is a conditional probability: it is the probability that Y = j, given the observed predictor vector x0. This very simple classifier is called the Bayes classifier

  1. Suppose we have a two class example (class 0 and class 1) and we want to find out the probability to have Y=1 given X. Using Regression, we know that but with this function we could have negative probabilities or probabilities bigger than 1. The probability must fall between 0 and 1. Changing the function to allow us to have the probability always between 0 and 1.

where μk and σk^2 are the mean and variance parameters for the kth class. For now, let us further assume that σ 12 =... = σK^2 : that is, there is a shared variance term across all K classes, which for simplicity we can denote by σ^2. Taking the log and rearranging the terms, it is not hard to show that this is equivalent to assigning the observation to the class for which is largest. For instance, if K = 2 and π 1 = π 2 , then the Bayes classifier assigns an observation to class 1 if 2x(μ 1 −μ 2 ) > μ 12 −μ 22 , and to class 2 otherwise. In this case, the Bayes decision boundary corresponds to the point where To indicate that a p-dimensional random variable X has a multi- variate Gaussian distribution, we write X ∼ N(μ,Σ). Here E(X) = μ is the mean of X (a vector with p components), and Cov(X) = Σ is the p × p covariance matrix of X. Formally, the multivariate Gaussian density is defined as In the case of p > 1 predictors, the LDA classifier assumes that the observations in the kth class are drawn from a multivariate Gaussian distribution N (μk , Σ), where μk is a class-specific mean vector, and Σ is a covariance matrix that is common to all K classes. Plugging the density function for the kth class, fk(X = x), and performing a little bit of algebra reveals that the Bayes classifier assigns an observation X = x to the class for which The Bayes decision boundaries are represented by the set of values x for which δk(x) = δl(x)

1 Distances are normally used to measure the similarity or dissimilarity between two data objects. However, they are two different things! For example, dissimilarities can be judged by a set of users in a survey: they do not necessarily satisfy the triangle inequality, they can be 0 even if two objects are not the same. So, it is not always possible to calculate one from the other. 2 Some of them need also some other parameters to work. For example, in k-means you also have to specify K, the number of cluster to be used. 3 SSE is the sum of the squared differences between each observation and its group's mean. It can be used as a measure of variation within a cluster. If all cases within a cluster are identical the SSE would then be equal to 0. We should think about how SSE is computed. We could have for example a very low SSE for all cluster but one. This last one could contain points that are far from the cluster mean and so it could have a very high SSE. On the other hand, we could have all cluster where all the points

19 FEBBRAIO 2016

a. A discriminative classifier tries to model by just depending on the observed data. It makes fewer assumptions on the distributions but depends heavily on the quality of the data. An example is Support Vector Machine. The generative classifier tries to learn the model that generates the data behind the scenes by estimating the assumptions and distributions of the model. It then uses this to predict unseen data, because it assumes the model that was learned captures the real model. An example is the LDA. b. Logistic Regression is a generative model since it assumes that the log odds is linear c. Linear Discriminant Analysis is a generative model since it assumes that fk(x) ≡ Pr(X = x|Y = k) denote the density function of X for an observation that comes from the kth class is normal or Gaussian.

d. Support Vector Machine is discriminative because it explicitly learns the class boundary between the two classes e. The support vector machine is a generalization of a simple and intuitive classifier called the maximal margin classifier. The support vector classifier, an extension of the maximal margin classifier, can be applied in a broader range of cases. The support vector machine, which is a further extension of the support vector classifier, can accommodate non-linear class boundaries. The support vector classifier tries to solve the following optimization problem: The support vector machine (SVM) is an extension of the support vector classifier that results from enlarging the feature space in a specific way. The SWM involves only the inner products of the observations (as opposed to the observations themselves) The linear support vector classifier can be represented as where there are n parameters αi, i = 1,... , n, one per training observation. To estimate the parameters α ,...,α and β , all we need are the inner products ⟨xi, xiʹ ⟩ between all pairs of training observations Notice that in order to evaluate the function f(x), we need to compute the inner product between the new point x and each of the training points xi. However, it turns out that αi is nonzero only for the support vectors in the solution—that is, if a training observation is not a support vector, then its αi equals zero. f. Now suppose that every time the inner product appears in the representation, or in a calculation of the solution for the support vector classifier, we replace it with a generalization of the inner product of the form

a. If the true relationship is linear expect good value of RSS for both train and test if I use a linear regression model. With the other two models, I expect better train RSS (they will try to follow the errors) but worse test RSS than with linear regression model. If the true relation is cubic I expect poor value of train and test RSS for the linear regression model. Good value for the polynomial regression model even it will try to overfit the data since it can work up to the fourth degree. I expect even better result for the train RSS using the smoothing spline, but worse test RSS then in the other cases. b. The standard linear regression model provides interpretable results and works quite well on many real-world problems. However, it makes several highly restrictive assumptions that are often violated in practice. Two of the most important assumptions state that the relationship between the predictors and response are additive and linear. The additive assumption means that the effect of changes in a predictor Xj on the response Y is independent of the values of the other predictors. The linear assumption states that the change in the response Y due to a one-unit change in Xj is constant, regardless of the value of Xj. Consider the standard linear regression model with two variables, According to this model, if we increase X1 by one unit, then Y will increase by an average of β units. Notice that the presence of X2 does not alter this statement—that is, regardless of the value of X2, a one-unit increase in X1 will lead to a β1-unit increase in Y. One way of extending this model to allow for interaction effects is to include a third predictor, called an interaction term, which is constructed by computing the product of X1 and X2. This results in the model Notice that it can be rewritten as

where β ̃1 = β1 + β3X2. Since β ̃ 1 changes with X2, the effect of X1 on Y is no longer constant: adjusting X2 will change the impact of X1 on Y.

7 LUGLIO 2016

3 The model complexity indicates how much a model is flexible. The more the model is complex the more it can fit strange shapes. For example, a polynomial model is more flexible than a linear one. In general, a more complex model reduces the bias since it goes near the real problem which is typically very complex but increase in variance because different dataset can easily result in different model.

We should prefer the black model because it is the one with lower MSE.

boundaries between the classes are linear. SWM when the boundaries are not linear and very complex.

  1. KNN does not have a training phase but the cost of computing the result for a single test point could be high. LDA perform better if the boundaries are linear. If not better use SWM.
  2. KNN and SWM have non-linear decision boundaries. There is an extension of LDA called Quadratic Discriminant Analysis (QDA) that uses polynomial fit to get non-linear boundaries.
  1. Internal or unsupervised indices are used to measure the goodness of a clustering structure without respect to external information. SSE is an internal index. External or supervised indices are used to measure the extent to which cluster labels match externally supplied class labels. Accuracy is an external index.
  2. SSE is typically used to decide about the number of cluster. The best value for SSE is 0, meaning that all the members of each cluster are the equal. We could not tell if 15,3 is a good value or not. We should run the algorithm with different number of cluster and then compare the SSE.
  3. Obviously increasing K will reduce the SSE because we have smaller cluster and the within cluster SSE will be lower. We should compare the SSEs relative to the different values of K and decide when to stop.
  4. Looking at the SSE the first algorithm is better because we have a lower value. This probably means that we are working with a higher number of clusters. The accuracy is better with the second algorithm, so this mean that even if we have bigger cluster with bigger SSE, the second algorithm provides result that are more similar to the one externally provided.

a The standard error tells us the average amount that this estimate μˆ differs from the actual value of μ. Standard errors can be used to compute confidence intervals. A 95% confidence interval is defined as a range of values such that with 95% probability, the range will contain the true unknown value of the parameter. The range is defined in terms of lower and upper limits computed from the sample of data. For linear regression, the 95% confidence interval for β1 approximately takes the form b Standard errors can also be used to perform hypothesis tests on the coefficients. The most common hypothesis test involves testing the null hypothesis of To test the null hypothesis, we need to determine whether βˆ1, our estimate for β1, is sufficiently far from zero that we can be confident that β1 is non-zero. That is, it depends on SE(βˆ1). If SE(βˆ1) is small, then even relatively small values of βˆ1 may provide strong evidence that β1 ̸= 0, and hence that there is a relationship between X and Y. In contrast, if SE(βˆ1) is large, then βˆ1 must be large in absolute value in order for us to reject the null hypothesis. In practice, we compute a t-statistic, given by which measures the number of standard deviations that βˆ1 is away from 0. It is a simple matter to compute the probability of observing any number equal to |t| or larger in absolute value, assuming β1 = 0. We call this probability the p-value.

  1. The curse of dimensionality refers to the problems arising when working with a high dimensional space. Typically, these problems do not affect low dimensional space. If we have lots of feature the variance of out model is higher. Removing some feature from the model allow us to reduce the variance of the model with a little increase in bias. So, with the same number of data points is better to have less features. If we have many features we could end up building a model on noise. We could have some coefficient for feature that actually are not related to the outcome. To solve the problem of dimensionality we could use feature selection algorithms. [Wikipedia] In machine learning problems that involve learning a "state-of-nature" from a finite number of data samples in a high-dimensional feature space with each feature having a range of possible values, typically an enormous amount of training data is required to ensure that there are several samples with each combination of values. A typical rule of thumb is that there should be at least 5 training examples for each dimension in the representation. With a fixed number of training samples, the predictive power of a classifier or regressor first increases as number of dimensions/features used is increased but then decreases, which is known as Hughes phenomenon or peaking phenomena.