
















Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!

















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
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
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.
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.
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.